diff options
author | Andi Kleen <ak@linux.intel.com> | 2013-06-28 05:19:37 -0700 |
---|---|---|
committer | Andi Kleen <ak@linux.intel.com> | 2013-07-02 08:46:54 -0700 |
commit | 68cc29355f3334c7ad18f648ff9a6383a0916d23 (patch) | |
tree | 357381e30be0b3dedfafe7a220714e20aad6ad73 /nptl | |
parent | b023e4ca99f5e81f90d87d23cd267ef2abd2388c (diff) | |
download | glibc-68cc29355f3334c7ad18f648ff9a6383a0916d23.zip glibc-68cc29355f3334c7ad18f648ff9a6383a0916d23.tar.gz glibc-68cc29355f3334c7ad18f648ff9a6383a0916d23.tar.bz2 |
Add minimal test suite changes for elision enabled kernels
tst-mutex5 and 8 test some behaviour not required by POSIX,
that elision changes. This changes these tests to not check
this when elision is enabled at configure time.
Diffstat (limited to 'nptl')
-rw-r--r-- | nptl/ChangeLog | 8 | ||||
-rw-r--r-- | nptl/tst-mutex5.c | 4 | ||||
-rw-r--r-- | nptl/tst-mutex8.c | 17 |
3 files changed, 28 insertions, 1 deletions
diff --git a/nptl/ChangeLog b/nptl/ChangeLog index 97ff785..e7495b9 100644 --- a/nptl/ChangeLog +++ b/nptl/ChangeLog @@ -1,5 +1,13 @@ 2013-07-02 Andi Kleen <ak@linux.intel.com> + * tst-mutex5.c: Include config.h. + (do_test): Add checks for ENABLE_LOCK_ELISION. + * tst-mutex8.c: Include config.h + (tf): Add checks for ENABLE_LOCK_ELISION. + (check_type): Likewise. + +2013-07-02 Andi Kleen <ak@linux.intel.com> + * pthreadP.h: Add elision types. (PTHREAD_MUTEX_TYPE_ELISION): Add. * sysdeps/pthread/pthread.h: Add elision initializers. diff --git a/nptl/tst-mutex5.c b/nptl/tst-mutex5.c index f19cd8c..c223f67 100644 --- a/nptl/tst-mutex5.c +++ b/nptl/tst-mutex5.c @@ -22,6 +22,7 @@ #include <time.h> #include <unistd.h> #include <sys/time.h> +#include <config.h> #ifndef TYPE @@ -85,6 +86,8 @@ do_test (void) return 1; } + /* Elided locks do not time out. */ +#ifdef ENABLE_LOCK_ELISION if (pthread_mutex_trylock (&m) == 0) { puts ("mutex_trylock succeeded"); @@ -180,6 +183,7 @@ do_test (void) puts ("3rd timedlock didn't return right away"); return 1; } +#endif if (pthread_mutex_unlock (&m) != 0) { diff --git a/nptl/tst-mutex8.c b/nptl/tst-mutex8.c index 2089c50..d2307e4 100644 --- a/nptl/tst-mutex8.c +++ b/nptl/tst-mutex8.c @@ -93,6 +93,8 @@ tf (void *arg) static int check_type (const char *mas, pthread_mutexattr_t *ma) { + int e __attribute__((unused)); + if (pthread_mutex_init (m, ma) != 0) { printf ("1st mutex_init failed for %s\n", mas); @@ -117,7 +119,10 @@ check_type (const char *mas, pthread_mutexattr_t *ma) return 1; } - int e = pthread_mutex_destroy (m); + /* Elided mutexes don't fail destroy. If elision is not explicitly disabled + we don't know, so can also not check this. */ +#ifndef ENABLE_LOCK_ELISION + e = pthread_mutex_destroy (m); if (e == 0) { printf ("mutex_destroy of self-locked mutex succeeded for %s\n", mas); @@ -129,6 +134,7 @@ check_type (const char *mas, pthread_mutexattr_t *ma) mas); return 1; } +#endif if (pthread_mutex_unlock (m) != 0) { @@ -142,6 +148,8 @@ check_type (const char *mas, pthread_mutexattr_t *ma) return 1; } + /* Elided mutexes don't fail destroy. */ +#ifndef ENABLE_LOCK_ELISION e = pthread_mutex_destroy (m); if (e == 0) { @@ -155,6 +163,7 @@ mutex_destroy of self-trylocked mutex did not return EBUSY %s\n", mas); return 1; } +#endif if (pthread_mutex_unlock (m) != 0) { @@ -189,6 +198,8 @@ mutex_destroy of self-trylocked mutex did not return EBUSY %s\n", return 1; } + /* Elided mutexes don't fail destroy. */ +#ifndef ENABLE_LOCK_ELISION e = pthread_mutex_destroy (m); if (e == 0) { @@ -201,6 +212,7 @@ mutex_destroy of self-trylocked mutex did not return EBUSY %s\n", mutex_destroy of condvar-used mutex did not return EBUSY for %s\n", mas); return 1; } +#endif done = true; if (pthread_cond_signal (&c) != 0) @@ -259,6 +271,8 @@ mutex_destroy of condvar-used mutex did not return EBUSY for %s\n", mas); return 1; } + /* Elided mutexes don't fail destroy. */ +#ifndef ENABLE_LOCK_ELISION e = pthread_mutex_destroy (m); if (e == 0) { @@ -273,6 +287,7 @@ mutex_destroy of condvar-used mutex did not return EBUSY for %s\n", mas); mas); return 1; } +#endif if (pthread_cancel (th) != 0) { |