NetBSD Problem Report #51887

From www@NetBSD.org  Sun Jan 15 20:43:51 2017
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(Client CN "mail.netbsd.org", Issuer "Postmaster NetBSD.org" (verified OK))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 8D6A47A26F
	for <gnats-bugs@gnats.NetBSD.org>; Sun, 15 Jan 2017 20:43:51 +0000 (UTC)
Message-Id: <20170115204350.A40717A2BD@mollari.NetBSD.org>
Date: Sun, 15 Jan 2017 20:43:50 +0000 (UTC)
From: yaneurabeya@gmail.com
Reply-To: yaneurabeya@gmail.com
To: gnats-bugs@NetBSD.org
Subject: [PATCH] tests/lib/libpthread/t_fpu: various fixes
X-Send-Pr-Version: www-1.0

>Number:         51887
>Category:       bin
>Synopsis:       [PATCH] tests/lib/libpthread/t_fpu: various fixes
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bin-bug-people
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Jan 15 20:45:00 +0000 2017
>Closed-Date:    Mon Jan 16 18:29:07 +0000 2017
>Last-Modified:  Mon Jan 16 18:29:07 +0000 2017
>Originator:     Ngie Cooper
>Release:        7.0.2
>Organization:
>Environment:
n/a
>Description:
- sched_yield returns 0 on success/-1 on failure -- use ATF_REQUIRE_MSG and test for the == 0 invariant instead of using PTHREAD_REQUIRE.
- Check the results of pthread_create with PTHREAD_REQUIRE.
>How-To-Repeat:

>Fix:

>Release-Note:

>Audit-Trail:
From: "Ngie Cooper (yaneurabeya)" <yaneurabeya@gmail.com>
To: gnats-bugs@NetBSD.org
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>.
   */

 +#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--

From: "Christos Zoulas" <christos@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/51887 CVS commit: src/tests/lib/libpthread
Date: Mon, 16 Jan 2017 11:27:44 -0500

 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.

State-Changed-From-To: open->closed
State-Changed-By: snj@NetBSD.org
State-Changed-When: Mon, 16 Jan 2017 18:29:07 +0000
State-Changed-Why:
christos committed it. thanks!


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2014 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.