]> granicus.if.org Git - strace/commitdiff
tests/wait.c: use libtests
authorDmitry V. Levin <ldv@altlinux.org>
Wed, 6 Jan 2016 11:23:21 +0000 (11:23 +0000)
committerDmitry V. Levin <ldv@altlinux.org>
Wed, 6 Jan 2016 11:25:00 +0000 (11:25 +0000)
* tests/wait.c (main): Use perror_msg_and_fail.

tests/wait.c

index 6fd62cce836e7d3360c4a58d979d1d797e820db7..b01b2be095155613207794af3aef422a874c369d 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015 Dmitry V. Levin <ldv@altlinux.org>
+ * Copyright (c) 2015-2016 Dmitry V. Levin <ldv@altlinux.org>
  * 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;