diff options
author | MarcoFalke <falke.marco@gmail.com> | 2019-09-27 11:53:34 -0400 |
---|---|---|
committer | MarcoFalke <falke.marco@gmail.com> | 2020-01-02 18:00:05 -0500 |
commit | fa37e0a68bea65979f9f8f2e5258fe608acf2bdf (patch) | |
tree | 8deac6542c23efb0dad232c4c30bc88c68187e71 /src/test/util | |
parent | 17e14ac92fced92457945859463eda5d435bdd49 (diff) | |
download | bitcoin-fa37e0a68bea65979f9f8f2e5258fe608acf2bdf.tar.xz |
test: Show debug log on unit test failure
Diffstat (limited to 'src/test/util')
-rw-r--r-- | src/test/util/setup_common.cpp | 1 | ||||
-rw-r--r-- | src/test/util/setup_common.h | 3 |
2 files changed, 4 insertions, 0 deletions
diff --git a/src/test/util/setup_common.cpp b/src/test/util/setup_common.cpp index 3bdf3485fa..ccb3064d59 100644 --- a/src/test/util/setup_common.cpp +++ b/src/test/util/setup_common.cpp @@ -71,6 +71,7 @@ BasicTestingSetup::BasicTestingSetup(const std::string& chainName) SelectParams(chainName); SeedInsecureRand(); gArgs.ForceSetArg("-printtoconsole", "0"); + if (G_TEST_LOG_FUN) LogInstance().PushBackCallback(G_TEST_LOG_FUN); InitLogging(); LogInstance().StartLogging(); SHA256AutoDetect(); diff --git a/src/test/util/setup_common.h b/src/test/util/setup_common.h index 1e2e059a56..6741be8480 100644 --- a/src/test/util/setup_common.h +++ b/src/test/util/setup_common.h @@ -18,6 +18,9 @@ #include <boost/thread.hpp> +/** This is connected to the logger. Can be used to redirect logs to any other log */ +extern const std::function<void(const std::string&)> G_TEST_LOG_FUN; + // Enable BOOST_CHECK_EQUAL for enum class types template <typename T> std::ostream& operator<<(typename std::enable_if<std::is_enum<T>::value, std::ostream>::type& stream, const T& e) |