Date: Wed, 4 Jan 2017 08:07:48 +0000 (UTC) From: Ngie Cooper <ngie@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r311265 - head/contrib/netbsd-tests/lib/libpthread Message-ID: <201701040807.v0487m6h070722@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: ngie Date: Wed Jan 4 08:07:48 2017 New Revision: 311265 URL: https://svnweb.freebsd.org/changeset/base/311265 Log: fpu: ensure calls to pthread_create succeed and test sched_yield to make sure it returns 0 sched_yield tests for values returning 0 of type int and sched_yield is of type long, so the test is a mismatch MFC after: 1 week Reported by: Coverity CID: 1254953, 1254954, 1254965, 1254966 Modified: head/contrib/netbsd-tests/lib/libpthread/t_fpu.c Modified: head/contrib/netbsd-tests/lib/libpthread/t_fpu.c ============================================================================== --- head/contrib/netbsd-tests/lib/libpthread/t_fpu.c Wed Jan 4 08:04:58 2017 (r311264) +++ head/contrib/netbsd-tests/lib/libpthread/t_fpu.c Wed Jan 4 08:07:48 2017 (r311265) @@ -58,6 +58,11 @@ __RCSID("$NetBSD: t_fpu.c,v 1.2 2013/01/ #include <atf-c.h> +#ifdef __FreeBSD__ +#include <errno.h> +#include <string.h> +#endif + #include "h_common.h" #define N_RECURSE 10 @@ -77,14 +82,24 @@ stir(void *p) for (;;) { x = sin ((y = cos (x + y + .4)) - (z = cos (x + z + .6))); +#ifdef __FreeBSD__ + ATF_REQUIRE_MSG(sched_yield() == 0, + "sched_yield failed: %s", strerror(errno)); +#else PTHREAD_REQUIRE(sched_yield()); +#endif } } static double mul3(double x, double y, double z) { +#ifdef __FreeBSD__ + ATF_REQUIRE_MSG(sched_yield() == 0, + "sched_yield failed: %s", strerror(errno)); +#else PTHREAD_REQUIRE(sched_yield()); +#endif return x * y * z; } @@ -114,7 +129,11 @@ bar(void *p) static void recurse(void) { pthread_t s2; +#ifdef __FreeBSD__ + PTHREAD_REQUIRE(pthread_create(&s2, 0, bar, 0)); +#else pthread_create(&s2, 0, bar, 0); +#endif sleep(20); /* XXX must be long enough for our slowest machine */ } @@ -134,7 +153,11 @@ ATF_TC_BODY(fpu, tc) PTHREAD_REQUIRE(pthread_mutex_init(&recursion_depth_lock, 0)); +#ifdef __FreeBSD__ + PTHREAD_REQUIRE(pthread_create(&s5, 0, stir, stirseed)); +#else pthread_create(&s5, 0, stir, stirseed); +#endif recurse(); atf_tc_fail("exiting from main");
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201701040807.v0487m6h070722>