HomePhabricator

Fix LockDirectory test failure when the Junit logger is enabled

Description

Fix LockDirectory test failure when the Junit logger is enabled

Summary: This is an alternative to D5232 (see discussion in the diff).

Test Plan:

ninja test_bitcoin
for i in {1..100}; do ./src/test/test_bitcoin -t util_tests --logger=JUNIT; done

valgrind \
  --suppressions=../contrib/valgrind.supp \
  --child-silent-after-fork=yes \
  ./src/test/test_bitcoin -t util_tests --logger=JUNIT

The result on my machine:

$ valgrind --suppressions=../contrib/valgrind.supp
--child-silent-after-fork=yes ./src/test/test_bitcoin -t util_tests
--logger=JUNIT
==12702== Memcheck, a memory error detector
==12702== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et
al.
==12702== Using Valgrind-3.14.0 and LibVEX; rerun with -h for copyright
info
==12702== Command: ./src/test/test_bitcoin -t util_tests --logger=JUNIT
==12702==

*** No errors detected
==12702==
==12702== HEAP SUMMARY:
==12702==     in use at exit: 128 bytes in 1 blocks
==12702==   total heap usage: 23,196 allocs, 23,195 frees, 103,669,419
bytes allocated
==12702==
==12702== LEAK SUMMARY:
==12702==    definitely lost: 0 bytes in 0 blocks
==12702==    indirectly lost: 0 bytes in 0 blocks
==12702==      possibly lost: 0 bytes in 0 blocks
==12702==    still reachable: 128 bytes in 1 blocks
==12702==         suppressed: 0 bytes in 0 blocks
==12702== Rerun with --leak-check=full to see details of leaked memory
==12702==
==12702== For counts of detected and suppressed errors, rerun with: -v
==12702== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)

Reviewers: #bitcoin_abc, markblundeberg

Reviewed By: #bitcoin_abc, markblundeberg

Differential Revision: https://reviews.bitcoinabc.org/D5254