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/attribute/benchmark | |
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/attribute/benchmark')
-rw-r--r-- | searchlib/src/tests/attribute/benchmark/attributebenchmark.cpp | 11 | ||||
-rw-r--r-- | searchlib/src/tests/attribute/benchmark/attributeupdater.h | 4 |
2 files changed, 7 insertions, 8 deletions
diff --git a/searchlib/src/tests/attribute/benchmark/attributebenchmark.cpp b/searchlib/src/tests/attribute/benchmark/attributebenchmark.cpp index 5722b7c90ca..0eb2dd2cbc4 100644 --- a/searchlib/src/tests/attribute/benchmark/attributebenchmark.cpp +++ b/searchlib/src/tests/attribute/benchmark/attributebenchmark.cpp @@ -1,4 +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("attributebenchmark"); + #include <vespa/searchlib/util/randomgenerator.h> #include <vespa/searchlib/attribute/attribute.h> #include <vespa/searchlib/attribute/attributeguard.h> @@ -8,6 +12,7 @@ #include <vespa/searchlib/attribute/singlestringattribute.h> #include <vespa/searchlib/attribute/multistringattribute.h> #include <vespa/searchlib/attribute/attrvector.h> +#include <vespa/searchlib/attribute/attributevector.hpp> #include <vespa/fastos/thread.h> #include <vespa/fastos/app.h> #include <iostream> @@ -16,12 +21,6 @@ #include "attributeupdater.h" #include <sys/resource.h> -#include <vespa/log/log.h> - -LOG_SETUP("attributebenchmark"); - -#include <vespa/searchlib/attribute/attributevector.hpp> - using std::shared_ptr; typedef std::vector<uint32_t> NumVector; diff --git a/searchlib/src/tests/attribute/benchmark/attributeupdater.h b/searchlib/src/tests/attribute/benchmark/attributeupdater.h index 13360e58b2d..1b493dabcc7 100644 --- a/searchlib/src/tests/attribute/benchmark/attributeupdater.h +++ b/searchlib/src/tests/attribute/benchmark/attributeupdater.h @@ -25,7 +25,7 @@ public: if (!rc) { std::cout << "Assert " << _totalCnt << " failed: \"" << str << "\" (" << file << ":" << line << ")" << std::endl; - abort(); + LOG_ABORT("should not be reached"); } return true; } @@ -39,7 +39,7 @@ public: std::cout << aStr << ": " << a << std::endl; std::cout << bStr << ": " << b << std::endl; std::cout << "(" << file << ":" << line << ")" << std::endl; - abort(); + LOG_ABORT("should not be reached"); } return true; } |