From: Dmitry V. Levin Date: Wed, 6 Jan 2016 11:38:05 +0000 (+0000) Subject: tests/pipe.c: use libtests X-Git-Tag: v4.12~699 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b736a05c567d3ea4868b8e192de839124e55e00b;p=strace tests/pipe.c: use libtests * tests/pipe.c: Use SKIP_MAIN_UNDEFINED. (main): Use perror_msg_and_fail and perror_msg_and_skip. --- diff --git a/tests/pipe.c b/tests/pipe.c index f7728434..68217f20 100644 --- a/tests/pipe.c +++ b/tests/pipe.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 @@ -26,9 +26,12 @@ */ #include "tests.h" -#include -#include -#include + +#ifdef HAVE_PIPE2 + +# include +# include +# include 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 -}