NetBSD Problem Report #51890
From www@NetBSD.org Sun Jan 15 20:52:32 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 6F7967A2BD
for <gnats-bugs@gnats.NetBSD.org>; Sun, 15 Jan 2017 20:52:32 +0000 (UTC)
Message-Id: <20170115205231.889107A2BF@mollari.NetBSD.org>
Date: Sun, 15 Jan 2017 20:52:31 +0000 (UTC)
From: yaneurabeya@gmail.com
Reply-To: yaneurabeya@gmail.com
To: gnats-bugs@NetBSD.org
Subject: [PATCH] tests/lib/libpthread/t_swapcontext: getcontext/swapcontext fixes
X-Send-Pr-Version: www-1.0
>Number: 51890
>Category: bin
>Synopsis: [PATCH] tests/lib/libpthread/t_swapcontext: getcontext/swapcontext 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:55:00 +0000 2017
>Closed-Date: Mon Jan 16 18:41:45 +0000 2017
>Last-Modified: Mon Jan 16 18:42:49 +0000 2017
>Originator: Ngie Cooper
>Release: 7.0.2
>Organization:
>Environment:
n/a
>Description:
Use ATF_REQUIRE_MSG and test for getcontext/swapcontext returning == 0 instead of using 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/51890: [PATCH] tests/lib/libpthread/t_sem:
getcontext/swapcontext fixes
Date: Sun, 15 Jan 2017 12:58:59 -0800
--Apple-Mail=_E6EF5A83-B491-44B4-B78F-F8A952790D18
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
charset=us-ascii
Patch attached.
-Ngie
--Apple-Mail=_E6EF5A83-B491-44B4-B78F-F8A952790D18
Content-Disposition: attachment;
filename=t_swapcontext-various-fixes.patch
Content-Type: application/octet-stream;
x-unix-mode=0644;
name="t_swapcontext-various-fixes.patch"
Content-Transfer-Encoding: 7bit
Index: lib/libpthread/t_swapcontext.c
===================================================================
RCS file: /cvsroot/src/tests/lib/libpthread/t_swapcontext.c,v
retrieving revision 1.2
diff -u -r1.2 t_swapcontext.c
--- lib/libpthread/t_swapcontext.c 25 Aug 2014 16:31:15 -0000 1.2
+++ lib/libpthread/t_swapcontext.c 15 Jan 2017 20:57:58 -0000
@@ -28,10 +28,13 @@
#include <sys/cdefs.h>
__RCSID("$NetBSD");
+#include <sys/types.h>
+#include <errno.h>
#include <pthread.h>
-#include <ucontext.h>
#include <stdio.h>
#include <stdlib.h>
+#include <string.h>
+#include <ucontext.h>
#include <atf-c.h>
@@ -77,7 +80,8 @@
oself = (void *)pthread_self();
printf("before swapcontext self = %p\n", oself);
- PTHREAD_REQUIRE(swapcontext(&octx, &nctx));
+ ATF_REQUIRE_MSG(swapcontext(&octx, &nctx) != -1, "swapcontext failed: %s",
+ strerror(errno));
/* NOTREACHED */
return NULL;
@@ -99,7 +103,8 @@
printf("Testing if swapcontext() alters pthread_self()\n");
- PTHREAD_REQUIRE(getcontext(&nctx));
+ ATF_REQUIRE_MSG(getcontext(&nctx) != -1, "getcontext failed: %s",
+ strerror(errno));
PTHREAD_REQUIRE(pthread_create(&thread, NULL, threadfunc, NULL));
PTHREAD_REQUIRE(pthread_join(thread, NULL));
}
--Apple-Mail=_E6EF5A83-B491-44B4-B78F-F8A952790D18--
From: "Ngie Cooper (yaneurabeya)" <yaneurabeya@gmail.com>
To: gnats-bugs@NetBSD.org
Cc: gnats-admin@netbsd.org,
netbsd-bugs@netbsd.org
Subject: Re: bin/51890: [PATCH] tests/lib/libpthread/t_sem:
getcontext/swapcontext fixes
Date: Sun, 15 Jan 2017 13:06:49 -0800
The title for this bug should be =
=E2=80=9Ctests/lib/libpthread/t_swapcontext: getcontext/swapcontext =
fixes=E2=80=9D, by the way..
Thanks!
-Ngie=
From: "Christos Zoulas" <christos@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/51890 CVS commit: src/tests/lib/libpthread
Date: Mon, 16 Jan 2017 11:27:06 -0500
Module Name: src
Committed By: christos
Date: Mon Jan 16 16:27:06 UTC 2017
Modified Files:
src/tests/lib/libpthread: t_swapcontext.c
Log Message:
PR/51890: 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_swapcontext.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:41:45 +0000
State-Changed-Why:
christos committed it. thanks!
>Unformatted:
(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.