From ce5b73a7c3d8caefc72ac3b95490861e3ee13520 Mon Sep 17 00:00:00 2001 From: Mike Crowe Date: Wed, 19 Jun 2019 18:07:58 -0300 Subject: 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. --- nptl/tst-eintr5.c | 40 ++++++++++++---------------------------- 1 file changed, 12 insertions(+), 28 deletions(-) (limited to 'nptl/tst-eintr5.c') diff --git a/nptl/tst-eintr5.c b/nptl/tst-eintr5.c index 6eee2a166f..da049c4eae 100644 --- a/nptl/tst-eintr5.c +++ b/nptl/tst-eintr5.c @@ -23,11 +23,10 @@ #include #include #include - -static int do_test (void); - -#define TEST_FUNCTION do_test () -#include "../test-skeleton.c" +#include +#include +#include +#include #include "eintr.c" @@ -39,20 +38,12 @@ static pthread_cond_t c = PTHREAD_COND_INITIALIZER; static void * tf (void *arg) { - struct timespec ts; - struct timeval tv; - - gettimeofday (&tv, NULL); - TIMEVAL_TO_TIMESPEC (&tv, &ts); - ts.tv_sec += 10000; + struct timespec ts = timespec_add (xclock_now (CLOCK_REALTIME), + make_timespec (10000, 0)); /* This call must never return. */ - int e = pthread_cond_timedwait (&c, &m, &ts); - char buf[100]; - printf ("tf: cond_timedwait returned: %s\n", - strerror_r (e, buf, sizeof (buf))); - - exit (1); + TEST_COMPARE (pthread_cond_timedwait (&c, &m, &ts), 0); + FAIL_EXIT1 ("pthread_cond_timedwait returned unexpectedly\n"); } @@ -61,19 +52,12 @@ do_test (void) { setup_eintr (SIGUSR1, NULL); - pthread_t th; - char buf[100]; - int e = pthread_create (&th, NULL, tf, NULL); - if (e != 0) - { - printf ("main: pthread_create failed: %s\n", - strerror_r (e, buf, sizeof (buf))); - exit (1); - } + xpthread_create (NULL, tf, NULL); delayed_exit (3); /* This call must never return. */ xpthread_cond_wait (&c, &m); - puts ("error: pthread_cond_wait returned"); - return 1; + FAIL_RET ("error: pthread_cond_wait returned"); } + +#include -- cgit 1.4.1