[2/4] Mutex: add unit tests for new type
Commit Message
Signed-off-by: Kemi Wang <kemi.wang@intel.com>
---
nptl/Makefile | 6 +++---
nptl/tst-initializers1.c | 11 +++++++----
nptl/tst-mutex5b.c | 2 ++
nptl/tst-mutex7b.c | 2 ++
4 files changed, 14 insertions(+), 7 deletions(-)
create mode 100644 nptl/tst-mutex5b.c
create mode 100644 nptl/tst-mutex7b.c
@@ -235,9 +235,9 @@ LDLIBS-tst-minstack-throw = -lstdc++
tests = tst-attr1 tst-attr2 tst-attr3 tst-default-attr \
tst-mutex1 tst-mutex2 tst-mutex3 tst-mutex4 tst-mutex5 tst-mutex6 \
- tst-mutex7 tst-mutex9 tst-mutex5a tst-mutex7a tst-mutex7robust \
- tst-mutexpi1 tst-mutexpi2 tst-mutexpi3 tst-mutexpi4 tst-mutexpi5 \
- tst-mutexpi5a tst-mutexpi6 tst-mutexpi7 tst-mutexpi7a \
+ tst-mutex7 tst-mutex9 tst-mutex5a tst-mutex5b tst-mutex7a tst-mutex7b \
+ tst-mutex7robust tst-mutexpi1 tst-mutexpi2 tst-mutexpi3 tst-mutexpi4 \
+ tst-mutexpi5 tst-mutexpi5a tst-mutexpi6 tst-mutexpi7 tst-mutexpi7a \
tst-mutexpi9 \
tst-spin1 tst-spin2 tst-spin3 tst-spin4 \
tst-cond1 tst-cond2 tst-cond3 tst-cond4 tst-cond5 tst-cond6 tst-cond7 \
@@ -24,6 +24,7 @@
pthread_mutex_t mtx_normal = PTHREAD_MUTEX_INITIALIZER;
pthread_mutex_t mtx_recursive = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
pthread_mutex_t mtx_errorchk = PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP;
+pthread_mutex_t mtx_queuespinner = PTHREAD_QUEUESPINNER_MUTEX_INITIALIZER_NP;
pthread_mutex_t mtx_adaptive = PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP;
pthread_rwlock_t rwl_normal = PTHREAD_RWLOCK_INITIALIZER;
pthread_rwlock_t rwl_writer
@@ -39,20 +40,22 @@ do_test (void)
return 2;
if (mtx_errorchk.__data.__kind != PTHREAD_MUTEX_ERRORCHECK_NP)
return 3;
- if (mtx_adaptive.__data.__kind != PTHREAD_MUTEX_ADAPTIVE_NP)
+ if (mtx_queuespinner.__data.__kind != PTHREAD_MUTEX_QUEUESPINNER_NP)
return 4;
- if (rwl_normal.__data.__flags != PTHREAD_RWLOCK_PREFER_READER_NP)
+ if (mtx_adaptive.__data.__kind != PTHREAD_MUTEX_ADAPTIVE_NP)
return 5;
+ if (rwl_normal.__data.__flags != PTHREAD_RWLOCK_PREFER_READER_NP)
+ return 6;
if (rwl_writer.__data.__flags
!= PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP)
- return 6;
+ return 7;
/* <libc-lock.h> __libc_rwlock_init definition for libc.so
relies on PTHREAD_RWLOCK_INITIALIZER being all zeros. If
that ever changes, <libc-lock.h> needs updating. */
size_t i;
for (i = 0; i < sizeof (rwl_normal); i++)
if (((char *) &rwl_normal)[i] != '\0')
- return 7;
+ return 8;
return 0;
}
new file mode 100644
@@ -0,0 +1,2 @@
+#define TYPE PTHREAD_MUTEX_QUEUESPINNER_NP
+#include "tst-mutex5.c"
new file mode 100644
@@ -0,0 +1,2 @@
+#define TYPE PTHREAD_MUTEX_QUEUESPINNER_NP
+#include "tst-mutex7.c"