From: Dmitry V. Levin Date: Wed, 6 Jan 2016 11:23:21 +0000 (+0000) Subject: tests/wait.c: use libtests X-Git-Tag: v4.12~707 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2d161f5bad055226b6477f2732ac216070b526b0;p=strace tests/wait.c: use libtests * tests/wait.c (main): Use perror_msg_and_fail. --- diff --git a/tests/wait.c b/tests/wait.c index 6fd62cce..b01b2be0 100644 --- a/tests/wait.c +++ b/tests/wait.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 Dmitry V. Levin + * Copyright (c) 2015-2016 Dmitry V. Levin * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -43,10 +43,13 @@ main(void) (void) close(0); (void) close(1); - assert(!pipe(fds) && fds[0] == 0 && fds[1] == 1); + if (pipe(fds)) + perror_msg_and_fail("pipe"); pid = fork(); - assert(pid >= 0); + if (pid < 0) + perror_msg_and_fail("fork"); + if (!pid) { char c; (void) close(1); @@ -64,16 +67,20 @@ main(void) assert(WIFEXITED(s) && WEXITSTATUS(s) == 42); pid = fork(); - assert(pid >= 0); + if (pid < 0) + perror_msg_and_fail("fork"); + if (!pid) { (void) raise(SIGUSR1); - return 77; + return 1; } assert(wait4(pid, &s, __WALL, NULL) == pid); assert(WIFSIGNALED(s) && WTERMSIG(s) == SIGUSR1); pid = fork(); - assert(pid >= 0); + if (pid < 0) + perror_msg_and_fail("fork"); + if (!pid) { raise(SIGSTOP); return 0;