freebsd-dev/contrib/netbsd-tests/lib/libpthread
Alex Richardson 371f152c7f Significantly speed up libthr/mutex_test and make more reliable
Instead of using a simple global++ as the data race, with this change we
perform the increment by loading the global, delaying for a bit and then
storing back the incremented value. If I move the increment outside of the
mutex protected range, I can now see the data race with only 100 iterations
on amd64 in almost all cases. Before this change such a racy test almost
always passed with < 100,000 iterations and only reliably failed with the
current limit of 10 million.

I noticed this poorly written test because the mutex:mutex{2,3} and
timedmutex:mutex{2,3} tests were always timing out on our CheriBSD Jenkins.
Writing good concurrency tests is hard so I won't attempt to do so, but this
change should make the test more likely to fail if pthread_mutex_lock is not
implemented correctly while also significantly reducing the time it takes to
run these four tests. It will also reduce the time it takes for QEMU RISC-V
testsuite runs by almost 40 minutes (out of currently 7 hours).

Reviewed By:	brooks, ngie
Differential Revision: https://reviews.freebsd.org/D26473
2020-11-26 13:31:57 +00:00
..
dlopen
d_mach
h_atexit.c Mechanically replace #if defined(__FreeBSD__) and #if defined(__NetBSD__) with 2014-11-17 13:39:00 +00:00
h_cancel.c #ifdef out a printf on !NetBSD that causes the testcase to fail when comparing 2014-11-16 05:11:07 +00:00
h_common.h Merge ^/vendor/NetBSD/tests/dist@r312370 2017-01-18 05:36:09 +00:00
h_exit.c
h_resolv.c
t_atexit.sh
t_barrier.c
t_cancel.sh
t_cond.c Have pthread_cond_destroy() return EBUSY if the condvar has waiters. 2019-03-08 21:07:08 +00:00
t_condwait.c Update pthread_cond_timedwait() test to current NetBSD 2019-08-16 13:10:08 +00:00
t_detach.c Diff reduce with upstream and prep for next set of content pushes 2017-01-16 18:44:40 +00:00
t_equal.c
t_exit.sh
t_fork.c Merge ^/vendor/NetBSD/tests/dist@r312294 2017-01-16 17:43:43 +00:00
t_fpu.c Diff reduce with upstream and prep for next set of content pushes 2017-01-16 18:44:40 +00:00
t_join.c Remove explicit pthread_np.h #include, per change in libnetbsd@r312303 2017-01-16 18:52:05 +00:00
t_kill.c
t_mutex.c Significantly speed up libthr/mutex_test and make more reliable 2020-11-26 13:31:57 +00:00
t_name.c
t_once.c Diff reduce with upstream and prep for next set of content pushes 2017-01-16 18:44:40 +00:00
t_preempt.c
t_resolv.sh
t_rwlock.c Checkpoint initial integration work 2016-08-12 08:50:05 +00:00
t_sem.c Diff reduce with upstream and prep for next set of content pushes 2017-01-16 18:44:40 +00:00
t_sigalarm.c
t_siglongjmp.c
t_sigmask.c
t_sigsuspend.c
t_sleep.c
t_swapcontext.c Merge ^/vendor/NetBSD/tests/dist@r312294 2017-01-16 17:43:43 +00:00
t_timedmutex.c Upgrade NetBSD tests to 01.11.2017_23.20 snapshot 2017-01-13 03:33:57 +00:00