Page MenuHomePhabricator

test: Show debug log on unit test failure
ClosedPublic

Authored by PiRK on Aug 27 2021, 15:59.

Details

Reviewers
majcosta
Group Reviewers
Restricted Project
Commits
rABCee4e128c034d: test: Show debug log on unit test failure
Summary

This is a backport of core#16975

Test Plan

ninja check

Event Timeline

PiRK requested review of this revision.Aug 27 2021, 15:59

i think this should be tested by others, and discussed. The result adds a lot of verbosity, and usually unit test failures are already quite verbose (because of the long loops).

I tried it with the following patch:

diff --git a/src/avalanche/test/processor_tests.cpp b/src/avalanche/test/processor_tests.cpp
index 240522d2c7..5d3d895cf6 100644
--- a/src/avalanche/test/processor_tests.cpp
+++ b/src/avalanche/test/processor_tests.cpp
@@ -336,6 +336,7 @@ BOOST_AUTO_TEST_CASE(block_register) {
     BOOST_CHECK_EQUAL(invs.size(), 1);
     BOOST_CHECK_EQUAL(invs[0].type, MSG_BLOCK);
     BOOST_CHECK(invs[0].hash == blockHash);
+    BOOST_CHECK(false);

     // Newly added blocks' state reflect the blockchain.
     BOOST_CHECK(m_processor->isAccepted(pindex));
majcosta requested changes to this revision.Aug 27 2021, 21:15
majcosta added a subscriber: majcosta.
majcosta added inline comments.
src/avalanche/test/fixture.cpp
20

add newline

src/pow/test/fixture.cpp
20

ditto

This revision now requires changes to proceed.Aug 27 2021, 21:15
This revision is now accepted and ready to land.Aug 28 2021, 08:22