Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/tests/lib/libpthread PR/51887: Ngie Cooper: Include and erro...



details:   https://anonhg.NetBSD.org/src/rev/d0afd55790ae
branches:  trunk
changeset: 820945:d0afd55790ae
user:      christos <christos%NetBSD.org@localhost>
date:      Mon Jan 16 16:27:43 2017 +0000

description:
PR/51887: Ngie Cooper: Include and error message fixes

diffstat:

 tests/lib/libpthread/t_fpu.c |  16 ++++++++++------
 1 files changed, 10 insertions(+), 6 deletions(-)

diffs (68 lines):

diff -r 784243d1e338 -r d0afd55790ae tests/lib/libpthread/t_fpu.c
--- a/tests/lib/libpthread/t_fpu.c      Mon Jan 16 16:27:06 2017 +0000
+++ b/tests/lib/libpthread/t_fpu.c      Mon Jan 16 16:27:43 2017 +0000
@@ -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 @@
  * <is%netbsd.org@localhost>.
  */
 
+#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 @@
 
        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 @@
 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 @@
 
        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");



Home | Main Index | Thread Index | Old Index