NetBSD-Bugs archive

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

Re: bin/51887: [PATCH] tests/lib/libpthread/t_fpu: various fixes



The following reply was made to PR bin/51887; it has been noted by GNATS.

From: "Ngie Cooper (yaneurabeya)" <yaneurabeya%gmail.com@localhost>
To: gnats-bugs%NetBSD.org@localhost
Cc: 
Subject: Re: bin/51887: [PATCH] tests/lib/libpthread/t_fpu: various fixes
Date: Sun, 15 Jan 2017 12:59:39 -0800

 --Apple-Mail=_19DE68E3-788E-4A91-A9C8-773575784121
 Content-Transfer-Encoding: 7bit
 Content-Type: text/plain;
 	charset=us-ascii
 
 Patch attached.
 -Ngie
 
 --Apple-Mail=_19DE68E3-788E-4A91-A9C8-773575784121
 Content-Disposition: attachment;
 	filename=t_fpu-various-fixes.patch
 Content-Type: application/octet-stream;
 	x-unix-mode=0644;
 	name="t_fpu-various-fixes.patch"
 Content-Transfer-Encoding: 7bit
 
 Index: lib/libpthread/t_fpu.c
 ===================================================================
 RCS file: /cvsroot/src/tests/lib/libpthread/t_fpu.c,v
 retrieving revision 1.2
 diff -u -r1.2 t_fpu.c
 --- lib/libpthread/t_fpu.c	27 Jan 2013 14:47:37 -0000	1.2
 +++ lib/libpthread/t_fpu.c	15 Jan 2017 20:55:05 -0000
 @@ -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");
 
 --Apple-Mail=_19DE68E3-788E-4A91-A9C8-773575784121--
 


Home | Main Index | Thread Index | Old Index