Skip to content

Commit 0c9de67

Browse files
author
MarcoFalke
committed
Merge #15352: tests: Reduce noise level in test_bitcoin output
0aef39d Silence "Test case [...] did not check any assertions" warnings when running "test_bitcoin --log_level=test_suite" (practicalswift) 5fd73c8 Avoid repeated log messages in tests by connecting to signal handlers (ThreadSafeMessageBox, etc.) only once (practicalswift) e502c3c tests: Reduce noise level in test_bitcoin output (practicalswift) Pull request description: Reduce noise level in `test_bitcoin` output. Context: When working on the non-determinism issues in the unit tests (see #15296) I got a bit tired of the amount of noise in the `test_bitcoin` output :-) Before: ``` $ src/test/test_bitcoin --log_level=test_suite 2>&1 | grep -vE '(Entering|Leaving)' | uniq -c 1 Running 341 test cases... 1 Test case blockencodings_tests/TransactionsRequestDeserializationOverflowTest did not check any assertions 1 CheckSplitTorReplyLine(PROTOCOLINFO PIVERSION) 1 CheckSplitTorReplyLine(AUTH METHODS=COOKIE,SAFECOOKIE COOKIEFILE="/home/x/.tor/control_auth_cookie") 1 CheckSplitTorReplyLine(AUTH METHODS=NULL) 1 CheckSplitTorReplyLine(AUTH METHODS=HASHEDPASSWORD) 1 CheckSplitTorReplyLine(VERSION Tor="0.2.9.8 (git-a0df013ea241b026)") 1 CheckSplitTorReplyLine(AUTHCHALLENGE SERVERHASH=aaaa SERVERNONCE=bbbb) 1 CheckSplitTorReplyLine(COMMAND) 1 CheckSplitTorReplyLine(COMMAND SOME ARGS) 1 CheckSplitTorReplyLine(COMMAND ARGS) 1 CheckSplitTorReplyLine(COMMAND EVEN+more ARGS) 1 CheckParseTorReplyMapping(METHODS=COOKIE,SAFECOOKIE COOKIEFILE="/home/x/.tor/control_auth_cookie") 1 CheckParseTorReplyMapping(METHODS=NULL) 1 CheckParseTorReplyMapping(METHODS=HASHEDPASSWORD) 1 CheckParseTorReplyMapping(Tor="0.2.9.8 (git-a0df013ea241b026)") 1 CheckParseTorReplyMapping(SERVERHASH=aaaa SERVERNONCE=bbbb) 1 CheckParseTorReplyMapping(ServiceID=exampleonion1234) 1 CheckParseTorReplyMapping(PrivateKey=RSA1024:BLOB) 1 CheckParseTorReplyMapping(ClientAuth=bob:BLOB) 1 CheckParseTorReplyMapping(Foo=Bar=Baz Spam=Eggs) 1 CheckParseTorReplyMapping(Foo="Bar=Baz") 1 CheckParseTorReplyMapping(Foo="Bar Baz") 1 CheckParseTorReplyMapping(Foo="Bar\ Baz") 1 CheckParseTorReplyMapping(Foo="Bar\Baz") 1 CheckParseTorReplyMapping(Foo="Bar\@baz") 1 CheckParseTorReplyMapping(Foo="Bar\"Baz" Spam="\"Eggs\"") 1 CheckParseTorReplyMapping(Foo="Bar\\Baz") 1 CheckParseTorReplyMapping(Foo="Bar\nBaz\t" Spam="\rEggs" Octals="\1a\11\17\18\81\377\378\400\2222" Final=Check) 1 CheckParseTorReplyMapping(Valid=Mapping Escaped="Escape\\") 1 CheckParseTorReplyMapping(Valid=Mapping Bare="Escape\") 1 CheckParseTorReplyMapping(OneOctal="OneEnd\1" TwoOctal="TwoEnd\11") 1 CheckParseTorReplyMapping(Null="\0") 1 CheckParseTorReplyMapping(SOME=args,here MORE optional=arguments here) 1 CheckParseTorReplyMapping(ARGS) 1 CheckParseTorReplyMapping(MORE ARGS) 1 CheckParseTorReplyMapping(MORE ARGS) 1 CheckParseTorReplyMapping(EVEN more=ARGS) 1 CheckParseTorReplyMapping(EVEN+more ARGS) 1 Test case util_tests/util_criticalsection did not check any assertions 1 Testing known outcomes 326 Error: Specified -walletdir "/tmp/test_bitcoin/1553850209_943311758/tempdir/path_does_not_exist" does not exist 327 Error: Specified -walletdir "/tmp/test_bitcoin/1553850209_643733972/tempdir/not_a_directory.dat" is not a directory 328 Error: Specified -walletdir "wallets" is a relative path 1 1 *** No errors detected ``` After: ``` $ src/test/test_bitcoin --log_level=test_suite 2>&1 | grep -vE '(Entering|Leaving)' | uniq -c 1 Running 341 test cases... 1 Error: Specified -walletdir "/tmp/test_bitcoin/1553850026_943311758/tempdir/path_does_not_exist" does not exist 1 Error: Specified -walletdir "/tmp/test_bitcoin/1553850026_643733972/tempdir/not_a_directory.dat" is not a directory 1 Error: Specified -walletdir "wallets" is a relative path 1 1 *** No errors detected ``` ACKs for commit 0aef39: MarcoFalke: utACK 0aef39d Tree-SHA512: 9cc22f64aa5c875861bae6533d18675ad978c623f053754deef6a8e271ea70bda3f72fb4ec5c8fd19b841757f21380639051d5f5b44301b9d2464b57655e9c05
2 parents 5983239 + 0aef39d commit 0c9de67

File tree

6 files changed

+9
-7
lines changed

6 files changed

+9
-7
lines changed

src/test/blockencodings_tests.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -386,6 +386,7 @@ BOOST_AUTO_TEST_CASE(TransactionsRequestDeserializationOverflowTest) {
386386
BOOST_CHECK(0);
387387
} catch(std::ios_base::failure &) {
388388
// deserialize should fail
389+
BOOST_CHECK(true); // Needed to suppress "Test case [...] did not check any assertions"
389390
}
390391
}
391392

