From 09bd0157e8c67fb88b7aec70c9bfb67b1b20d2e8 Mon Sep 17 00:00:00 2001 From: HÃ¥vard Pettersen Date: Fri, 20 Mar 2020 14:45:00 +0000 Subject: 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 --- searchlib/src/tests/ranksetup/ranksetup_test.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'searchlib/src/tests/ranksetup/ranksetup_test.cpp') 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 +#include #include #include @@ -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() -- cgit v1.2.3