]> granicus.if.org Git - strace/commitdiff
tests/pipe.c: use libtests
authorDmitry V. Levin <ldv@altlinux.org>
Wed, 6 Jan 2016 11:38:05 +0000 (11:38 +0000)
committerDmitry V. Levin <ldv@altlinux.org>
Wed, 6 Jan 2016 11:38:05 +0000 (11:38 +0000)
* tests/pipe.c: Use SKIP_MAIN_UNDEFINED.
(main): Use perror_msg_and_fail and perror_msg_and_skip.

tests/pipe.c

index f7728434dc71c70c1d4096265faad4a66fb44aed..68217f208e47bb0e78da55ceaf461b1fe2833a07 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
  */
 
 #include "tests.h"
-#include <stdio.h>
-#include <fcntl.h>
-#include <unistd.h>
+
+#ifdef HAVE_PIPE2
+
+# include <stdio.h>
+# include <fcntl.h>
+# include <unistd.h>
 
 int
 main(void)
@@ -36,16 +39,19 @@ main(void)
        (void) close(0);
        (void) close(1);
        int fds[2];
-       if (pipe(fds) || fds[0] != 0 || fds[1] != 1)
-               return 77;
+       if (pipe(fds))
+               perror_msg_and_fail("pipe");
 
-#ifdef HAVE_PIPE2
        (void) close(0);
        (void) close(1);
-       if (pipe2(fds, O_NONBLOCK) || fds[0] != 0 || fds[1] != 1)
-               return 77;
+       if (pipe2(fds, O_NONBLOCK))
+               perror_msg_and_skip("pipe2");
+
        return 0;
+}
+
 #else
-       return 77;
+
+SKIP_MAIN_UNDEFINED("HAVE_PIPE2")
+
 #endif
-}