summaryrefslogtreecommitdiff
path: root/lib/libpthread/t_fpu.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libpthread/t_fpu.c')
-rw-r--r--lib/libpthread/t_fpu.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/lib/libpthread/t_fpu.c b/lib/libpthread/t_fpu.c
index 4047b1fa6195..dd47fb8067e7 100644
--- a/lib/libpthread/t_fpu.c
+++ b/lib/libpthread/t_fpu.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_fpu.c,v 1.2 2013/01/27 14:47:37 mbalmer Exp $ */
+/* $NetBSD: t_fpu.c,v 1.3 2017/01/16 16:27:43 christos Exp $ */
/*
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
#include <sys/cdefs.h>
__COPYRIGHT("@(#) Copyright (c) 2008\
The NetBSD Foundation, inc. All rights reserved.");
-__RCSID("$NetBSD: t_fpu.c,v 1.2 2013/01/27 14:47:37 mbalmer Exp $");
+__RCSID("$NetBSD: t_fpu.c,v 1.3 2017/01/16 16:27:43 christos Exp $");
/*
* This is adapted from part of csw/cstest of the MPD implementation by
@@ -49,10 +49,12 @@ __RCSID("$NetBSD: t_fpu.c,v 1.2 2013/01/27 14:47:37 mbalmer Exp $");
* <is@netbsd.org>.
*/
+#include <errno.h>
#include <math.h>
#include <pthread.h>
#include <sched.h>
#include <stdio.h>
+#include <string.h>
#include <stdlib.h>
#include <unistd.h>
@@ -77,14 +79,16 @@ stir(void *p)
for (;;) {
x = sin ((y = cos (x + y + .4)) - (z = cos (x + z + .6)));
- PTHREAD_REQUIRE(sched_yield());
+ ATF_REQUIRE_MSG(sched_yield() == 0,
+ "sched_yield failed: %s", strerror(errno));
}
}
static double
mul3(double x, double y, double z)
{
- PTHREAD_REQUIRE(sched_yield());
+ ATF_REQUIRE_MSG(sched_yield() == 0,
+ "sched_yield failed: %s", strerror(errno));
return x * y * z;
}
@@ -114,7 +118,7 @@ bar(void *p)
static void
recurse(void) {
pthread_t s2;
- pthread_create(&s2, 0, bar, 0);
+ PTHREAD_REQUIRE(pthread_create(&s2, 0, bar, 0));
sleep(20); /* XXX must be long enough for our slowest machine */
}
@@ -134,7 +138,7 @@ ATF_TC_BODY(fpu, tc)
PTHREAD_REQUIRE(pthread_mutex_init(&recursion_depth_lock, 0));
- pthread_create(&s5, 0, stir, stirseed);
+ PTHREAD_REQUIRE(pthread_create(&s5, 0, stir, stirseed));
recurse();
atf_tc_fail("exiting from main");