From b736a05c567d3ea4868b8e192de839124e55e00b Mon Sep 17 00:00:00 2001 From: "Dmitry V. Levin" Date: Wed, 6 Jan 2016 11:38:05 +0000 Subject: [PATCH] tests/pipe.c: use libtests * tests/pipe.c: Use SKIP_MAIN_UNDEFINED. (main): Use perror_msg_and_fail and perror_msg_and_skip. --- tests/pipe.c | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) 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 -} -- 2.40.0