diff options
author | Federico G. Schwindt <fgsch@cvs.openbsd.org> | 2011-12-12 15:53:09 +0000 |
---|---|---|
committer | Federico G. Schwindt <fgsch@cvs.openbsd.org> | 2011-12-12 15:53:09 +0000 |
commit | 7463fb1de39126cd37e04f7895188c83bdc5f16d (patch) | |
tree | 9f591ca889484f64dc2508ff14386b7ff66d70c3 /regress/lib/libpthread | |
parent | f8448c664a35fdb12221f239407dbd155b0f70b8 (diff) |
better output on error.
Diffstat (limited to 'regress/lib/libpthread')
-rw-r--r-- | regress/lib/libpthread/setsockopt/1/setsockopt1.c | 18 | ||||
-rw-r--r-- | regress/lib/libpthread/setsockopt/2/setsockopt2.c | 22 | ||||
-rw-r--r-- | regress/lib/libpthread/setsockopt/3/setsockopt3.c | 4 | ||||
-rw-r--r-- | regress/lib/libpthread/setsockopt/3a/setsockopt3a.c | 12 |
4 files changed, 28 insertions, 28 deletions
diff --git a/regress/lib/libpthread/setsockopt/1/setsockopt1.c b/regress/lib/libpthread/setsockopt/1/setsockopt1.c index 758b4f71138..519dcd2ceee 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.1 2009/12/26 01:34:18 fgsch Exp $ */ +/* $OpenBSD: setsockopt1.c,v 1.2 2011/12/12 15:53:08 fgsch Exp $ */ /* * Federico G. Schwindt <fgsch@openbsd.org>, 2009. Public Domain. */ @@ -20,7 +20,7 @@ alarm_handler(int sig) _exit(NOTOK); } -int +void check_timeout(int s, int sec, struct timeval *to) { struct timeval t1, t2; @@ -35,7 +35,7 @@ check_timeout(int s, int sec, struct timeval *to) ASSERT(errno == EAGAIN); timersub(&t2, &t1, &e); timersub(&e, to, &d); - return ((d.tv_sec > 1 || (d.tv_usec / 1000) > 100) ? 1 : 0); + ASSERT(d.tv_sec <= 1 && (d.tv_usec / 1000) <= 100); } static void * @@ -57,15 +57,15 @@ sock_connect(void *arg) to.tv_sec = 2; to.tv_usec = 0.5 * 1e6; CHECKe(setsockopt(s, SOL_SOCKET, SO_RCVTIMEO, &to, sizeof(to))); - CHECKr(check_timeout(s, 3, &to)); - CHECKr(check_timeout(s2, 3, &to)); - CHECKr(check_timeout(s3, 3, &to)); + check_timeout(s, 3, &to); + check_timeout(s2, 3, &to); + check_timeout(s3, 3, &to); to.tv_sec = 1; to.tv_usec = 0.5 * 1e6; CHECKe(setsockopt(s, SOL_SOCKET, SO_RCVTIMEO, &to, sizeof(to))); - CHECKr(check_timeout(s, 2, &to)); - CHECKr(check_timeout(s2, 2, &to)); - CHECKr(check_timeout(s3, 2, &to)); + check_timeout(s, 2, &to); + check_timeout(s2, 2, &to); + check_timeout(s3, 2, &to); return (NULL); } diff --git a/regress/lib/libpthread/setsockopt/2/setsockopt2.c b/regress/lib/libpthread/setsockopt/2/setsockopt2.c index 21a296b4e1a..a6c3ee54a85 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.1 2009/12/26 01:34:18 fgsch Exp $ */ +/* $OpenBSD: setsockopt2.c,v 1.2 2011/12/12 15:53:08 fgsch Exp $ */ /* * Federico G. Schwindt <fgsch@openbsd.org>, 2009. Public Domain. */ @@ -21,7 +21,7 @@ alarm_handler(int sig) _exit(NOTOK); } -int +void check_timeout(int s, int sec, struct timeval *to) { struct timeval t1, t2; @@ -36,7 +36,7 @@ check_timeout(int s, int sec, struct timeval *to) ASSERT(errno == EAGAIN); timersub(&t2, &t1, &e); timersub(&e, to, &d); - return ((d.tv_sec > 1 || (d.tv_usec / 1000) > 100) ? 1 : 0); + ASSERT(d.tv_sec <= 1 && (d.tv_usec / 1000) <= 100); } static void * @@ -65,19 +65,19 @@ sock_connect(void *arg) to.tv_sec = 1; to.tv_usec = 0.5 * 1e6; CHECKe(setsockopt(s, SOL_SOCKET, SO_RCVTIMEO, &to, sizeof(to))); - CHECKr(check_timeout(s, 2, &to)); - CHECKr(check_timeout(s2, 2, &to)); - CHECKr(check_timeout(s3, 2, &to)); + check_timeout(s, 2, &to); + check_timeout(s2, 2, &to); + check_timeout(s3, 2, &to); return (NULL); } sleep(2); - CHECKr(check_timeout(s, 2, &to)); - CHECKr(check_timeout(s2, 2, &to)); - CHECKr(check_timeout(s3, 2, &to)); + check_timeout(s, 2, &to); + check_timeout(s2, 2, &to); + check_timeout(s3, 2, &to); CHECKe(s2 = dup(s)); CHECKe(s3 = fcntl(s, F_DUPFD, s)); - CHECKr(check_timeout(s2, 2, &to)); - CHECKr(check_timeout(s3, 2, &to)); + check_timeout(s2, 2, &to); + check_timeout(s3, 2, &to); CHECKe(close(s)); CHECKe(close(s2)); CHECKe(close(s3)); diff --git a/regress/lib/libpthread/setsockopt/3/setsockopt3.c b/regress/lib/libpthread/setsockopt/3/setsockopt3.c index fc712e81d16..ee106c72c7f 100644 --- a/regress/lib/libpthread/setsockopt/3/setsockopt3.c +++ b/regress/lib/libpthread/setsockopt/3/setsockopt3.c @@ -1,4 +1,4 @@ -/* $OpenBSD: setsockopt3.c,v 1.2 2010/01/03 23:02:33 fgsch Exp $ */ +/* $OpenBSD: setsockopt3.c,v 1.3 2011/12/12 15:53:08 fgsch Exp $ */ /* * Federico G. Schwindt <fgsch@openbsd.org>, 2009. Public Domain. */ @@ -39,7 +39,7 @@ sock_connect(void *arg) } ASSERTe(wait(&status), == child_pid); ASSERT(WIFEXITED(status)); - CHECKr(WEXITSTATUS(status)); + ASSERT(WEXITSTATUS(status) == 0); return (NULL); } diff --git a/regress/lib/libpthread/setsockopt/3a/setsockopt3a.c b/regress/lib/libpthread/setsockopt/3a/setsockopt3a.c index b7282415fb1..0549e651905 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.2 2010/01/03 23:02:34 fgsch Exp $ */ +/* $OpenBSD: setsockopt3a.c,v 1.3 2011/12/12 15:53:08 fgsch Exp $ */ /* * Federico G. Schwindt <fgsch@openbsd.org>, 2009. Public Domain. */ @@ -20,7 +20,7 @@ alarm_handler(int sig) _exit(NOTOK); } -int +void check_timeout(int s, int sec, struct timeval *to) { struct timeval t1, t2; @@ -35,7 +35,7 @@ check_timeout(int s, int sec, struct timeval *to) ASSERT(errno == EAGAIN); timersub(&t2, &t1, &e); timersub(&e, to, &d); - return ((d.tv_sec > 1 || (d.tv_usec / 1000) > 100) ? 1 : 0); + ASSERT(d.tv_sec <= 1 && (d.tv_usec / 1000) <= 100); } static void * @@ -54,11 +54,11 @@ sock_accept(void *arg) CHECKe(connect(s, (struct sockaddr *)&sin, sizeof(sin))); to.tv_sec = 2; to.tv_usec = 0.5 * 1e6; - CHECKr(check_timeout(s, 3, &to)); + check_timeout(s, 3, &to); CHECKe(s2 = dup(s)); CHECKe(s3 = fcntl(s, F_DUPFD, s)); - CHECKr(check_timeout(s2, 3, &to)); - CHECKr(check_timeout(s3, 3, &to)); + check_timeout(s2, 3, &to); + check_timeout(s3, 3, &to); return (NULL); } |