From: Dmitry V. Levin Date: Tue, 5 Jan 2016 23:03:26 +0000 (+0000) Subject: tests/net-accept-connect.c: use libtests X-Git-Tag: v4.12~736 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2f5786c0fc9d1c9e99d1a1160a149b4325bcd1f9;p=strace tests/net-accept-connect.c: use libtests * tests/net-accept-connect.c (main): Use perror_msg_and_skip and perror_msg_and_fail. --- diff --git a/tests/net-accept-connect.c b/tests/net-accept-connect.c index 74419fac..da7532f0 100644 --- a/tests/net-accept-connect.c +++ b/tests/net-accept-connect.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2015 Dmitry V. Levin + * Copyright (c) 2013-2016 Dmitry V. Levin * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -25,6 +25,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#include "tests.h" #include #include #include @@ -61,9 +62,12 @@ main(int ac, const char **av) close(0); close(1); - assert(socket(PF_LOCAL, SOCK_STREAM, 0) == 0); - assert(bind(0, (struct sockaddr *) &addr, len) == 0); - assert(listen(0, 5) == 0); + if (socket(PF_LOCAL, SOCK_STREAM, 0)) + perror_msg_and_skip("socket"); + if (bind(0, (struct sockaddr *) &addr, len)) + perror_msg_and_skip("bind"); + if (listen(0, 5)) + perror_msg_and_skip("listen"); memset(&addr, 0, sizeof addr); assert(getsockname(0, (struct sockaddr *) &addr, &len) == 0); @@ -71,7 +75,8 @@ main(int ac, const char **av) len = sizeof(addr); pid_t pid = fork(); - assert(pid >= 0); + if (pid < 0) + perror_msg_and_fail("fork"); if (pid) { assert(accept(0, (struct sockaddr *) &addr, &len) == 1);