Test Details Overview

Fix teardown races in the vote solicitor and stale election tests (#5291)

* Move the shared test helpers into their own header

shared_flag, shared_counter and shared_result were buried among the
assert macros and helper functions of testutil.hpp, where they were
hard to find. They move unchanged to shared_values.hpp, which
testutil.hpp includes, so existing call sites keep working.

* Shorten `shared_counter::increment` to `inc` and add `sub`

The short forms match `stats.inc` and keep counting callbacks on one
line. `sub` takes one back off, for a test that counts something that
also goes away.

* Move `nano::shared_locked` into the shared test helpers

Only tests use it, yet it sat in nano/lib/locks.hpp, away from the
other helpers for state a callback shares with the test body. It moves
unchanged to shared_values.hpp as `nano::test::shared_locked`, and the
vote generator tests use the new name.

* Match `shared_locked` to the other shared test helpers

Like shared_flag, shared_counter and shared_result, it is final, a
copy also serves moves and assignment is deleted, its operations are
const so a by-value capture can use them, and its members are declared
with comments and defined below the class. A moved-from copy no longer
loses the value, and the unused forwarding constructor, assignment
from T and conversion to T are gone.

* Fix teardown race in the vote solicitor election round tests

The election loop keeps sending to the test channel until `system`
stops the node, which happens after the test's locals are destroyed.
An observer counting into a local captured by reference could then
write to a dead stack slot, which ASan reported for
`vote_solicitor.election_round`. The four tests whose observers the
loop can still fire count with `nano::test::shared_counter`, captured
by value.

* Fix teardown race in the stale election tests

The active elections checkup reports stale elections again every half
stale threshold until `system` stops the node, after the test's locals
are destroyed. The observers captured their locals by reference and
now hold a `nano::test::shared_flag`, a `nano::test::shared_locked`
and the block by value.

__________

Type: commit

Hash: b083a3f9666e9faf225fd8b296e4aefce62e1b6a

Created: yesterday

__________

gr0v1ty/nano-node:b083a3f9666e9faf225fd8b296e4aefce62e1b6a

Test Results

Test Case Status Duration Median Deviation Log Graph
5n4pr_conf_10k_bintree PASS 99 s -10.0 s GitHub job logs Show
5n4pr_conf_10k_change PASS 110 s -18.0 s GitHub job logs Show
5n4pr_conf_change_dependant PASS 111 s -3.0 s GitHub job logs -
5n4pr_conf_change_independant PASS 103 s -6.0 s GitHub job logs -
5n4pr_conf_send_dependant PASS 100 s -12.0 s GitHub job logs -
5n4pr_conf_send_independant PASS 96 s -18.0 s GitHub job logs -
5n4pr_rocks_10k_bintree PASS 105 s -6.0 s GitHub job logs -
5n4pr_rocks_10k_change PASS 139 s -17.0 s GitHub job logs -