Make test reports deterministic in the face of nondeterminism #715
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The concurrency tests for multi-threaded collections run for a nondeterministic number of iterations, and the branches taken within the test are nondeterministic, causing the REQUIRE macro to be called a nondeterministic number of times during the run of the test. This means that each time you run the tests, the numbers in the message
are different. This does not contribute to confidence that the tests are working.
There is also a problem with the REQUIRE macro: It does not support concurrent usage from multiple threads. If two threads perform a REQUIRE at the same time, the assertion count is unreliable.
Fix both problems by not using REQUIRE (1) in nondeterministic ways or (2) from multiple threads simultaneously. Instead, we use
check_bool, which will still throw an exception and fail the test, but does not run afoul of REQUIRE's limitations.