diff options
author | Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> | 2020-09-20 11:33:48 +0300 |
---|---|---|
committer | Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> | 2020-12-10 20:46:29 +0200 |
commit | c5e3e74f70c29ac8852903ef425f5f327d5da969 (patch) | |
tree | 4c5dacce17a448d00e01a248d36ef03ce78642b9 /src/test | |
parent | da957cd62ecc7fde5fa1dfcd134a73b388c2d438 (diff) | |
download | bitcoin-c5e3e74f70c29ac8852903ef425f5f327d5da969.tar.xz |
sync: Improve CheckLastCritical()
This commit adds actual lock stack logging if check fails.
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/reverselock_tests.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/test/reverselock_tests.cpp b/src/test/reverselock_tests.cpp index a42608a66d..7da364d316 100644 --- a/src/test/reverselock_tests.cpp +++ b/src/test/reverselock_tests.cpp @@ -48,12 +48,14 @@ BOOST_AUTO_TEST_CASE(reverselock_errors) WAIT_LOCK(mutex, lock); #ifdef DEBUG_LOCKORDER + bool prev = g_debug_lockorder_abort; + g_debug_lockorder_abort = false; + // Make sure trying to reverse lock a previous lock fails - try { - REVERSE_LOCK(lock2); - BOOST_CHECK(false); // REVERSE_LOCK(lock2) succeeded - } catch(...) { } + BOOST_CHECK_EXCEPTION(REVERSE_LOCK(lock2), std::logic_error, HasReason("lock2 was not most recent critical section locked")); BOOST_CHECK(lock2.owns_lock()); + + g_debug_lockorder_abort = prev; #endif // Make sure trying to reverse lock an unlocked lock fails |