src/test/checkqueue_tests.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,6 @@ static void Correct_Queue_range(std::vector<size_t> range)
167167
BOOST_REQUIRE(control.Wait());
168168
if (FakeCheckCheckCompletion::n_calls != i) {
169169
BOOST_REQUIRE_EQUAL(FakeCheckCheckCompletion::n_calls, i);
170-
BOOST_TEST_MESSAGE("Failure on trial " << i << " expected, got " << FakeCheckCheckCompletion::n_calls);
171170
}
172171
}
173172
tg.interrupt_all();

src/test/setup_common.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,11 @@ BasicTestingSetup::BasicTestingSetup(const std::string& chainName)
4343
InitScriptExecutionCache();
4444
fCheckBlockIndex = true;
4545
SelectParams(chainName);
46-
noui_connect();
46+
static bool noui_connected = false;
47+
if (!noui_connected) {
48+
noui_connect();
49+
noui_connected = true;
50+
}
4751
}
4852

4953
BasicTestingSetup::~BasicTestingSetup()

src/test/torcontrol_tests.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ BOOST_FIXTURE_TEST_SUITE(torcontrol_tests, BasicTestingSetup)
2020

2121
static void CheckSplitTorReplyLine(std::string input, std::string command, std::string args)
2222
{
23-
BOOST_TEST_MESSAGE(std::string("CheckSplitTorReplyLine(") + input + ")");
2423
auto ret = SplitTorReplyLine(input);
2524
BOOST_CHECK_EQUAL(ret.first, command);
2625
BOOST_CHECK_EQUAL(ret.second, args);
@@ -61,7 +60,6 @@ BOOST_AUTO_TEST_CASE(util_SplitTorReplyLine)
6160

6261
static void CheckParseTorReplyMapping(std::string input, std::map<std::string,std::string> expected)
6362
{
64-
BOOST_TEST_MESSAGE(std::string("CheckParseTorReplyMapping(") + input + ")");
6563
auto ret = ParseTorReplyMapping(input);
6664
BOOST_CHECK_EQUAL(ret.size(), expected.size());
6765
auto r_it = ret.begin();
@@ -173,7 +171,6 @@ BOOST_AUTO_TEST_CASE(util_ParseTorReplyMapping)
173171

174172
// Special handling for null case
175173
// (needed because string comparison reads the null as end-of-string)
176-
BOOST_TEST_MESSAGE(std::string("CheckParseTorReplyMapping(Null=\"\\0\")"));
177174
auto ret = ParseTorReplyMapping("Null=\"\\0\"");
178175
BOOST_CHECK_EQUAL(ret.size(), 1U);
179176
auto r_it = ret.begin();

src/test/util_tests.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,10 @@ BOOST_AUTO_TEST_CASE(util_criticalsection)
3636

3737
do {
3838
TRY_LOCK(cs, lockTest);
39-
if (lockTest)
39+
if (lockTest) {
40+
BOOST_CHECK(true); // Needed to suppress "Test case [...] did not check any assertions"
4041
break;
42+
}
4143

4244
BOOST_ERROR("break was swallowed!");
4345
} while(0);

src/wallet/test/coinselector_tests.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,6 @@ BOOST_AUTO_TEST_CASE(bnb_search_test)
135135
/////////////////////////
136136
// Known Outcome tests //
137137
/////////////////////////
138-
BOOST_TEST_MESSAGE("Testing known outcomes");
139138

140139
// Empty utxo pool
141140
BOOST_CHECK(!SelectCoinsBnB(GroupCoins(utxo_pool), 1 * CENT, 0.5 * CENT, selection, value_ret, not_input_fees));

0 commit comments

Comments
 (0)