diff options
author | Florian Weimer <fweimer@redhat.com> | 2016-08-26 19:27:16 +0200 |
---|---|---|
committer | Florian Weimer <fweimer@redhat.com> | 2016-08-26 19:40:17 +0200 |
commit | 7e625f7e85b4e88f10dbde35a0641742af581806 (patch) | |
tree | 9548c7d75393d1b9cd033ea0c875936bee6f9a52 /nptl/tst-mutex6.c | |
parent | 0ac8ee53e8efbfd6e1c37094b4653f5c2dad65b5 (diff) | |
download | glibc-7e625f7e85b4e88f10dbde35a0641742af581806.zip glibc-7e625f7e85b4e88f10dbde35a0641742af581806.tar.gz glibc-7e625f7e85b4e88f10dbde35a0641742af581806.tar.bz2 |
nptl: Avoid expected SIGALRM in most tests [BZ #20432]
Before this change, several tests did not detect early deadlocks
because they used SIGALRM as the expected signal, and they ran
for the full default TIMEOUT seconds.
This commit adds a new delayed_exit function to the test skeleton,
along with several error-checking wrappers to pthread functions.
Additional error checking is introduced into several tests.
Diffstat (limited to 'nptl/tst-mutex6.c')
-rw-r--r-- | nptl/tst-mutex6.c | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/nptl/tst-mutex6.c b/nptl/tst-mutex6.c index 1940687..3e989d8 100644 --- a/nptl/tst-mutex6.c +++ b/nptl/tst-mutex6.c @@ -23,6 +23,11 @@ #include <errno.h> #include <stdbool.h> +#ifndef TEST_FUNCTION +static int do_test (void); +# define TEST_FUNCTION do_test () +#endif +#include "../test-skeleton.c" #ifndef ATTR pthread_mutexattr_t *attr; @@ -62,18 +67,10 @@ do_test (void) return 1; } - /* Set an alarm for 1 second. The wrapper will expect this. */ - alarm (1); - + delayed_exit (1); /* This call should never return. */ - pthread_mutex_lock (&m); + xpthread_mutex_lock (&m); puts ("2nd mutex_lock returned"); return 1; } - -#define EXPECTED_SIGNAL SIGALRM -#ifndef TEST_FUNCTION -# define TEST_FUNCTION do_test () -#endif -#include "../test-skeleton.c" |