From owner-svn-src-stable-10@freebsd.org Sat Jan 7 09:19:52 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EC9F5C9E6B9; Sat, 7 Jan 2017 09:19:52 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BC1EA1888; Sat, 7 Jan 2017 09:19:52 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v079JpYU095197; Sat, 7 Jan 2017 09:19:51 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v079JpRl095196; Sat, 7 Jan 2017 09:19:51 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201701070919.v079JpRl095196@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Sat, 7 Jan 2017 09:19:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r311613 - stable/10/contrib/netbsd-tests/lib/libpthread X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Jan 2017 09:19:53 -0000 Author: ngie Date: Sat Jan 7 09:19:51 2017 New Revision: 311613 URL: https://svnweb.freebsd.org/changeset/base/311613 Log: MFC r311269: swapcontext1: test for getcontext(3) and swapcontext(3) success properly The beforementioned libcalls both succeed if the return codes aren't -1 CID: 976790, 976791 Modified: stable/10/contrib/netbsd-tests/lib/libpthread/t_swapcontext.c Directory Properties: stable/10/ (props changed) Modified: stable/10/contrib/netbsd-tests/lib/libpthread/t_swapcontext.c ============================================================================== --- stable/10/contrib/netbsd-tests/lib/libpthread/t_swapcontext.c Sat Jan 7 09:18:11 2017 (r311612) +++ stable/10/contrib/netbsd-tests/lib/libpthread/t_swapcontext.c Sat Jan 7 09:19:51 2017 (r311613) @@ -30,6 +30,8 @@ __RCSID("$NetBSD"); #ifdef __FreeBSD__ #include +#include +#include #endif #include #include @@ -80,7 +82,12 @@ threadfunc(void *arg) oself = (void *)pthread_self(); printf("before swapcontext self = %p\n", oself); +#ifdef __FreeBSD__ + ATF_REQUIRE_MSG(swapcontext(&octx, &nctx) != -1, "swapcontext failed: %s", + strerror(errno)); +#else PTHREAD_REQUIRE(swapcontext(&octx, &nctx)); +#endif /* NOTREACHED */ return NULL; @@ -102,7 +109,12 @@ ATF_TC_BODY(swapcontext1, tc) printf("Testing if swapcontext() alters pthread_self()\n"); +#ifdef __FreeBSD__ + ATF_REQUIRE_MSG(getcontext(&nctx) != -1, "getcontext failed: %s", + strerror(errno)); +#else PTHREAD_REQUIRE(getcontext(&nctx)); +#endif PTHREAD_REQUIRE(pthread_create(&thread, NULL, threadfunc, NULL)); PTHREAD_REQUIRE(pthread_join(thread, NULL)); }