summaryrefslogtreecommitdiff
path: root/nptl/tst-mutex-errorcheck.c
diff options
context:
space:
mode:
authorMike Crowe <mac@mcrowe.com>2019-06-19 18:07:58 -0300
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>2019-06-21 09:59:50 -0300
commitce5b73a7c3d8caefc72ac3b95490861e3ee13520 (patch)
treee6b816726b34c77c1b9569cacbb824dc4c960f94 /nptl/tst-mutex-errorcheck.c
parent8bf225d5832eda8fefce9361c53cb68a55150b96 (diff)
downloadglibc-ce5b73a7c3d8caefc72ac3b95490861e3ee13520.tar.gz
nptl: Convert various tests to use libsupport
* nptl/eintr.c: Use libsupport. * nptl/tst-eintr1.c: Likewise. * nptl/tst-eintr2.c: Likewise. * nptl/tst-eintr3.c: Likewise. * nptl/tst-eintr4.c: Likewise. * nptl/tst-eintr5.c: Likewise. * nptl/tst-mutex-errorcheck.c: Likewise. * nptl/tst-mutex5.c: Likewise.
Diffstat (limited to 'nptl/tst-mutex-errorcheck.c')
-rw-r--r--nptl/tst-mutex-errorcheck.c29
1 files changed, 10 insertions, 19 deletions
diff --git a/nptl/tst-mutex-errorcheck.c b/nptl/tst-mutex-errorcheck.c
index 30ff7ea64a..afc27e7472 100644
--- a/nptl/tst-mutex-errorcheck.c
+++ b/nptl/tst-mutex-errorcheck.c
@@ -20,6 +20,7 @@
#include <errno.h>
#include <time.h>
#include <pthread.h>
+#include <support/check.h>
static int
do_test (void)
@@ -29,33 +30,23 @@ do_test (void)
pthread_mutexattr_t mutexattr;
int ret = 0;
- if (pthread_mutexattr_init (&mutexattr) != 0)
- return 1;
- if (pthread_mutexattr_settype (&mutexattr, PTHREAD_MUTEX_ERRORCHECK) != 0)
- return 1;
+ TEST_COMPARE (pthread_mutexattr_init (&mutexattr), 0);
+ TEST_COMPARE (pthread_mutexattr_settype (&mutexattr,
+ PTHREAD_MUTEX_ERRORCHECK), 0);
- if (pthread_mutex_init (&mutex, &mutexattr) != 0)
- return 1;
- if (pthread_mutexattr_destroy (&mutexattr) != 0)
- return 1;
+ TEST_COMPARE (pthread_mutex_init (&mutex, &mutexattr), 0);
+ TEST_COMPARE (pthread_mutexattr_destroy (&mutexattr), 0);
/* The call to pthread_mutex_timedlock erroneously enabled lock elision
on the mutex, which then triggered an assertion failure in
pthread_mutex_unlock. It would also defeat the error checking nature
of the mutex. */
- if (pthread_mutex_timedlock (&mutex, &tms) != 0)
- return 1;
- if (pthread_mutex_timedlock (&mutex, &tms) != EDEADLK)
- {
- printf ("Failed error checking on locked mutex\n");
- ret = 1;
- }
+ TEST_COMPARE (pthread_mutex_timedlock (&mutex, &tms), 0);
+ TEST_COMPARE (pthread_mutex_timedlock (&mutex, &tms), EDEADLK);
- if (pthread_mutex_unlock (&mutex) != 0)
- ret = 1;
+ TEST_COMPARE (pthread_mutex_unlock (&mutex), 0);
return ret;
}
-#define TEST_FUNCTION do_test ()
-#include "../test-skeleton.c"
+#include <support/test-driver.c>