diff --git a/src/gtest/main.cpp b/src/gtest/main.cpp index 3caecf851..851b110ac 100644 --- a/src/gtest/main.cpp +++ b/src/gtest/main.cpp @@ -1,4 +1,5 @@ #include "gmock/gmock.h" +#include "init.h" #include "key.h" #include "pubkey.h" #include "util.h" @@ -6,6 +7,7 @@ #include "librustzcash.h" #include +#include const std::function G_TRANSLATION_FUN = nullptr; @@ -20,6 +22,13 @@ int main(int argc, char **argv) { assert(sodium_init() != -1); ECC_Start(); + // Log all errors to stdout so we see them in test output. + std::string initialFilter = "error"; + pTracingHandle = tracing_init( + nullptr, 0, + initialFilter.c_str(), + false); + testing::InitGoogleMock(&argc, argv); // The "threadsafe" style is necessary for correct operation of death/exit diff --git a/src/test/test_bitcoin.cpp b/src/test/test_bitcoin.cpp index f3360fe19..a1fb0f2d7 100644 --- a/src/test/test_bitcoin.cpp +++ b/src/test/test_bitcoin.cpp @@ -27,6 +27,7 @@ #include #include #include +#include #include "librustzcash.h" @@ -74,7 +75,18 @@ BasicTestingSetup::BasicTestingSetup(const std::string& chainName) ECC_Start(); SetupEnvironment(); SetupNetworking(); - fPrintToDebugLog = false; // don't want to write to debug.log file + + // Uncomment this to log all errors to stdout so we see them in test output. + // We don't enable this by default because several tests intentionally cause + // verbose error output (while exercising failure cases). + // if (pTracingHandle == nullptr) { + // std::string initialFilter = "error"; + // pTracingHandle = tracing_init( + // nullptr, 0, + // initialFilter.c_str(), + // false); + // } + fCheckBlockIndex = true; SelectParams(chainName); noui_connect();