diff options
author | 2012-02-20 01:31:12 +0000 | |
---|---|---|
committer | 2012-02-20 01:31:12 +0000 | |
commit | c3d844ff82cf2f7d1bd3e4d7a35a32c2ca95bebe (patch) | |
tree | f9563de5f71d96d81bb31b8f6b8067c1ca22a192 /regress/lib/libpthread | |
parent | fix tests. (diff) | |
download | wireguard-openbsd-c3d844ff82cf2f7d1bd3e4d7a35a32c2ca95bebe.tar.xz wireguard-openbsd-c3d844ff82cf2f7d1bd3e4d7a35a32c2ca95bebe.zip |
ops. compare against the socket timeout, not the alarm one.
sometimes these tests are incorrectly marked as failing (ktrace shows
the read is returning within the specified timeout) but there are other
times where they're taking slightly longer than expected.
for now both cases are marked as failure.
Diffstat (limited to 'regress/lib/libpthread')
-rw-r--r-- | regress/lib/libpthread/setsockopt/1/setsockopt1.c | 10 | ||||
-rw-r--r-- | regress/lib/libpthread/setsockopt/2/setsockopt2.c | 10 | ||||
-rw-r--r-- | regress/lib/libpthread/setsockopt/3a/setsockopt3a.c | 10 |
3 files changed, 15 insertions, 15 deletions
diff --git a/regress/lib/libpthread/setsockopt/1/setsockopt1.c b/regress/lib/libpthread/setsockopt/1/setsockopt1.c index df8f33ddf80..57ae0b0c320 100644 --- a/regress/lib/libpthread/setsockopt/1/setsockopt1.c +++ b/regress/lib/libpthread/setsockopt/1/setsockopt1.c @@ -1,4 +1,4 @@ -/* $OpenBSD: setsockopt1.c,v 1.3 2012/02/19 23:58:57 fgsch Exp $ */ +/* $OpenBSD: setsockopt1.c,v 1.4 2012/02/20 01:31:12 fgsch Exp $ */ /* * Federico G. Schwindt <fgsch@openbsd.org>, 2009. Public Domain. */ @@ -24,7 +24,7 @@ void check_timeout(int s, int sec, struct timeval *to) { struct timeval t1, t2; - struct timeval e, max; + struct timeval e; char buf[BUFSIZ]; ASSERT(signal(SIGALRM, alarm_handler) != SIG_ERR); @@ -34,9 +34,9 @@ check_timeout(int s, int sec, struct timeval *to) CHECKe(gettimeofday(&t2, NULL)); ASSERT(errno == EAGAIN); timersub(&t2, &t1, &e); - max.tv_sec = sec; - max.tv_usec = 0; - ASSERT(timercmp(&e, &max, <)); + if (!timercmp(&e, to, <)) + PANIC("%ld.%ld > %ld.%ld", + e.tv_sec, e.tv_usec, to->tv_sec, to->tv_usec); } static void * diff --git a/regress/lib/libpthread/setsockopt/2/setsockopt2.c b/regress/lib/libpthread/setsockopt/2/setsockopt2.c index 31fb80a5dd0..3e38b5a0021 100644 --- a/regress/lib/libpthread/setsockopt/2/setsockopt2.c +++ b/regress/lib/libpthread/setsockopt/2/setsockopt2.c @@ -1,4 +1,4 @@ -/* $OpenBSD: setsockopt2.c,v 1.3 2012/02/19 23:58:57 fgsch Exp $ */ +/* $OpenBSD: setsockopt2.c,v 1.4 2012/02/20 01:31:12 fgsch Exp $ */ /* * Federico G. Schwindt <fgsch@openbsd.org>, 2009. Public Domain. */ @@ -25,7 +25,7 @@ void check_timeout(int s, int sec, struct timeval *to) { struct timeval t1, t2; - struct timeval e, max; + struct timeval e; char buf[BUFSIZ]; ASSERT(signal(SIGALRM, alarm_handler) != SIG_ERR); @@ -35,9 +35,9 @@ check_timeout(int s, int sec, struct timeval *to) CHECKe(gettimeofday(&t2, NULL)); ASSERT(errno == EAGAIN); timersub(&t2, &t1, &e); - max.tv_sec = sec; - max.tv_usec = 0; - ASSERT(timercmp(&e, &max, <)); + if (!timercmp(&e, to, <)) + PANIC("%ld.%ld > %ld.%ld", + e.tv_sec, e.tv_usec, to->tv_sec, to->tv_usec); } static void * diff --git a/regress/lib/libpthread/setsockopt/3a/setsockopt3a.c b/regress/lib/libpthread/setsockopt/3a/setsockopt3a.c index c4fafceda10..c613191d278 100644 --- a/regress/lib/libpthread/setsockopt/3a/setsockopt3a.c +++ b/regress/lib/libpthread/setsockopt/3a/setsockopt3a.c @@ -1,4 +1,4 @@ -/* $OpenBSD: setsockopt3a.c,v 1.4 2012/02/19 23:58:57 fgsch Exp $ */ +/* $OpenBSD: setsockopt3a.c,v 1.5 2012/02/20 01:31:12 fgsch Exp $ */ /* * Federico G. Schwindt <fgsch@openbsd.org>, 2009. Public Domain. */ @@ -24,7 +24,7 @@ void check_timeout(int s, int sec, struct timeval *to) { struct timeval t1, t2; - struct timeval e, max; + struct timeval e; char buf[BUFSIZ]; ASSERT(signal(SIGALRM, alarm_handler) != SIG_ERR); @@ -34,9 +34,9 @@ check_timeout(int s, int sec, struct timeval *to) CHECKe(gettimeofday(&t2, NULL)); ASSERT(errno == EAGAIN); timersub(&t2, &t1, &e); - max.tv_sec = sec; - max.tv_usec = 0; - ASSERT(timercmp(&e, &max, <)); + if (!timercmp(&e, to, <)) + PANIC("%ld.%ld > %ld.%ld", + e.tv_sec, e.tv_usec, to->tv_sec, to->tv_usec); } static void * |