summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tests/alpn-server-prec.c4
-rw-r--r--tests/client-fastopen.c4
-rw-r--r--tests/custom-urls-override.c10
-rw-r--r--tests/custom-urls.c10
-rw-r--r--tests/dtls-client-with-seccomp.c4
-rw-r--r--tests/dtls-rehandshake-anon.c4
-rw-r--r--tests/dtls-rehandshake-cert-2.c4
-rw-r--r--tests/dtls-rehandshake-cert-3.c4
-rw-r--r--tests/dtls-rehandshake-cert.c4
-rw-r--r--tests/dtls-with-seccomp.c4
-rw-r--r--tests/fallback-scsv.c9
-rw-r--r--tests/key-material-dtls.c4
-rw-r--r--tests/key-material-set-dtls.c4
-rw-r--r--tests/long-session-id.c12
-rw-r--r--tests/mini-alpn.c4
-rw-r--r--tests/mini-cert-status.c6
-rw-r--r--tests/mini-chain-unsorted.c6
-rw-r--r--tests/mini-dtls-discard.c4
-rw-r--r--tests/mini-dtls-fork.c4
-rw-r--r--tests/mini-dtls-heartbeat.c4
-rw-r--r--tests/mini-dtls-hello-verify-48.c4
-rw-r--r--tests/mini-dtls-hello-verify.c4
-rw-r--r--tests/mini-dtls-large.c4
-rw-r--r--tests/mini-dtls-lowmtu.c10
-rw-r--r--tests/mini-dtls-mtu.c4
-rw-r--r--tests/mini-dtls-pthread.c4
-rw-r--r--tests/mini-dtls-record-asym.c4
-rw-r--r--tests/mini-dtls-record.c4
-rw-r--r--tests/mini-dtls-srtp.c4
-rw-r--r--tests/mini-dtls0-9.c4
-rw-r--r--tests/mini-etm.c10
-rw-r--r--tests/mini-handshake-timeout.c3
-rw-r--r--tests/mini-key-material.c4
-rw-r--r--tests/mini-loss-time.c3
-rw-r--r--tests/mini-overhead.c10
-rw-r--r--tests/mini-record-2.c10
-rw-r--r--tests/mini-record-failure.c10
-rw-r--r--tests/mini-record-range.c10
-rw-r--r--tests/mini-record-retvals.c10
-rw-r--r--tests/mini-record.c10
-rw-r--r--tests/mini-server-name.c10
-rw-r--r--tests/mini-termination.c10
-rw-r--r--tests/mini-tls-nonblock.c10
-rw-r--r--tests/no-signal.c3
-rw-r--r--tests/openpgp-auth.c9
-rw-r--r--tests/openpgp-auth2.c10
-rw-r--r--tests/openpgp-callback.c15
-rw-r--r--tests/prf.c4
-rw-r--r--tests/resume-dtls.c3
-rw-r--r--tests/resume.c3
-rw-r--r--tests/sign-md5-rep.c10
-rw-r--r--tests/srp.c4
-rw-r--r--tests/status-request-missing.c10
-rw-r--r--tests/status-request-ok.c10
-rw-r--r--tests/status-request.c9
-rw-r--r--tests/tls-client-with-seccomp.c4
-rw-r--r--tests/tls-rehandshake-cert-2.c10
-rw-r--r--tests/tls-with-seccomp.c4
-rw-r--r--tests/tlsext-decoding.c4
-rw-r--r--tests/utils.h36
-rw-r--r--tests/x509dn.c15
61 files changed, 91 insertions, 337 deletions
diff --git a/tests/alpn-server-prec.c b/tests/alpn-server-prec.c
index 45938d73be..e8da9ebada 100644
--- a/tests/alpn-server-prec.c
+++ b/tests/alpn-server-prec.c
@@ -281,9 +281,7 @@ static void start(const char *p1, const char *p2, const char *cp1, const char *c
server(fd[0], p1, p2, expected);
wait(&status);
- if (WEXITSTATUS(status) != 0)
- fail("Child died with status %d\n",
- WEXITSTATUS(status));
+ check_wait_status(status);
} else {
close(fd[0]);
client(fd[1], cp1, "unknown/1.4", cp2);
diff --git a/tests/client-fastopen.c b/tests/client-fastopen.c
index 863f12a19e..9211c44a7c 100644
--- a/tests/client-fastopen.c
+++ b/tests/client-fastopen.c
@@ -298,9 +298,7 @@ void doit(void)
server(fd);
wait(&status);
- if (WEXITSTATUS(status) != 0)
- fail("Child died with status %d\n",
- WEXITSTATUS(status));
+ check_wait_status(status);
} else {
fd = socket(AF_INET, SOCK_STREAM, 0);
diff --git a/tests/custom-urls-override.c b/tests/custom-urls-override.c
index cbf1e7ca10..2209fe8edd 100644
--- a/tests/custom-urls-override.c
+++ b/tests/custom-urls-override.c
@@ -265,15 +265,7 @@ static void ch_handler(int sig)
{
int status;
wait(&status);
- if (WEXITSTATUS(status) != 0 ||
- (WIFSIGNALED(status) && WTERMSIG(status) == SIGSEGV)) {
- if (WIFSIGNALED(status))
- fail("Child died with sigsegv\n");
- else
- fail("Child died with status %d\n",
- WEXITSTATUS(status));
- terminate();
- }
+ check_wait_status(status);
return;
}
diff --git a/tests/custom-urls.c b/tests/custom-urls.c
index 41e4bc0234..0827d3c2d8 100644
--- a/tests/custom-urls.c
+++ b/tests/custom-urls.c
@@ -264,15 +264,7 @@ static void ch_handler(int sig)
{
int status;
wait(&status);
- if (WEXITSTATUS(status) != 0 ||
- (WIFSIGNALED(status) && WTERMSIG(status) == SIGSEGV)) {
- if (WIFSIGNALED(status))
- fail("Child died with sigsegv\n");
- else
- fail("Child died with status %d\n",
- WEXITSTATUS(status));
- terminate();
- }
+ check_wait_status(status);
return;
}
diff --git a/tests/dtls-client-with-seccomp.c b/tests/dtls-client-with-seccomp.c
index bc21e90ae9..45d7f29899 100644
--- a/tests/dtls-client-with-seccomp.c
+++ b/tests/dtls-client-with-seccomp.c
@@ -293,9 +293,7 @@ void doit(void)
server(fd[0]);
wait(&status);
- if (WEXITSTATUS(status) != 0)
- fail("Child died with status %d\n",
- WEXITSTATUS(status));
+ check_wait_status(status);
} else {
close(fd[0]);
client(fd[1]);
diff --git a/tests/dtls-rehandshake-anon.c b/tests/dtls-rehandshake-anon.c
index 9e4717813a..bef4f30643 100644
--- a/tests/dtls-rehandshake-anon.c
+++ b/tests/dtls-rehandshake-anon.c
@@ -365,9 +365,7 @@ static void start(int server_initiated)
server(fd[0], server_initiated);
wait(&status);
- if (WEXITSTATUS(status) != 0)
- fail("Child died with status %d\n",
- WEXITSTATUS(status));
+ check_wait_status(status);
} else {
close(fd[0]);
client(fd[1], server_initiated);
diff --git a/tests/dtls-rehandshake-cert-2.c b/tests/dtls-rehandshake-cert-2.c
index 3ce366f5c0..039b79c178 100644
--- a/tests/dtls-rehandshake-cert-2.c
+++ b/tests/dtls-rehandshake-cert-2.c
@@ -380,9 +380,7 @@ static void start(int server_initiated)
server(fd[0], server_initiated);
wait(&status);
- if (WEXITSTATUS(status) != 0)
- fail("Child died with status %d\n",
- WEXITSTATUS(status));
+ check_wait_status(status);
} else {
close(fd[0]);
client(fd[1], server_initiated);
diff --git a/tests/dtls-rehandshake-cert-3.c b/tests/dtls-rehandshake-cert-3.c
index 4021155b4b..d1c0399890 100644
--- a/tests/dtls-rehandshake-cert-3.c
+++ b/tests/dtls-rehandshake-cert-3.c
@@ -373,9 +373,7 @@ void doit(void)
server_fd = fd[0];
server(fd[0]);
wait(&status);
- if (WEXITSTATUS(status) != 0)
- fail("Child died with status %d\n",
- WEXITSTATUS(status));
+ check_wait_status(status);
} else {
close(fd[0]);
client(fd[1]);
diff --git a/tests/dtls-rehandshake-cert.c b/tests/dtls-rehandshake-cert.c
index c0b90702e2..b12b792669 100644
--- a/tests/dtls-rehandshake-cert.c
+++ b/tests/dtls-rehandshake-cert.c
@@ -369,9 +369,7 @@ static void start(int server_initiated)
server(fd[0], server_initiated);
wait(&status);
- if (WEXITSTATUS(status) != 0)
- fail("Child died with status %d\n",
- WEXITSTATUS(status));
+ check_wait_status(status);
} else {
close(fd[0]);
client(fd[1], server_initiated);
diff --git a/tests/dtls-with-seccomp.c b/tests/dtls-with-seccomp.c
index b71c813a8b..161e105b32 100644
--- a/tests/dtls-with-seccomp.c
+++ b/tests/dtls-with-seccomp.c
@@ -293,9 +293,7 @@ void doit(void)
client(fd[1]);
wait(&status);
- if (WEXITSTATUS(status) != 0)
- fail("Child died with status %d\n",
- WEXITSTATUS(status));
+ check_wait_status(status);
} else {
close(fd[1]);
server(fd[0]);
diff --git a/tests/fallback-scsv.c b/tests/fallback-scsv.c
index 80b918c6b1..0774e403c2 100644
--- a/tests/fallback-scsv.c
+++ b/tests/fallback-scsv.c
@@ -324,14 +324,7 @@ static void start(const char *server_prio, const char *cli_prio, unsigned expect
close(fd[1]);
server(fd[0], server_prio, expect_fail);
waitpid(child, &status, 0);
- if (WEXITSTATUS(status) != 0 ||
- (WIFSIGNALED(status) && WTERMSIG(status) == SIGSEGV)) {
- if (WIFSIGNALED(status))
- fail("Child died with sigsegv\n");
- else
- fail("Child died with status %d\n",
- WEXITSTATUS(status));
- }
+ check_wait_status(status);
} else {
close(fd[0]);
client(fd[1], cli_prio, expect_fail);
diff --git a/tests/key-material-dtls.c b/tests/key-material-dtls.c
index 0d9334d1a1..f7660a49e1 100644
--- a/tests/key-material-dtls.c
+++ b/tests/key-material-dtls.c
@@ -387,9 +387,7 @@ static void start(void)
server(fd[0]);
wait(&status);
- if (WEXITSTATUS(status) != 0)
- fail("Child died with status %d\n",
- WEXITSTATUS(status));
+ check_wait_status(status);
} else {
close(fd[0]);
client(fd[1]);
diff --git a/tests/key-material-set-dtls.c b/tests/key-material-set-dtls.c
index fb568afc61..5c46a6a127 100644
--- a/tests/key-material-set-dtls.c
+++ b/tests/key-material-set-dtls.c
@@ -373,9 +373,7 @@ static void start(void)
server(fd[0]);
wait(&status);
- if (WEXITSTATUS(status) != 0)
- fail("Child died with status %d\n",
- WEXITSTATUS(status));
+ check_wait_status(status);
} else {
close(fd[0]);
client(fd[1]);
diff --git a/tests/long-session-id.c b/tests/long-session-id.c
index bacb3a18dc..b021b6e9df 100644
--- a/tests/long-session-id.c
+++ b/tests/long-session-id.c
@@ -246,17 +246,7 @@ static void ch_handler(int sig)
{
int status, ret = 0;
wait(&status);
- if (WEXITSTATUS(status) != 0 ||
- (WIFSIGNALED(status) && WTERMSIG(status) == SIGSEGV)) {
- if (WIFSIGNALED(status)) {
- fprintf(stderr, "Child died with sigsegv\n");
- ret = 1;
- } else {
- fprintf(stderr, "Child died with status %d\n",
- WEXITSTATUS(status));
- }
- terminate(ret);
- }
+ check_wait_status(status);
return;
}
diff --git a/tests/mini-alpn.c b/tests/mini-alpn.c
index 6c74ce8438..304d0a171c 100644
--- a/tests/mini-alpn.c
+++ b/tests/mini-alpn.c
@@ -283,9 +283,7 @@ static void start(const char *p1, const char *p2)
server(fd[0], p1, p2);
wait(&status);
- if (WEXITSTATUS(status) != 0)
- fail("Child died with status %d\n",
- WEXITSTATUS(status));
+ check_wait_status(status);
} else {
close(fd[0]);
client(fd[1], "unknown/1.4", p2, p1);
diff --git a/tests/mini-cert-status.c b/tests/mini-cert-status.c
index e8702fffb6..e6be43f4b7 100644
--- a/tests/mini-cert-status.c
+++ b/tests/mini-cert-status.c
@@ -289,11 +289,7 @@ static void ch_handler(int sig)
int status = 0;
waitpid(-1, &status, 0);
- if (WEXITSTATUS(status) != 0 ||
- (WIFSIGNALED(status) && WTERMSIG(status) == SIGSEGV)) {
- if (WIFSIGNALED(status))
- fail("Child died with sigsegv\n");
- }
+ check_wait_status_for_sig(status);
return;
}
diff --git a/tests/mini-chain-unsorted.c b/tests/mini-chain-unsorted.c
index f9eb748d34..a16a673765 100644
--- a/tests/mini-chain-unsorted.c
+++ b/tests/mini-chain-unsorted.c
@@ -351,11 +351,7 @@ static void ch_handler(int sig)
int status = 0;
waitpid(-1, &status, 0);
- if (WEXITSTATUS(status) != 0 ||
- (WIFSIGNALED(status) && WTERMSIG(status) == SIGSEGV)) {
- if (WIFSIGNALED(status))
- fail("Child died with sigsegv\n");
- }
+ check_wait_status(status);
return;
}
diff --git a/tests/mini-dtls-discard.c b/tests/mini-dtls-discard.c
index 5ba24d96a6..4e5110be16 100644
--- a/tests/mini-dtls-discard.c
+++ b/tests/mini-dtls-discard.c
@@ -293,9 +293,7 @@ void doit(void)
server(fd[0]);
wait(&status);
- if (WEXITSTATUS(status) != 0)
- fail("Child died with status %d\n",
- WEXITSTATUS(status));
+ check_wait_status(status);
} else {
close(fd[0]);
client(fd[1]);
diff --git a/tests/mini-dtls-fork.c b/tests/mini-dtls-fork.c
index ec70f78231..16270de273 100644
--- a/tests/mini-dtls-fork.c
+++ b/tests/mini-dtls-fork.c
@@ -367,9 +367,7 @@ void run(unsigned do_fork)
close(fd[1]);
client(fd[0], do_fork);
wait(&status);
- if (WEXITSTATUS(status) != 0)
- fail("Child died with status %d\n",
- WEXITSTATUS(status));
+ check_wait_status(status);
} else {
close(fd[0]);
server(fd[1], 1-do_fork);
diff --git a/tests/mini-dtls-heartbeat.c b/tests/mini-dtls-heartbeat.c
index 1fea6b65df..927708593b 100644
--- a/tests/mini-dtls-heartbeat.c
+++ b/tests/mini-dtls-heartbeat.c
@@ -331,9 +331,7 @@ static void start(int server_initiated)
server(fd[0], server_initiated);
wait(&status);
- if (WEXITSTATUS(status) != 0)
- fail("Child died with status %d\n",
- WEXITSTATUS(status));
+ check_wait_status(status);
} else {
close(fd[0]);
client(fd[1], server_initiated);
diff --git a/tests/mini-dtls-hello-verify-48.c b/tests/mini-dtls-hello-verify-48.c
index ef4a876ed2..10516395df 100644
--- a/tests/mini-dtls-hello-verify-48.c
+++ b/tests/mini-dtls-hello-verify-48.c
@@ -300,9 +300,7 @@ void doit(void)
client(fd[0]);
wait(&status);
- if (WEXITSTATUS(status) != 0)
- fail("Server died with status %d\n",
- WEXITSTATUS(status));
+ check_wait_status(status);
} else {
close(fd[0]);
server(fd[1]);
diff --git a/tests/mini-dtls-hello-verify.c b/tests/mini-dtls-hello-verify.c
index c5e3d96993..180e26c906 100644
--- a/tests/mini-dtls-hello-verify.c
+++ b/tests/mini-dtls-hello-verify.c
@@ -337,9 +337,7 @@ void doit(void)
server(fd[0]);
wait(&status);
- if (WEXITSTATUS(status) != 0)
- fail("Child died with status %d\n",
- WEXITSTATUS(status));
+ check_wait_status(status);
} else {
close(fd[0]);
client(fd[1]);
diff --git a/tests/mini-dtls-large.c b/tests/mini-dtls-large.c
index 9ce749e066..da32f4e8ab 100644
--- a/tests/mini-dtls-large.c
+++ b/tests/mini-dtls-large.c
@@ -337,9 +337,7 @@ static void start(void)
server(fd[0]);
wait(&status);
- if (WEXITSTATUS(status) != 0)
- fail("Child died with status %d\n",
- WEXITSTATUS(status));
+ check_wait_status(status);
} else {
close(fd[0]);
client(fd[1]);
diff --git a/tests/mini-dtls-lowmtu.c b/tests/mini-dtls-lowmtu.c
index 9077d30e01..93a645f6f5 100644
--- a/tests/mini-dtls-lowmtu.c
+++ b/tests/mini-dtls-lowmtu.c
@@ -325,15 +325,7 @@ static void ch_handler(int sig)
{
int status;
wait(&status);
- if (WEXITSTATUS(status) != 0 ||
- (WIFSIGNALED(status) && WTERMSIG(status) == SIGSEGV)) {
- if (WIFSIGNALED(status))
- fail("Child died with sigsegv\n");
- else
- fail("Child died with status %d\n",
- WEXITSTATUS(status));
- terminate();
- }
+ check_wait_status(status);
return;
}
diff --git a/tests/mini-dtls-mtu.c b/tests/mini-dtls-mtu.c
index 6f52e336b8..dda02a1d44 100644
--- a/tests/mini-dtls-mtu.c
+++ b/tests/mini-dtls-mtu.c
@@ -309,9 +309,7 @@ void doit(void)
close(fd[0]);
server(fd[1]);
wait(&status);
- if (WEXITSTATUS(status) != 0)
- fail("Child died with status %d\n",
- WEXITSTATUS(status));
+ check_wait_status(status);
} else {
close(fd[1]);
client(fd[0]);
diff --git a/tests/mini-dtls-pthread.c b/tests/mini-dtls-pthread.c
index 64cbba50f5..77012553bc 100644
--- a/tests/mini-dtls-pthread.c
+++ b/tests/mini-dtls-pthread.c
@@ -376,9 +376,7 @@ void run(unsigned do_thread)
close(fd[1]);
client(fd[0], do_thread);
wait(&status);
- if (WEXITSTATUS(status) != 0)
- fail("Child died with status %d\n",
- WEXITSTATUS(status));
+ check_wait_status(status);
} else {
close(fd[0]);
server(fd[1], 1-do_thread);
diff --git a/tests/mini-dtls-record-asym.c b/tests/mini-dtls-record-asym.c
index 9087dc5299..9ace1a533a 100644
--- a/tests/mini-dtls-record-asym.c
+++ b/tests/mini-dtls-record-asym.c
@@ -336,9 +336,7 @@ void run(unsigned cache)
close(fd[1]);
client(fd[0], cache);
wait(&status);
- if (WEXITSTATUS(status) != 0)
- fail("Child died with status %d\n",
- WEXITSTATUS(status));
+ check_wait_status(status);
} else {
close(fd[0]);
server(fd[1], cache);
diff --git a/tests/mini-dtls-record.c b/tests/mini-dtls-record.c
index 60c0fed6ac..1b5a0551e8 100644
--- a/tests/mini-dtls-record.c
+++ b/tests/mini-dtls-record.c
@@ -387,9 +387,7 @@ static void start(void)
close(fd[1]);
server(fd[0]);
wait(&status);
- if (WEXITSTATUS(status) != 0)
- fail("Child died with status %d\n",
- WEXITSTATUS(status));
+ check_wait_status(status);
} else {
close(fd[0]);
client(fd[1]);
diff --git a/tests/mini-dtls-srtp.c b/tests/mini-dtls-srtp.c
index 07e624e2af..93c06820f8 100644
--- a/tests/mini-dtls-srtp.c
+++ b/tests/mini-dtls-srtp.c
@@ -323,9 +323,7 @@ static void start(int profile)
server(fd[0], profile);
wait(&status);
- if (WEXITSTATUS(status) != 0)
- fail("Child died with status %d\n",
- WEXITSTATUS(status));
+ check_wait_status(status);
} else {
close(fd[0]);
client(fd[1], profile);
diff --git a/tests/mini-dtls0-9.c b/tests/mini-dtls0-9.c
index 11f98e2ed3..852d03ff6b 100644
--- a/tests/mini-dtls0-9.c
+++ b/tests/mini-dtls0-9.c
@@ -305,9 +305,7 @@ static void run(int proto, int cipher, int mac)
close(fd[1]);
server(fd[0], proto, cipher, mac);
wait(&status);
- if (WEXITSTATUS(status) != 0)
- fail("Child died with status %d\n",
- WEXITSTATUS(status));
+ check_wait_status(status);
close(fd[0]);
} else {
close(fd[0]);
diff --git a/tests/mini-etm.c b/tests/mini-etm.c
index 72051cd08f..daccb826c8 100644
--- a/tests/mini-etm.c
+++ b/tests/mini-etm.c
@@ -369,15 +369,7 @@ static void ch_handler(int sig)
{
int status;
wait(&status);
- if (WEXITSTATUS(status) != 0 ||
- (WIFSIGNALED(status) && WTERMSIG(status) == SIGSEGV)) {
- if (WIFSIGNALED(status))
- fail("Child died with sigsegv\n");
- else
- fail("Child died with status %d\n",
- WEXITSTATUS(status));
- terminate();
- }
+ check_wait_status(status);
return;
}
diff --git a/tests/mini-handshake-timeout.c b/tests/mini-handshake-timeout.c
index 488867417b..d3a1233888 100644
--- a/tests/mini-handshake-timeout.c
+++ b/tests/mini-handshake-timeout.c
@@ -215,8 +215,7 @@ static void ch_handler(int sig)
{
int status = 0;
wait(&status);
- if (WEXITSTATUS(status) != 0)
- fail("Child died with status %d\n", WEXITSTATUS(status));
+ check_wait_status(status);
return;
}
diff --git a/tests/mini-key-material.c b/tests/mini-key-material.c
index ddd64de8fd..15c79f0ef6 100644
--- a/tests/mini-key-material.c
+++ b/tests/mini-key-material.c
@@ -395,9 +395,7 @@ static void start(void)
server(fd[0]);
wait(&status);
- if (WEXITSTATUS(status) != 0)
- fail("Child died with status %d\n",
- WEXITSTATUS(status));
+ check_wait_status(status);
} else {
close(fd[0]);
client(fd[1]);
diff --git a/tests/mini-loss-time.c b/tests/mini-loss-time.c
index 2c106b4273..4883b69bcd 100644
--- a/tests/mini-loss-time.c
+++ b/tests/mini-loss-time.c
@@ -283,8 +283,7 @@ static void ch_handler(int sig)
{
int status = 0;
wait(&status);
- if (WEXITSTATUS(status) != 0)
- fail("Child died with status %d\n", WEXITSTATUS(status));
+ check_wait_status(status);
return;
}
diff --git a/tests/mini-overhead.c b/tests/mini-overhead.c
index 43073d976a..3887caeb1a 100644
--- a/tests/mini-overhead.c
+++ b/tests/mini-overhead.c
@@ -311,15 +311,7 @@ static void ch_handler(int sig)
int status = 0;
waitpid(-1, &status, 0);
- if (WEXITSTATUS(status) != 0 ||
- (WIFSIGNALED(status) && WTERMSIG(status) == SIGSEGV)) {
- if (WIFSIGNALED(status))
- fail("Child died with sigsegv\n");
- else
- fail("Child died with status %d\n",
- WEXITSTATUS(status));
- terminate();
- }
+ check_wait_status(status);
return;
}
diff --git a/tests/mini-record-2.c b/tests/mini-record-2.c
index e36b2121a6..c6abe0951e 100644
--- a/tests/mini-record-2.c
+++ b/tests/mini-record-2.c
@@ -432,15 +432,7 @@ static void ch_handler(int sig)
{
int status;
wait(&status);
- if (WEXITSTATUS(status) != 0 ||
- (WIFSIGNALED(status) && WTERMSIG(status) == SIGSEGV)) {
- if (WIFSIGNALED(status))
- fail("Child died with sigsegv\n");
- else
- fail("Child died with status %d\n",
- WEXITSTATUS(status));
- terminate();
- }
+ check_wait_status(status);
return;
}
diff --git a/tests/mini-record-failure.c b/tests/mini-record-failure.c
index 02ce346295..9f70ce3055 100644
--- a/tests/mini-record-failure.c
+++ b/tests/mini-record-failure.c
@@ -366,15 +366,7 @@ static void ch_handler(int sig)
{
int status;
wait(&status);
- if (WEXITSTATUS(status) != 0 ||
- (WIFSIGNALED(status) && WTERMSIG(status) == SIGSEGV)) {
- if (WIFSIGNALED(status))
- fail("Child died with sigsegv\n");
- else
- fail("Child died with status %d\n",
- WEXITSTATUS(status));
- terminate();
- }
+ check_wait_status(status);
return;
}
diff --git a/tests/mini-record-range.c b/tests/mini-record-range.c
index f1d56e8e0f..638e0b722b 100644
--- a/tests/mini-record-range.c
+++ b/tests/mini-record-range.c
@@ -364,15 +364,7 @@ static void ch_handler(int sig)
{
int status;
wait(&status);
- if (WEXITSTATUS(status) != 0 ||
- (WIFSIGNALED(status) && WTERMSIG(status) == SIGSEGV)) {
- if (WIFSIGNALED(status))
- fail("Child died with sigsegv\n");
- else
- fail("Child died with status %d\n",
- WEXITSTATUS(status));
- terminate();
- }
+ check_wait_status(status);
return;
}
diff --git a/tests/mini-record-retvals.c b/tests/mini-record-retvals.c
index 9ae8c3f3ea..6355de0e49 100644
--- a/tests/mini-record-retvals.c
+++ b/tests/mini-record-retvals.c
@@ -438,15 +438,7 @@ static void ch_handler(int sig)
{
int status = 0;
wait(&status);
- if (WEXITSTATUS(status) != 0 ||
- (WIFSIGNALED(status) && WTERMSIG(status) == SIGSEGV)) {
- if (WIFSIGNALED(status))
- fail("Child died with sigsegv\n");
- else
- fail("Child died with status %d\n",
- WEXITSTATUS(status));
- terminate();
- }
+ check_wait_status(status);
return;
}
diff --git a/tests/mini-record.c b/tests/mini-record.c
index 13883e0000..dcf8dfc7e4 100644
--- a/tests/mini-record.c
+++ b/tests/mini-record.c
@@ -399,15 +399,7 @@ static void ch_handler(int sig)
{
int status;
wait(&status);
- if (WEXITSTATUS(status) != 0 ||
- (WIFSIGNALED(status) && WTERMSIG(status) == SIGSEGV)) {
- if (WIFSIGNALED(status))
- fail("Child died with sigsegv\n");
- else
- fail("Child died with status %d\n",
- WEXITSTATUS(status));
- terminate();
- }
+ check_wait_status(status);
return;
}
diff --git a/tests/mini-server-name.c b/tests/mini-server-name.c
index 42927d0130..bfd46d5e62 100644
--- a/tests/mini-server-name.c
+++ b/tests/mini-server-name.c
@@ -328,15 +328,7 @@ static void ch_handler(int sig)
{
int status;
wait(&status);
- if (WEXITSTATUS(status) != 0 ||
- (WIFSIGNALED(status) && WTERMSIG(status) == SIGSEGV)) {
- if (WIFSIGNALED(status))
- fail("Child died with sigsegv\n");
- else
- fail("Child died with status %d\n",
- WEXITSTATUS(status));
- terminate();
- }
+ check_wait_status(status);
return;
}
diff --git a/tests/mini-termination.c b/tests/mini-termination.c
index fdce76f9f1..f5a884c25c 100644
--- a/tests/mini-termination.c
+++ b/tests/mini-termination.c
@@ -316,15 +316,7 @@ static void ch_handler(int sig)
int status = 0;
waitpid(-1, &status, 0);
- if (WEXITSTATUS(status) != 0 ||
- (WIFSIGNALED(status) && WTERMSIG(status) == SIGSEGV)) {
- if (WIFSIGNALED(status))
- fail("Child died with sigsegv\n");
- else
- fail("Child died with status %d\n",
- WEXITSTATUS(status));
- terminate();
- }
+ check_wait_status(status);
return;
}
diff --git a/tests/mini-tls-nonblock.c b/tests/mini-tls-nonblock.c
index 2d47c27d68..01cc8db12f 100644
--- a/tests/mini-tls-nonblock.c
+++ b/tests/mini-tls-nonblock.c
@@ -328,15 +328,7 @@ static void ch_handler(int sig)
int status = 0;
waitpid(-1, &status, 0);
- if (WEXITSTATUS(status) != 0 ||
- (WIFSIGNALED(status) && WTERMSIG(status) == SIGSEGV)) {
- if (WIFSIGNALED(status))
- fail("Child died with sigsegv\n");
- else
- fail("Child died with status %d\n",
- WEXITSTATUS(status));
- terminate();
- }
+ check_wait_status(status);
return;
}
diff --git a/tests/no-signal.c b/tests/no-signal.c
index 2fe2927368..0894632c8d 100644
--- a/tests/no-signal.c
+++ b/tests/no-signal.c
@@ -228,8 +228,7 @@ static void ch_handler(int sig)
{
int status = 0;
wait(&status);
- if (WEXITSTATUS(status) != 0)
- fail("Child died with status %d\n", WEXITSTATUS(status));
+ check_wait_status(status);
return;
}
diff --git a/tests/openpgp-auth.c b/tests/openpgp-auth.c
index bc79c223f2..1836f0777c 100644
--- a/tests/openpgp-auth.c
+++ b/tests/openpgp-auth.c
@@ -350,14 +350,7 @@ void doit(void)
if (done != child)
fail("who's that?! %d\n", done);
- if (WIFEXITED(status)) {
- if (WEXITSTATUS(status) != 0)
- fail("child exited with status %d\n", WEXITSTATUS(status));
- } else if (WIFSIGNALED(status))
- fail("child stopped by signal %d\n",
- WTERMSIG(status));
- else
- fail("child failed: %d\n", status);
+ check_wait_status(status);
}
}
diff --git a/tests/openpgp-auth2.c b/tests/openpgp-auth2.c
index 11fb6d578b..5cfcac6b7e 100644
--- a/tests/openpgp-auth2.c
+++ b/tests/openpgp-auth2.c
@@ -254,15 +254,7 @@ void doit(void)
if (done != child)
fail("who's that?! %d\n", done);
- if (WIFEXITED(status)) {
- if (WEXITSTATUS(status) != 0)
- fail("child exited with status %d\n",
- WEXITSTATUS(status));
- } else if (WIFSIGNALED(status))
- fail("child stopped by signal %d\n",
- WTERMSIG(status));
- else
- fail("child failed: %d\n", status);
+ check_wait_status(status);
}
gnutls_global_deinit();
diff --git a/tests/openpgp-callback.c b/tests/openpgp-callback.c
index d93c283d3d..c3f2c4cb17 100644
--- a/tests/openpgp-callback.c
+++ b/tests/openpgp-callback.c
@@ -467,20 +467,7 @@ void doit(void)
/* parent */
client(sockets[0]);
wait(&status);
-
-#if defined WIFEXITED && defined WEXITSTATUS
- if (WIFEXITED(status) && WEXITSTATUS(status)) {
- fail("server: client failed with exit status %d\n",
- WEXITSTATUS(status));
- }
-#endif
-
-#if defined WIFSIGNALED && defined WTERMSIG
- if (WIFSIGNALED(status)) {
- fail("server: client failed with fatal signal %d\n", WTERMSIG(status));
- }
-#endif
-
+ check_wait_status(status);
} else
server(sockets[1]);
}
diff --git a/tests/prf.c b/tests/prf.c
index d93bfaa737..5be9d420ca 100644
--- a/tests/prf.c
+++ b/tests/prf.c
@@ -442,9 +442,7 @@ static void start(void)
server(fd[0]);
wait(&status);
- if (WEXITSTATUS(status) != 0)
- fail("Child died with status %d\n",
- WEXITSTATUS(status));
+ check_wait_status(status);
} else {
close(fd[0]);
client(fd[1]);
diff --git a/tests/resume-dtls.c b/tests/resume-dtls.c
index be70795f26..df818ae3dd 100644
--- a/tests/resume-dtls.c
+++ b/tests/resume-dtls.c
@@ -413,8 +413,7 @@ void doit(void)
close(client_sds[j]);
server(server_sds, &resume_tests[i]);
wait(&status);
- if (WEXITSTATUS(status) != 0 || (WIFSIGNALED(status) && WTERMSIG(status) == SIGSEGV))
- exit(1);
+ check_wait_status(status);
} else {
for (j = 0; j < SESSIONS; j++)
close(server_sds[j]);
diff --git a/tests/resume.c b/tests/resume.c
index ed4f8aa6d2..21455a4f2d 100644
--- a/tests/resume.c
+++ b/tests/resume.c
@@ -693,8 +693,7 @@ void doit(void)
server(server_sds, &resume_tests[i]);
waitpid(child, &status, 0);
- if (WEXITSTATUS(status) != 0 || (WIFSIGNALED(status) && WTERMSIG(status) == SIGSEGV))
- exit(1);
+ check_wait_status(status);
global_stop();
} else {
for (j = 0; j < SESSIONS; j++)
diff --git a/tests/sign-md5-rep.c b/tests/sign-md5-rep.c
index c72d8a11a9..b14d996d8d 100644
--- a/tests/sign-md5-rep.c
+++ b/tests/sign-md5-rep.c
@@ -295,15 +295,7 @@ static void ch_handler(int sig)
{
int status;
wait(&status);
- if (WEXITSTATUS(status) != 0 ||
- (WIFSIGNALED(status) && WTERMSIG(status) == SIGSEGV)) {
- if (WIFSIGNALED(status))
- fail("Child died with sigsegv\n");
- else
- fail("Child died with status %d\n",
- WEXITSTATUS(status));
- terminate();
- }
+ check_wait_status(status);
return;
}
diff --git a/tests/srp.c b/tests/srp.c
index 35b42e0631..753e0037e8 100644
--- a/tests/srp.c
+++ b/tests/srp.c
@@ -289,9 +289,7 @@ static void start(const char *prio)
/* parent */
server(fd[0], prio);
wait(&status);
- if (WEXITSTATUS(status) != 0)
- fail("Child died with status %d\n",
- WEXITSTATUS(status));
+ check_wait_status(status);
} else {
client(fd[1], prio);
exit(0);
diff --git a/tests/status-request-missing.c b/tests/status-request-missing.c
index 7ae56eda1e..f55f3ac469 100644
--- a/tests/status-request-missing.c
+++ b/tests/status-request-missing.c
@@ -333,15 +333,7 @@ void doit(void)
close(fd[1]);
client(fd[0]);
waitpid(child, &status, 0);
-
- if (WEXITSTATUS(status) != 0 ||
- (WIFSIGNALED(status) && WTERMSIG(status) == SIGSEGV)) {
- if (WIFSIGNALED(status))
- fail("Child died with sigsegv\n");
- else
- fail("Child died with status %d\n",
- WEXITSTATUS(status));
- }
+ check_wait_status(status);
} else {
close(fd[0]);
server(fd[1]);
diff --git a/tests/status-request-ok.c b/tests/status-request-ok.c
index 293671dd71..50a4a9d4b7 100644
--- a/tests/status-request-ok.c
+++ b/tests/status-request-ok.c
@@ -324,15 +324,7 @@ void doit(void)
close(fd[1]);
client(fd[0]);
waitpid(child, &status, 0);
-
- if (WEXITSTATUS(status) != 0 ||
- (WIFSIGNALED(status) && WTERMSIG(status) == SIGSEGV)) {
- if (WIFSIGNALED(status))
- fail("Child died with sigsegv\n");
- else
- fail("Child died with status %d\n",
- WEXITSTATUS(status));
- }
+ check_wait_status(status);
} else {
close(fd[0]);
server(fd[1]);
diff --git a/tests/status-request.c b/tests/status-request.c
index 8a4f2691d4..a9cf79ab28 100644
--- a/tests/status-request.c
+++ b/tests/status-request.c
@@ -329,14 +329,7 @@ void doit(void)
close(fd[1]);
client(fd[0]);
waitpid(child, &status, 0);
- if (WEXITSTATUS(status) != 0 ||
- (WIFSIGNALED(status) && WTERMSIG(status) == SIGSEGV)) {
- if (WIFSIGNALED(status))
- fail("Child died with sigsegv\n");
- else
- fail("Child died with status %d\n",
- WEXITSTATUS(status));
- }
+ check_wait_status(status);
} else {
close(fd[0]);
server(fd[1]);
diff --git a/tests/tls-client-with-seccomp.c b/tests/tls-client-with-seccomp.c
index 6fe355e8c0..6a0af66b62 100644
--- a/tests/tls-client-with-seccomp.c
+++ b/tests/tls-client-with-seccomp.c
@@ -280,9 +280,7 @@ void doit(void)
server(fd[0]);
wait(&status);
- if (WEXITSTATUS(status) != 0)
- fail("Child died with status %d\n",
- WEXITSTATUS(status));
+ check_wait_status(status);
} else {
close(fd[0]);
client(fd[1]);
diff --git a/tests/tls-rehandshake-cert-2.c b/tests/tls-rehandshake-cert-2.c
index ca298d611f..c352a11acb 100644
--- a/tests/tls-rehandshake-cert-2.c
+++ b/tests/tls-rehandshake-cert-2.c
@@ -430,15 +430,7 @@ static void ch_handler(int sig)
{
int status = 0;
wait(&status);
- if (WEXITSTATUS(status) != 0 ||
- (WIFSIGNALED(status) && WTERMSIG(status) == SIGSEGV)) {
- if (WIFSIGNALED(status))
- fail("Child died with sigsegv\n");
- else
- fail("Child died with status %d\n",
- WEXITSTATUS(status));
- terminate();
- }
+ check_wait_status(status);
return;
}
diff --git a/tests/tls-with-seccomp.c b/tests/tls-with-seccomp.c
index 6a2f7c8abc..de725e4edd 100644
--- a/tests/tls-with-seccomp.c
+++ b/tests/tls-with-seccomp.c
@@ -281,9 +281,7 @@ void doit(void)
client(fd[1]);
wait(&status);
- if (WEXITSTATUS(status) != 0)
- fail("Child died with status %d\n",
- WEXITSTATUS(status));
+ check_wait_status(status);
} else {
close(fd[1]);
server(fd[0]);
diff --git a/tests/tlsext-decoding.c b/tests/tlsext-decoding.c
index 66ddb469e9..bbee3d3bae 100644
--- a/tests/tlsext-decoding.c
+++ b/tests/tlsext-decoding.c
@@ -266,9 +266,7 @@ static void start(void)
server(fd[1]);
wait(&status);
- if (WEXITSTATUS(status) != 0)
- fail("Child died with status %d\n",
- WEXITSTATUS(status));
+ check_wait_status(status);
close(fd[1]);
} else {
close(fd[1]);
diff --git a/tests/utils.h b/tests/utils.h
index fbd6b7a160..7606a6dbb8 100644
--- a/tests/utils.h
+++ b/tests/utils.h
@@ -72,11 +72,10 @@ void sec_sleep(int sec);
typedef void callback_func(gnutls_session_t, void *priv);
void test_cli_serv(gnutls_certificate_credentials_t server_cred,
- gnutls_certificate_credentials_t client_cred,
- const char *prio, const char *host,
- void *priv,
- callback_func *client_cb,
- callback_func *server_cb);
+ gnutls_certificate_credentials_t client_cred,
+ const char *prio, const char *host,
+ void *priv,
+ callback_func * client_cb, callback_func * server_cb);
#define TMPNAME_SIZE 128
char *get_tmpname(char s[TMPNAME_SIZE]);
@@ -84,4 +83,31 @@ char *get_tmpname(char s[TMPNAME_SIZE]);
/* This must be implemented elsewhere. */
extern void doit(void);
+/* calls fail() if status indicates an error */
+inline static void _check_wait_status(int status, unsigned sigonly)
+{
+#if defined WEXITSTATUS && defined WIFSIGNALED
+ if (WEXITSTATUS(status) != 0 ||
+ (WIFSIGNALED(status) && WTERMSIG(status) == SIGSEGV)) {
+ if (WIFSIGNALED(status)) {
+ fail("Child died with signal %d\n", WTERMSIG(status));
+ } else {
+ if (!sigonly)
+ fail("Child died with status %d\n",
+ WEXITSTATUS(status));
+ }
+ }
+#endif
+}
+
+inline static void check_wait_status(int status)
+{
+ _check_wait_status(status, 0);
+}
+
+inline static void check_wait_status_for_sig(int status)
+{
+ _check_wait_status(status, 1);
+}
+
#endif /* UTILS_H */
diff --git a/tests/x509dn.c b/tests/x509dn.c
index 3eb1e29cb8..f9b5a7be6d 100644
--- a/tests/x509dn.c
+++ b/tests/x509dn.c
@@ -391,20 +391,7 @@ void doit(void)
close(sockets[1]);
server(sockets[0]);
wait(&status);
-
-#if defined WIFEXITED && defined WEXITSTATUS
- if (WIFEXITED(status) && WEXITSTATUS(status)) {
- fail("server: client failed with exit status %d\n",
- WEXITSTATUS(status));
- }
-#endif
-
-#if defined WIFSIGNALED && defined WTERMSIG
- if (WIFSIGNALED(status)) {
- fail("server: client failed with fatal signal %d\n", WTERMSIG(status));
- }
-#endif
-
+ check_wait_status(status);
} else {
close(sockets[0]);
client(sockets[1]);