diff options
author | Federico G. Schwindt <fgsch@cvs.openbsd.org> | 2012-02-19 23:58:58 +0000 |
---|---|---|
committer | Federico G. Schwindt <fgsch@cvs.openbsd.org> | 2012-02-19 23:58:58 +0000 |
commit | d7debe1c2e95d6954dd1f63265caba4339a28582 (patch) | |
tree | f47d21dcf24798d73da0dfb5feed334b6d6f9f7a /regress | |
parent | 31c2395b1db1e9777f8bbe62bf2abbeafd4aa2f7 (diff) |
fix tests.
Diffstat (limited to 'regress')
-rw-r--r-- | regress/lib/libpthread/setsockopt/1/setsockopt1.c | 9 | ||||
-rw-r--r-- | regress/lib/libpthread/setsockopt/2/setsockopt2.c | 9 | ||||
-rw-r--r-- | regress/lib/libpthread/setsockopt/3a/setsockopt3a.c | 9 |
3 files changed, 15 insertions, 12 deletions
diff --git a/regress/lib/libpthread/setsockopt/1/setsockopt1.c b/regress/lib/libpthread/setsockopt/1/setsockopt1.c index 519dcd2ceee..df8f33ddf80 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.2 2011/12/12 15:53:08 fgsch Exp $ */ +/* $OpenBSD: setsockopt1.c,v 1.3 2012/02/19 23:58:57 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, d; + struct timeval e, max; char buf[BUFSIZ]; ASSERT(signal(SIGALRM, alarm_handler) != SIG_ERR); @@ -34,8 +34,9 @@ check_timeout(int s, int sec, struct timeval *to) CHECKe(gettimeofday(&t2, NULL)); ASSERT(errno == EAGAIN); timersub(&t2, &t1, &e); - timersub(&e, to, &d); - ASSERT(d.tv_sec <= 1 && (d.tv_usec / 1000) <= 100); + max.tv_sec = sec; + max.tv_usec = 0; + ASSERT(timercmp(&e, &max, <)); } static void * diff --git a/regress/lib/libpthread/setsockopt/2/setsockopt2.c b/regress/lib/libpthread/setsockopt/2/setsockopt2.c index a6c3ee54a85..31fb80a5dd0 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.2 2011/12/12 15:53:08 fgsch Exp $ */ +/* $OpenBSD: setsockopt2.c,v 1.3 2012/02/19 23:58:57 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, d; + struct timeval e, max; char buf[BUFSIZ]; ASSERT(signal(SIGALRM, alarm_handler) != SIG_ERR); @@ -35,8 +35,9 @@ check_timeout(int s, int sec, struct timeval *to) CHECKe(gettimeofday(&t2, NULL)); ASSERT(errno == EAGAIN); timersub(&t2, &t1, &e); - timersub(&e, to, &d); - ASSERT(d.tv_sec <= 1 && (d.tv_usec / 1000) <= 100); + max.tv_sec = sec; + max.tv_usec = 0; + ASSERT(timercmp(&e, &max, <)); } static void * diff --git a/regress/lib/libpthread/setsockopt/3a/setsockopt3a.c b/regress/lib/libpthread/setsockopt/3a/setsockopt3a.c index 0549e651905..c4fafceda10 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.3 2011/12/12 15:53:08 fgsch Exp $ */ +/* $OpenBSD: setsockopt3a.c,v 1.4 2012/02/19 23:58:57 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, d; + struct timeval e, max; char buf[BUFSIZ]; ASSERT(signal(SIGALRM, alarm_handler) != SIG_ERR); @@ -34,8 +34,9 @@ check_timeout(int s, int sec, struct timeval *to) CHECKe(gettimeofday(&t2, NULL)); ASSERT(errno == EAGAIN); timersub(&t2, &t1, &e); - timersub(&e, to, &d); - ASSERT(d.tv_sec <= 1 && (d.tv_usec / 1000) <= 100); + max.tv_sec = sec; + max.tv_usec = 0; + ASSERT(timercmp(&e, &max, <)); } static void * |