diff options
author | Arne Juul <arnej@yahoo-inc.com> | 2018-06-12 12:50:28 +0200 |
---|---|---|
committer | Arne Juul <arnej@yahoo-inc.com> | 2018-06-12 13:51:45 +0200 |
commit | 016e584f0ad5a071e13d75eb8ad5ddb46b8c54f5 (patch) | |
tree | 869d4e4a4c4b8a9f9ef691b2980009017dece9e6 /searchlib/src/tests/btree | |
parent | 22796dddd3dc025018093783328ac87535ffecd9 (diff) |
use LOG_ABORT not just abort()
* abort() has the unfortunate effect that nothing is seen in the log,
just an event (which is usually not displayed); so ops people don't
see that the program is crashing at all.
* LOG_ABORT("message") will log an error with the message (and the file
and line) before calling abort(), so it's easy to see what happened.
* add or move <vespa/log/log.h> include and LOG_SETUP lines before
LOG_ABORT is used (or included).
Diffstat (limited to 'searchlib/src/tests/btree')
-rw-r--r-- | searchlib/src/tests/btree/frozenbtree_test.cpp | 8 | ||||
-rw-r--r-- | searchlib/src/tests/btree/iteratespeed.cpp | 6 |
2 files changed, 7 insertions, 7 deletions
diff --git a/searchlib/src/tests/btree/frozenbtree_test.cpp b/searchlib/src/tests/btree/frozenbtree_test.cpp index 399c20f53cc..871752b7a0d 100644 --- a/searchlib/src/tests/btree/frozenbtree_test.cpp +++ b/searchlib/src/tests/btree/frozenbtree_test.cpp @@ -1,5 +1,8 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +#include <vespa/log/log.h> +LOG_SETUP("frozenbtree_test"); + #define DEBUG_FROZENBTREE #define LOG_FROZENBTREEXX #include <vespa/vespalib/testkit/testapp.h> @@ -10,9 +13,6 @@ #include <vespa/searchlib/btree/btreenodeallocator.hpp> #include <map> -#include <vespa/log/log.h> -LOG_SETUP("frozenbtree_test"); - using search::btree::BTreeRoot; using search::btree::BTreeNode; using search::btree::BTreeInternalNode; @@ -306,7 +306,7 @@ FrozenBTreeTest::sortRandomValues() } else if (*i == prevVal) okcnt++; else - abort(); + LOG_ABORT("should not be reached"); prevVal = *i; } EXPECT_TRUE(okcnt == sorted.size()); diff --git a/searchlib/src/tests/btree/iteratespeed.cpp b/searchlib/src/tests/btree/iteratespeed.cpp index 2f60b06d675..6e6029335e8 100644 --- a/searchlib/src/tests/btree/iteratespeed.cpp +++ b/searchlib/src/tests/btree/iteratespeed.cpp @@ -1,5 +1,8 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +#include <vespa/log/log.h> +LOG_SETUP("iteratespeed"); + #include <vespa/searchlib/btree/btreeroot.h> #include <vespa/searchlib/btree/btreebuilder.h> #include <vespa/searchlib/btree/btreenodeallocator.h> @@ -18,9 +21,6 @@ #include <vespa/fastos/app.h> #include <vespa/fastos/timestamp.h> -#include <vespa/log/log.h> -LOG_SETUP("iteratespeed"); - namespace search { namespace btree { |