53e134ea9e
This test is a clone on t_mutex with additional two tests for timed-mutex specific block. All simple-mutex (not with the timed property according to the C11 wording) specific tests are covered by pthread_mutex_timedlock(3) with parameter ts_lengthy of sufficiently large tv_sec value (right now UINT16_MAX). If, a test will hang, it won't wait UINT16_MAX seconds, but will be terminated within the default timeout for ATF tests (right now 300 [sec] in my NetBSD/amd64 setup). This test was inspired by a classic selflock test failure of pthread_mutex_timedlock(3) of the following form: #include <assert.h> #include <errno.h> #include <pthread.h> #include <stdio.h> #include <time.h> int main(int argc, char **argv) { pthread_mutex_t mtx; struct timespec ts; ts.tv_sec = 0; ts.tv_nsec = 1000; printf("ts{.tv_sec = %d, .tv_nsec=%ld}\n", ts.tv_sec, ts.tv_nsec); fflush(stdout); printf("mtx_init\n"); assert(pthread_mutex_init(&mtx, NULL) == 0); printf("mtx_lock\n"); assert(pthread_mutex_lock(&mtx) == 0); printf("mtx_timedlock\n"); assert(pthread_mutex_timedlock(&mtx, &ts) == ETIMEDOUT); printf("mtx_unlock\n"); assert(pthread_mutex_unlock(&mtx) == 0); printf("mtx_destroy\n"); assert(pthread_mutex_destroy(&mtx) == 0); return 0; } Current NetBSD implementation wrongly hangs on this test. The issue was detected during development of the C11 portable threads. My local tests in chroot presents that the are further issues: t_timedmutex (21/25): 10 test cases mutex1: [0.001142s] Failed: /usr/src/tests/lib/libpthread/t_timedmutex.c:75: *param != 20 mutex2: [0.261499s] Passed. mutex3: [0.261496s] Passed. mutex4: [0.001204s] Failed: /usr/src/tests/lib/libpthread/t_timedmutex.c:265: pthread_mutex_timedlock(&mutex, &ts_lengthy): Connection timed out mutex5: [0.001235s] Failed: /usr/src/tests/lib/libpthread/t_timedmutex.c:337: pthread_mutex_timedlock(&mutex5, &ts_lengthy): Connection timed out mutex6: [21.218497s] Failed: /usr/src/tests/lib/libpthread/t_timedmutex.c:512: start != 1 mutexattr1: [0.001328s] Passed. mutexattr2: [0.001175s] Passed. timedmutex1: [301.119397s] Failed: Test case timed out after 300 seconds timedmutex2: [301.123081s] Failed: Test case timed out after 300 seconds [623.990659s] I'm also receiveing the same failure in the mutex6 test in t_mutex, so there might be a false positives due to local chroot(8) issues. Commit approved by <christos>. |
||
---|---|---|
.. | ||
acorn26 | ||
acorn32 | ||
alpha | ||
amd64 | ||
amiga | ||
arc | ||
atari | ||
bebox | ||
cats | ||
cdrom | ||
cobalt | ||
common | ||
dreamcast | ||
emips | ||
evbarm | ||
evbarm64/ramdisk | ||
evbmips | ||
evbppc | ||
evbsh3 | ||
ews4800mips | ||
hp300 | ||
hpcarm | ||
hpcmips | ||
hpcsh | ||
hppa | ||
i386 | ||
ia64 | ||
ibmnws | ||
landisk | ||
luna68k | ||
mac68k | ||
macppc | ||
miniroot | ||
mipsco | ||
mvme68k | ||
mvmeppc | ||
news68k | ||
newsmips | ||
notes | ||
ofppc | ||
playstation2 | ||
pmax | ||
prep | ||
riscv | ||
rs6000 | ||
sandpoint | ||
sets | ||
sgimips | ||
shark | ||
sparc | ||
sparc64 | ||
sun2 | ||
sun3 | ||
syspkg | ||
utils | ||
vax | ||
x68k | ||
zaurus | ||
Makefile | ||
Makefile.inc |