diff options
Diffstat (limited to 'regress')
-rw-r--r-- | regress/lib/libc_r/pthread_mutex/pthread_mutex.c | 10 | ||||
-rw-r--r-- | regress/lib/libc_r/signal/signal.c | 17 | ||||
-rw-r--r-- | regress/lib/libpthread/pthread_mutex/pthread_mutex.c | 10 | ||||
-rw-r--r-- | regress/lib/libpthread/signal/signal.c | 17 |
4 files changed, 34 insertions, 20 deletions
diff --git a/regress/lib/libc_r/pthread_mutex/pthread_mutex.c b/regress/lib/libc_r/pthread_mutex/pthread_mutex.c index 3dd62129035..311688d0259 100644 --- a/regress/lib/libc_r/pthread_mutex/pthread_mutex.c +++ b/regress/lib/libc_r/pthread_mutex/pthread_mutex.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pthread_mutex.c,v 1.2 2001/09/20 16:43:15 todd Exp $ */ +/* $OpenBSD: pthread_mutex.c,v 1.3 2001/11/03 04:33:48 marc Exp $ */ /* * Copyright (c) 1993, 1994, 1995, 1996 by Chris Provenzano and contributors, * proven@mit.edu All rights reserved. @@ -109,7 +109,7 @@ test_debug_double_unlock(mutex) CHECKr(pthread_mutex_lock(mutex)); CHECKr(pthread_mutex_unlock(mutex)); /* Posix D10 says undefined behaviour? */ - ASSERTe(pthread_mutex_unlock(mutex), != EPERM); + ASSERTe(pthread_mutex_unlock(mutex), != 0); } void @@ -167,6 +167,7 @@ test_mutex_recursive() pthread_mutexattr_t mutex_recursive_attr; pthread_mutex_t mutex_recursive; int i; + int j = 9; printf("test_mutex_recursive()\n"); CHECKr(pthread_mutexattr_init(&mutex_recursive_attr)); @@ -175,13 +176,14 @@ test_mutex_recursive() CHECKr(pthread_mutex_init(&mutex_recursive, &mutex_recursive_attr)); CHECKr(pthread_mutex_lock(&mutex_recursive)); - for (i = 0; i < 9; i++) + for (i = 0; i < j; i++) CHECKr(pthread_mutex_lock(&mutex_recursive)); - for (i = 0; i < 9; i++) + for (i = 0; i < j; i++) CHECKr(pthread_mutex_unlock(&mutex_recursive)); CHECKr(pthread_mutex_unlock(&mutex_recursive)); /* Posix D10 says undefined behaviour? */ ASSERTe(pthread_mutex_unlock(&mutex_recursive), != 0); + CHECKr(pthread_mutex_destroy(&mutex_recursive)); } int diff --git a/regress/lib/libc_r/signal/signal.c b/regress/lib/libc_r/signal/signal.c index effc36b7087..4955dd86f83 100644 --- a/regress/lib/libc_r/signal/signal.c +++ b/regress/lib/libc_r/signal/signal.c @@ -1,4 +1,4 @@ -/* $OpenBSD: signal.c,v 1.1 2001/08/15 14:37:13 fgsch Exp $ */ +/* $OpenBSD: signal.c,v 1.2 2001/11/03 04:33:48 marc Exp $ */ /* David Leonard <d@openbsd.org>, 2001. Public Domain. */ /* @@ -12,6 +12,8 @@ #include <signal.h> #include "test.h" +volatile int alarmed; + void * sleeper(arg) void *arg; @@ -21,8 +23,7 @@ sleeper(arg) /* Ignore all signals in this thread */ sigfillset(&mask); CHECKe(sigprocmask(SIG_SETMASK, &mask, NULL)); - - ASSERT(sleep(2) == 0); + ASSERT(sleep(3) == 0); SUCCEED; } @@ -30,7 +31,7 @@ void handler(sig) int sig; { - printf("signal handler %d\n", sig); + alarmed = 1; alarm(1); signal(SIGALRM, handler); } @@ -44,6 +45,10 @@ main() CHECKe(alarm(1)); CHECKr(pthread_create(&slpr, NULL, sleeper, NULL)); /* ASSERT(sleep(1) == 0); */ - for (;;) - CHECKe(write(STDOUT_FILENO, ".", 1)); + for (;;) { + if (alarmed) { + alarmed = 0; + CHECKe(write(STDOUT_FILENO, "!", 1)); + } + } } diff --git a/regress/lib/libpthread/pthread_mutex/pthread_mutex.c b/regress/lib/libpthread/pthread_mutex/pthread_mutex.c index 3dd62129035..311688d0259 100644 --- a/regress/lib/libpthread/pthread_mutex/pthread_mutex.c +++ b/regress/lib/libpthread/pthread_mutex/pthread_mutex.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pthread_mutex.c,v 1.2 2001/09/20 16:43:15 todd Exp $ */ +/* $OpenBSD: pthread_mutex.c,v 1.3 2001/11/03 04:33:48 marc Exp $ */ /* * Copyright (c) 1993, 1994, 1995, 1996 by Chris Provenzano and contributors, * proven@mit.edu All rights reserved. @@ -109,7 +109,7 @@ test_debug_double_unlock(mutex) CHECKr(pthread_mutex_lock(mutex)); CHECKr(pthread_mutex_unlock(mutex)); /* Posix D10 says undefined behaviour? */ - ASSERTe(pthread_mutex_unlock(mutex), != EPERM); + ASSERTe(pthread_mutex_unlock(mutex), != 0); } void @@ -167,6 +167,7 @@ test_mutex_recursive() pthread_mutexattr_t mutex_recursive_attr; pthread_mutex_t mutex_recursive; int i; + int j = 9; printf("test_mutex_recursive()\n"); CHECKr(pthread_mutexattr_init(&mutex_recursive_attr)); @@ -175,13 +176,14 @@ test_mutex_recursive() CHECKr(pthread_mutex_init(&mutex_recursive, &mutex_recursive_attr)); CHECKr(pthread_mutex_lock(&mutex_recursive)); - for (i = 0; i < 9; i++) + for (i = 0; i < j; i++) CHECKr(pthread_mutex_lock(&mutex_recursive)); - for (i = 0; i < 9; i++) + for (i = 0; i < j; i++) CHECKr(pthread_mutex_unlock(&mutex_recursive)); CHECKr(pthread_mutex_unlock(&mutex_recursive)); /* Posix D10 says undefined behaviour? */ ASSERTe(pthread_mutex_unlock(&mutex_recursive), != 0); + CHECKr(pthread_mutex_destroy(&mutex_recursive)); } int diff --git a/regress/lib/libpthread/signal/signal.c b/regress/lib/libpthread/signal/signal.c index effc36b7087..4955dd86f83 100644 --- a/regress/lib/libpthread/signal/signal.c +++ b/regress/lib/libpthread/signal/signal.c @@ -1,4 +1,4 @@ -/* $OpenBSD: signal.c,v 1.1 2001/08/15 14:37:13 fgsch Exp $ */ +/* $OpenBSD: signal.c,v 1.2 2001/11/03 04:33:48 marc Exp $ */ /* David Leonard <d@openbsd.org>, 2001. Public Domain. */ /* @@ -12,6 +12,8 @@ #include <signal.h> #include "test.h" +volatile int alarmed; + void * sleeper(arg) void *arg; @@ -21,8 +23,7 @@ sleeper(arg) /* Ignore all signals in this thread */ sigfillset(&mask); CHECKe(sigprocmask(SIG_SETMASK, &mask, NULL)); - - ASSERT(sleep(2) == 0); + ASSERT(sleep(3) == 0); SUCCEED; } @@ -30,7 +31,7 @@ void handler(sig) int sig; { - printf("signal handler %d\n", sig); + alarmed = 1; alarm(1); signal(SIGALRM, handler); } @@ -44,6 +45,10 @@ main() CHECKe(alarm(1)); CHECKr(pthread_create(&slpr, NULL, sleeper, NULL)); /* ASSERT(sleep(1) == 0); */ - for (;;) - CHECKe(write(STDOUT_FILENO, ".", 1)); + for (;;) { + if (alarmed) { + alarmed = 0; + CHECKe(write(STDOUT_FILENO, "!", 1)); + } + } } |