Date: Sat, 7 Jan 2017 09:19:55 +0000 (UTC) From: Ngie Cooper <ngie@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r311614 - stable/11/contrib/netbsd-tests/lib/libpthread Message-ID: <201701070919.v079JtmK095243@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: ngie Date: Sat Jan 7 09:19:55 2017 New Revision: 311614 URL: https://svnweb.freebsd.org/changeset/base/311614 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/11/contrib/netbsd-tests/lib/libpthread/t_swapcontext.c Directory Properties: stable/11/ (props changed) Modified: stable/11/contrib/netbsd-tests/lib/libpthread/t_swapcontext.c ============================================================================== --- stable/11/contrib/netbsd-tests/lib/libpthread/t_swapcontext.c Sat Jan 7 09:19:51 2017 (r311613) +++ stable/11/contrib/netbsd-tests/lib/libpthread/t_swapcontext.c Sat Jan 7 09:19:55 2017 (r311614) @@ -30,6 +30,8 @@ __RCSID("$NetBSD"); #ifdef __FreeBSD__ #include <sys/types.h> +#include <errno.h> +#include <string.h> #endif #include <pthread.h> #include <ucontext.h> @@ -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)); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201701070919.v079JtmK095243>