summaryrefslogtreecommitdiffstats
path: root/searchlib/src/tests/ranksetup/ranksetup_test.cpp
diff options
context:
space:
mode:
authorHåvard Pettersen <havardpe@oath.com>2020-03-20 14:45:00 +0000
committerHåvard Pettersen <havardpe@oath.com>2020-03-20 14:45:00 +0000
commit09bd0157e8c67fb88b7aec70c9bfb67b1b20d2e8 (patch)
treef9877b067ee875281255ccb4737a0120889efdb6 /searchlib/src/tests/ranksetup/ranksetup_test.cpp
parentc3c398c947d1b2f577f5dff3ee6516459d388f47 (diff)
better rank feature back-traces
- log as additional lines on original failure message - skip frames a bit after the middle, not at the very end
Diffstat (limited to 'searchlib/src/tests/ranksetup/ranksetup_test.cpp')
-rw-r--r--searchlib/src/tests/ranksetup/ranksetup_test.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/searchlib/src/tests/ranksetup/ranksetup_test.cpp b/searchlib/src/tests/ranksetup/ranksetup_test.cpp
index 7a26180eed2..0a20ddb3739 100644
--- a/searchlib/src/tests/ranksetup/ranksetup_test.cpp
+++ b/searchlib/src/tests/ranksetup/ranksetup_test.cpp
@@ -1,6 +1,7 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include <vespa/vespalib/testkit/testapp.h>
+#include <vespa/vespalib/util/stringfmt.h>
#include <vespa/searchlib/common/feature.h>
#include <vespa/searchlib/attribute/attributeguard.h>
@@ -39,6 +40,7 @@ using namespace search::fef;
using namespace search::features;
using namespace search::fef::test;
using search::feature_t;
+using vespalib::make_string_short::fmt;
typedef FeatureNameBuilder FNB;
@@ -477,12 +479,22 @@ RankSetupTest::testCompilation()
rs.setFirstPhaseRank(oss.str());
EXPECT_TRUE(!rs.compile());
}
- { // cycle
+ { // short cycle
RankSetup rs(_factory, _indexEnv);
// c(c,4,2) -> c(c,3,2) -> c(c,2,2) -> c(c,1,2) -> c(c,2,2)
rs.setFirstPhaseRank("chain(cycle,4,2)");
EXPECT_TRUE(!rs.compile());
}
+ { // cycle with max back-trace
+ RankSetup rs(_factory, _indexEnv);
+ rs.setFirstPhaseRank(fmt("chain(cycle,%d,2)", BlueprintResolver::MAX_TRACE_SIZE));
+ EXPECT_TRUE(!rs.compile());
+ }
+ { // cycle with max+1 back-trace (skip 2)
+ RankSetup rs(_factory, _indexEnv);
+ rs.setFirstPhaseRank(fmt("chain(cycle,%d,2)", BlueprintResolver::MAX_TRACE_SIZE + 1));
+ EXPECT_TRUE(!rs.compile());
+ }
}
void RankSetupTest::testRankSetup()