Module Name: src
Committed By: christos
Date: Mon Jan 16 16:27:43 UTC 2017
Modified Files:
src/tests/lib/libpthread: t_fpu.c
Log Message:
PR/51887: Ngie Cooper: Include and error message fixes
To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/lib/libpthread/t_fpu.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/tests/lib/libpthread/t_fpu.c
diff -u src/tests/lib/libpthread/t_fpu.c:1.2 src/tests/lib/libpthread/t_fpu.c:1.3
--- src/tests/lib/libpthread/t_fpu.c:1.2 Sun Jan 27 09:47:37 2013
+++ src/tests/lib/libpthread/t_fpu.c Mon Jan 16 11:27:43 2017
@@ -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/
* <[email protected]>.
*/
+#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");