Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/tests/lib/libpthread loosen the test only for qemu.
details: https://anonhg.NetBSD.org/src/rev/7dd0cf6afacb
branches: trunk
changeset: 786045:7dd0cf6afacb
user: christos <christos%NetBSD.org@localhost>
date: Fri Apr 12 17:18:11 2013 +0000
description:
loosen the test only for qemu.
diffstat:
tests/lib/libpthread/Makefile | 3 ++-
tests/lib/libpthread/t_condwait.c | 19 ++++++++++++-------
2 files changed, 14 insertions(+), 8 deletions(-)
diffs (77 lines):
diff -r b10df65748ae -r 7dd0cf6afacb tests/lib/libpthread/Makefile
--- a/tests/lib/libpthread/Makefile Fri Apr 12 17:13:54 2013 +0000
+++ b/tests/lib/libpthread/Makefile Fri Apr 12 17:18:11 2013 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.10 2013/03/28 18:50:01 christos Exp $
+# $NetBSD: Makefile,v 1.11 2013/04/12 17:18:11 christos Exp $
NOMAN= # defined
@@ -12,6 +12,7 @@
SRCS.t_join= t_join.c ${SRCS_CHECK_STACK}
CPPFLAGS.t_join.c+= ${CPPFLAGS_CHECK_STACK}
+CPPFLAGS.t_condwait.c+= -I${.CURDIR}/../libc/gen
TESTS_SH+= t_atexit
TESTS_C+= t_barrier
diff -r b10df65748ae -r 7dd0cf6afacb tests/lib/libpthread/t_condwait.c
--- a/tests/lib/libpthread/t_condwait.c Fri Apr 12 17:13:54 2013 +0000
+++ b/tests/lib/libpthread/t_condwait.c Fri Apr 12 17:18:11 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: t_condwait.c,v 1.3 2013/04/12 14:21:52 gson Exp $ */
+/* $NetBSD: t_condwait.c,v 1.4 2013/04/12 17:18:11 christos Exp $ */
/*
* Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -26,7 +26,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: t_condwait.c,v 1.3 2013/04/12 14:21:52 gson Exp $");
+__RCSID("$NetBSD: t_condwait.c,v 1.4 2013/04/12 17:18:11 christos Exp $");
#include <errno.h>
#include <pthread.h>
@@ -38,6 +38,8 @@
#include <atf-c.h>
+#include "isqemu.h"
+
#define WAITTIME 2 /* Timeout wait secound */
static const int debug = 1;
@@ -46,7 +48,6 @@
run(void *param)
{
struct timespec ts, to, te;
- double to_seconds;
clockid_t clck;
pthread_condattr_t attr;
pthread_cond_t cond;
@@ -75,16 +76,20 @@
/* Timeout */
ATF_REQUIRE_EQ(clock_gettime(clck, &te), 0);
timespecsub(&te, &to, &to);
- to_seconds = to.tv_sec + 1e-9 * to.tv_nsec;
if (debug) {
printf("timeout: %lld.%09ld sec\n",
(long long)te.tv_sec, te.tv_nsec);
printf("elapsed: %lld.%09ld sec\n",
(long long)to.tv_sec, to.tv_nsec);
}
- ATF_REQUIRE(to_seconds >= WAITTIME * 0.9);
- /* Use a loose upper limit because of qemu timing bugs */
- ATF_REQUIRE(to_seconds < WAITTIME * 2.5);
+ 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);
+ } else {
+ ATF_REQUIRE_EQ(to.tv_sec, WAITTIME);
+ }
break;
default:
ATF_REQUIRE_MSG(0, "pthread_cond_timedwait: %s", strerror(ret));
Home |
Main Index |
Thread Index |
Old Index