diff options
author | Philip Guenthe <guenther@cvs.openbsd.org> | 2012-07-11 09:14:47 +0000 |
---|---|---|
committer | Philip Guenthe <guenther@cvs.openbsd.org> | 2012-07-11 09:14:47 +0000 |
commit | 02a017b052d4400bec6be5e50004dd096b98e74e (patch) | |
tree | 0919714ee0c15b8a438af12ec5f2a88a162da543 /regress | |
parent | f22fb607ef5a51e44dc9b5c6bc36b93f4cb7cbd7 (diff) |
Now that socket timeouts don't return early, fix the regress to match
Diffstat (limited to 'regress')
-rw-r--r-- | regress/lib/libpthread/setsockopt/1/setsockopt1.c | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/regress/lib/libpthread/setsockopt/1/setsockopt1.c b/regress/lib/libpthread/setsockopt/1/setsockopt1.c index 99e596e723a..c349aa56f68 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.5 2012/02/20 21:00:24 guenther Exp $ */ +/* $OpenBSD: setsockopt1.c,v 1.6 2012/07/11 09:14:46 guenther Exp $ */ /* * Federico G. Schwindt <fgsch@openbsd.org>, 2009. Public Domain. */ @@ -15,8 +15,8 @@ #include <unistd.h> #include "test.h" -/* resolution of the monotonic clock */ -struct timespec mono_res; +/* twice the resolution of the monotonic clock */ +struct timespec mono_res_times2; static void alarm_handler(int sig) @@ -42,11 +42,9 @@ check_timeout(int s, int sec, const struct timespec *to) * verify that the difference between the duration and the * timeout is less than the resolution of the clock */ - if (timespeccmp(&e, to, <)) - timespecsub(to, &e, &t1); - else - timespecsub(&e, to, &t1); - ASSERT(timespeccmp(&t1, &mono_res, <=)); + ASSERT(timespeccmp(&e, to, >)); + timespecsub(&e, to, &t1); + ASSERT(timespeccmp(&t1, &mono_res_times2, <=)); } static void * @@ -57,7 +55,8 @@ sock_connect(void *arg) struct timespec ts; int s, s2, s3; - CHECKe(clock_getres(CLOCK_MONOTONIC, &mono_res)); + CHECKe(clock_getres(CLOCK_MONOTONIC, &mono_res_times2)); + timespecadd(&mono_res_times2, &mono_res_times2, &mono_res_times2); CHECKe(s = socket(AF_INET, SOCK_STREAM, 0)); CHECKe(s2 = dup(s)); CHECKe(s3 = fcntl(s, F_DUPFD, s)); |