SharedPtrRegistry_all.wait_lookup_or_create fails inconsistently
I noticed via the gitbuilders that this unit test is inconsistently failing. I can run it repeatedly on my dev box and get intermittent failures with the same binary. I assume there's a race in the test code of some kind rather than the SharedPtrRegistry actually being broken.
common: move SharedPtrRegistry test after t.join
The thread created to test SharedPtrRegistry race conditions updates a
value ( ptr ) that is tested by the main gtest thread but is not
protected by a lock. Instead of adding a lock, the main thread tests
the value after pthread_join() on the child thread.
Signed-off-by: Loic Dachary <email@example.com>
#1 Updated by Loic Dachary about 7 years ago
- Status changed from New to 12
while : ; do ./unittest_sharedptr_registry --gtest_filter=SharedPtrRegistry_all.wait_lookup_or_create || break ; done
Note: Google Test filter = SharedPtrRegistry_all.wait_lookup_or_create [==========] Running 1 test from 1 test case. [----------] Global test environment set-up. [----------] 1 test from SharedPtrRegistry_all [ RUN ] SharedPtrRegistry_all.wait_lookup_or_create test/common/test_sharedptr_registry.cc:140: Failure Value of: t.ptr Actual: false Expected: true [ FAILED ] SharedPtrRegistry_all.wait_lookup_or_create (1 ms) [----------] 1 test from SharedPtrRegistry_all (1 ms total) [----------] Global test environment tear-down [==========] 1 test from 1 test case ran. (1 ms total) [ PASSED ] 0 tests. [ FAILED ] 1 test, listed below: [ FAILED ] SharedPtrRegistry_all.wait_lookup_or_create 1 FAILED TEST