From owner-svn-src-all@freebsd.org Fri Aug 16 13:10:09 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8522DCBE7A; Fri, 16 Aug 2019 13:10:09 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4693Zn2sRrz4FJB; Fri, 16 Aug 2019 13:10:09 +0000 (UTC) (envelope-from vangyzen@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4025C1624; Fri, 16 Aug 2019 13:10:09 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7GDA8tJ046373; Fri, 16 Aug 2019 13:10:08 GMT (envelope-from vangyzen@FreeBSD.org) Received: (from vangyzen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7GDA8Pf046372; Fri, 16 Aug 2019 13:10:08 GMT (envelope-from vangyzen@FreeBSD.org) Message-Id: <201908161310.x7GDA8Pf046372@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: vangyzen set sender to vangyzen@FreeBSD.org using -f From: Eric van Gyzen Date: Fri, 16 Aug 2019 13:10:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351118 - head/contrib/netbsd-tests/lib/libpthread X-SVN-Group: head X-SVN-Commit-Author: vangyzen X-SVN-Commit-Paths: head/contrib/netbsd-tests/lib/libpthread X-SVN-Commit-Revision: 351118 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Aug 2019 13:10:09 -0000 Author: vangyzen Date: Fri Aug 16 13:10:08 2019 New Revision: 351118 URL: https://svnweb.freebsd.org/changeset/base/351118 Log: Update pthread_cond_timedwait() test to current NetBSD NetBSD adapted and committed our r350620. Update to their version 1.8. Reviewed by: ngie Obtained from: NetBSD MFC after: 1 week Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D21279 Modified: head/contrib/netbsd-tests/lib/libpthread/t_condwait.c Modified: head/contrib/netbsd-tests/lib/libpthread/t_condwait.c ============================================================================== --- head/contrib/netbsd-tests/lib/libpthread/t_condwait.c Fri Aug 16 12:28:37 2019 (r351117) +++ head/contrib/netbsd-tests/lib/libpthread/t_condwait.c Fri Aug 16 13:10:08 2019 (r351118) @@ -1,4 +1,4 @@ -/* $NetBSD: t_condwait.c,v 1.5 2017/01/16 16:29:19 christos Exp $ */ +/* $NetBSD: t_condwait.c,v 1.8 2019/08/11 11:42:23 martin Exp $ */ /* * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -26,7 +26,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -__RCSID("$NetBSD: t_condwait.c,v 1.5 2017/01/16 16:29:19 christos Exp $"); +__RCSID("$NetBSD: t_condwait.c,v 1.8 2019/08/11 11:42:23 martin Exp $"); #include #include @@ -50,10 +50,7 @@ static const int debug = 1; static void * run(void *param) { - struct timespec ts, to, te; -#ifdef __FreeBSD__ - struct timespec tw; -#endif + struct timespec ts, to, te, twmin, twmax; clockid_t clck; pthread_condattr_t attr; pthread_cond_t cond; @@ -88,22 +85,23 @@ run(void *param) printf("elapsed: %lld.%09ld sec\n", (long long)to.tv_sec, to.tv_nsec); } + twmin.tv_sec = WAITTIME; + twmin.tv_nsec = 0; if (isQEMU()) { - double to_seconds = to.tv_sec + 1e-9 * to.tv_nsec; - ATF_REQUIRE(to_seconds >= WAITTIME * 0.9); - /* Loose upper limit because of qemu timing bugs */ - ATF_REQUIRE(to_seconds < WAITTIME * 2.5); + struct timespec td, t; + // td.tv_sec = 0; + // td.tv_nsec = 900000000; + t = twmin; + // timespecsub(&t, &td, &twmin); + td.tv_sec = 2; + td.tv_nsec = 500000000; + timespecadd(&t, &td, &twmax); } else { -#ifdef __FreeBSD__ - tw.tv_sec = WAITTIME; - tw.tv_nsec = 0; - ATF_REQUIRE(timespeccmp(&to, &tw, >=)); - tw.tv_sec++; - ATF_REQUIRE(timespeccmp(&to, &tw, <=)); -#else - ATF_REQUIRE_EQ(to.tv_sec, WAITTIME); -#endif + twmax = twmin; + twmax.tv_sec++; } + ATF_REQUIRE(timespeccmp(&to, &twmin, >=)); + ATF_REQUIRE(timespeccmp(&to, &twmax, <=)); break; default: ATF_REQUIRE_MSG(0, "pthread_cond_timedwait: %s", strerror(ret)); @@ -152,5 +150,5 @@ ATF_TP_ADD_TCS(tp) { ATF_TP_ADD_TC(tp, cond_wait_real); ATF_TP_ADD_TC(tp, cond_wait_mono); - return 0; + return atf_no_error(); }