NetBSD/distrib
kamil 53e134ea9e Add new test t_timedmutex
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>.
2016-10-30 16:17:16 +00:00
..
acorn26
acorn32
alpha
amd64 Omit cgd based ramdisks and miniroot modules if MKCRYPTO=no 2016-06-30 12:56:27 +00:00
amiga Update loadbsd to 2.17, which can load ELF kernels. 2015-11-11 16:13:55 +00:00
arc
atari Kill expr, modernize 2016-09-18 18:24:00 +00:00
bebox
cats Increase size of cats installation memory disk by 100Ki. 2016-09-05 14:47:30 +00:00
cdrom dedup 2016-03-09 15:44:49 +00:00
cobalt bump size 2016-02-20 16:37:51 +00:00
common Add the ability to specify more sections to strip. 2016-09-20 20:55:54 +00:00
dreamcast put back dmesg 2016-10-04 14:00:27 +00:00
emips
evbarm When building earmv7 ramdisks, compile with -mthumb -mthumb-interwork 2016-07-07 06:28:20 +00:00
evbarm64/ramdisk
evbmips
evbppc Add sbin/sysctl 2016-07-07 06:28:57 +00:00
evbsh3
ews4800mips Strip more sections, and verbose printing. 2016-09-20 20:55:11 +00:00
hp300 Bump 2015-12-27 19:33:40 +00:00
hpcarm
hpcmips
hpcsh
hppa
i386 Omit cgd based ramdisks and miniroot modules if MKCRYPTO=no 2016-06-30 12:56:27 +00:00
ia64 PR port-ia64/51261 2016-08-05 16:18:19 +00:00
ibmnws
landisk
luna68k bump 2016-09-18 02:07:07 +00:00
mac68k
macppc
miniroot
mipsco Bump size. 2016-02-20 16:42:33 +00:00
mvme68k
mvmeppc
news68k
newsmips
notes Add myself 2016-10-01 12:32:35 +00:00
ofppc
playstation2
pmax
prep
riscv
rs6000
sandpoint
sets Add new test t_timedmutex 2016-10-30 16:17:16 +00:00
sgimips bump the image size. 2016-03-23 05:24:11 +00:00
shark
sparc Give Clang a bit more room in the miniroot. 2016-06-03 15:44:50 +00:00
sparc64 Obey MKKMOD=no. 2015-07-19 10:16:55 +00:00
sun2
sun3
syspkg
utils PR/50729: Izumi Tsutsui: Add "small" disklabel 2016-01-31 18:56:49 +00:00
vax
x68k bump 2016-09-18 01:57:24 +00:00
zaurus Adding -DNDEBUG saves about 5KB of text and disable asserts. 2015-07-21 01:53:44 +00:00
Makefile
Makefile.inc