From: Dmitry V. Levin Date: Tue, 26 Jan 2016 22:03:22 +0000 (+0000) Subject: tests: replace net-yy.test with net-yy-inet.test X-Git-Tag: v4.12~610 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9d15ec7b5741227e8641ca383558e7aab52a7d02;p=strace tests: replace net-yy.test with net-yy-inet.test Unlike the former test that was based on match_awk, the new one uses match_diff and does more rigorous testing. * tests/net-yy-inet.c: New file. * tests/net-yy-inet.test: New test. * tests/net-yy.test: Remove. * tests/net-yy-accept.awk: Remove. * tests/net-yy-connect.awk: Remove. * tests/inet-accept-connect-send-recv.c: Remove. * tests/.gitignore: Replace inet-accept-connect-send-recv with net-yy-inet. * tests/Makefile.am (check_PROGRAMS): Likewise. (TESTS): Replace net-yy.test with net-yy-inet.test. (EXTRA_DIST): Remove net-yy-accept.awk and net-yy-connect.awk. --- diff --git a/tests/.gitignore b/tests/.gitignore index ad61dc4a..ffd6356d 100644 --- a/tests/.gitignore +++ b/tests/.gitignore @@ -33,7 +33,6 @@ getdents getdents64 getrandom getxxid -inet-accept-connect-send-recv inet-cmsg ioctl ip_mreq @@ -58,6 +57,7 @@ mmsg mq nanosleep net-accept-connect +net-yy-inet net-yy-unix netlink_inet_diag netlink_unix_diag diff --git a/tests/Makefile.am b/tests/Makefile.am index fa884819..af8f7c96 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -82,7 +82,6 @@ check_PROGRAMS = \ getdents64 \ getrandom \ getxxid \ - inet-accept-connect-send-recv \ inet-cmsg \ ioctl \ ip_mreq \ @@ -105,6 +104,7 @@ check_PROGRAMS = \ mq \ nanosleep \ net-accept-connect \ + net-yy-inet \ net-yy-unix \ netlink_inet_diag \ netlink_unix_diag \ @@ -246,7 +246,7 @@ TESTS = \ mq.test \ nanosleep.test \ net-fd.test \ - net-yy.test \ + net-yy-inet.test \ net-yy-unix.test \ net.test \ newfstatat.test \ @@ -343,8 +343,6 @@ EXTRA_DIST = init.sh run.sh match.awk \ mq.expected \ net.expected \ net-fd.expected \ - net-yy-accept.awk \ - net-yy-connect.awk \ oldselect.expected \ pipe.expected \ ppoll.expected \ diff --git a/tests/inet-accept-connect-send-recv.c b/tests/inet-accept-connect-send-recv.c deleted file mode 100644 index 334aeb7b..00000000 --- a/tests/inet-accept-connect-send-recv.c +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright (c) 2014-2016 Dmitry V. Levin - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "tests.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include - -int main(void) -{ - static const char data[] = "data"; - const size_t size = sizeof(data) - 1; - struct sockaddr_in addr; - socklen_t len = sizeof(addr); - pid_t pid; - - memset(&addr, 0, sizeof(addr)); - addr.sin_family = AF_INET; - addr.sin_addr.s_addr = htonl(INADDR_LOOPBACK); - - close(0); - close(1); - - if (socket(PF_INET, 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); - - pid = fork(); - if (pid < 0) - perror_msg_and_fail("fork"); - - if (pid) { - char buf[sizeof(data)]; - int status; - - assert(accept(0, (struct sockaddr *) &addr, &len) == 1); - assert(close(0) == 0); - assert(recv(1, buf, sizeof(buf), MSG_WAITALL) == (int) size); - assert(waitpid(pid, &status, 0) == pid); - assert(status == 0); - assert(close(1) == 0); - } else { - assert(close(0) == 0); - assert(socket(PF_INET, SOCK_STREAM, 0) == 0); - assert(connect(0, (struct sockaddr *) &addr, len) == 0); - assert(send(0, data, size, MSG_DONTROUTE) == (int) size); - assert(close(0) == 0); - } - - return 0; -} diff --git a/tests/net-yy-accept.awk b/tests/net-yy-accept.awk deleted file mode 100644 index fed3e30d..00000000 --- a/tests/net-yy-accept.awk +++ /dev/null @@ -1,95 +0,0 @@ -#!/bin/gawk -# -# Copyright (c) 2014 Masatake YAMATO -# Copyright (c) 2014-2015 Dmitry V. Levin -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# 3. The name of the author may not be used to endorse or promote products -# derived from this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR -# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES -# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. -# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT -# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF -# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -BEGIN { - lines = 9 - fail = 0 - - r_i = "[1-9][0-9]*" - r_port = "[1-9][0-9][0-9][0-9]+" - r_localhost = "127\\.0\\.0\\.1" - r_socket = "^socket\\(PF_INET, SOCK_STREAM, IPPROTO_IP\\) += 0$" - r_getsockname = "^getsockname\\(0, \\{sa_family=AF_INET, sin_port=htons\\((" r_port ")\\), sin_addr=inet_addr\\(\"" r_localhost "\"\\)\\}, \\[" r_i "\\]\\) += 0$" -} - -NR == 1 { - if (match($0, r_socket, a)) { - inode = a[1] - r_bind = "^bind\\(0, \\{sa_family=AF_INET, sin_port=htons\\(0\\), sin_addr=inet_addr\\(\"" r_localhost "\"\\)\\}, " r_i "\\) += 0$" - r_listen = "^listen\\(0, 5\\) += 0$" - next - } -} - -NR == 2 {if (r_bind != "" && match($0, r_bind)) next} - -NR == 3 {if (r_listen != "" && match($0, r_listen)) next} - -NR == 4 { - if (match($0, r_getsockname, a) && a[1] == a[2]) { - port_l = a[1] - r_accept = "^accept\\(0, \\{sa_family=AF_INET, sin_port=htons\\((" r_port ")\\), sin_addr=inet_addr\\(\"" r_localhost "\"\\)\\}, \\[" r_i "\\]\\) += 1" r_localhost ":(" r_port ")\\]>$" - r_close0 = "^close\\(0) += 0$" - next - } -} - -NR == 5 { - if (r_accept != "" && match($0, r_accept, a) && a[1] == a[2]) { - port_r = a[1] - r_recv = "^recv\\(1" r_localhost ":" port_r "\\]>, \"data\", 5, MSG_WAITALL\\) += 4$" - r_recvfrom = "^recvfrom\\(1" r_localhost ":" port_r "\\]>, \"data\", 5, MSG_WAITALL, NULL, NULL\\) += 4$" - r_close1 = "^close\\(1" r_localhost ":" port_r "\\]>) += 0$" - next - } -} - -NR == 6 {if (r_close0 != "" && match($0, r_close0)) next} - -NR == 7 {if (r_recv != "" && (match($0, r_recv) || match($0, r_recvfrom))) next} - -NR == 8 {if (r_close1 != "" && match($0, r_close1)) next} - -NR == lines && $0 == "+++ exited with 0 +++" {next} - -{ - print "Line " NR " does not match: " $0 - fail=1 -} - -END { - if (NR != lines) { - print "Expected " lines " lines, found " NR " line(s)." - print "" - exit 1 - } - if (fail) { - print "" - exit 1 - } -} diff --git a/tests/net-yy-connect.awk b/tests/net-yy-connect.awk deleted file mode 100644 index f4dcf913..00000000 --- a/tests/net-yy-connect.awk +++ /dev/null @@ -1,83 +0,0 @@ -#!/bin/gawk -# -# Copyright (c) 2014 Masatake YAMATO -# Copyright (c) 2014-2015 Dmitry V. Levin -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# 3. The name of the author may not be used to endorse or promote products -# derived from this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR -# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES -# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. -# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT -# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF -# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -BEGIN { - lines = 5 - fail = 0 - - r_i = "[1-9][0-9]*" - r_port = "[1-9][0-9][0-9][0-9]+" - r_localhost = "127\\.0\\.0\\.1" - r_socket = "^socket\\(PF_INET, SOCK_STREAM, IPPROTO_IP\\) += 0$" -} - -NR == 1 { - if (match($0, r_socket, a)) { - inode = a[1] - r_connect = "^connect\\(0, \\{sa_family=AF_INET, sin_port=htons\\((" r_port ")\\), sin_addr=inet_addr\\(\"" r_localhost "\"\\)\\}, " r_i ") += 0$" - next - } -} - -NR == 2 { - if (r_connect != "" && match($0, r_connect, a)) { - port_r = a[1] - r_send = "^send\\(0" r_localhost ":" port_r "\\]>, \"data\", 4, MSG_DONTROUTE\\) += 4$" - r_sendto = "^sendto\\(0" r_localhost ":" port_r "\\]>, \"data\", 4, MSG_DONTROUTE, NULL, 0\\) += 4$" - next - } -} - -NR == 3 { - if (r_send != "" && (match($0, r_send, a) || match($0, r_sendto, a))) { - port_l = a[1] - r_close = "^close\\(0" r_localhost ":" port_r "\\]>\\) += 0$" - next - } -} - -NR == 4 {if (r_close != "" && match($0, r_close)) next} - -NR == lines && $0 == "+++ exited with 0 +++" {next} - -{ - print "Line " NR " does not match: " $0 - fail=1 -} - -END { - if (NR != lines) { - print "Expected " lines " lines, found " NR " line(s)." - print "" - exit 1 - } - if (fail) { - print "" - exit 1 - } -} diff --git a/tests/net-yy-inet.c b/tests/net-yy-inet.c new file mode 100644 index 00000000..c6842b47 --- /dev/null +++ b/tests/net-yy-inet.c @@ -0,0 +1,173 @@ +/* + * This file is part of net-yy-inet strace test. + * + * Copyright (c) 2014-2016 Dmitry V. Levin + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "tests.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include + +int +main(void) +{ + const struct sockaddr_in addr = { + .sin_family = AF_INET, + .sin_addr.s_addr = htonl(INADDR_LOOPBACK) + }; + struct sockaddr * const listen_sa = tail_memdup(&addr, sizeof(addr)); + socklen_t * const len = tail_alloc(sizeof(socklen_t)); + *len = sizeof(addr); + + const int listen_fd = socket(PF_INET, SOCK_STREAM, 0); + if (listen_fd < 0) + perror_msg_and_skip("socket"); + const unsigned long listen_inode = inode_of_sockfd(listen_fd); + printf("socket(PF_INET, SOCK_STREAM, IPPROTO_IP) = %d\n", + listen_fd, listen_inode); + + if (bind(listen_fd, listen_sa, *len)) + perror_msg_and_skip("bind"); + printf("bind(%d, {sa_family=AF_INET, sin_port=htons(0)" + ", sin_addr=inet_addr(\"127.0.0.1\")}, %u) = 0\n", + listen_fd, listen_inode, (unsigned) *len); + + if (listen(listen_fd, 1)) + perror_msg_and_skip("listen"); + printf("listen(%d, 1) = 0\n", listen_fd, listen_inode); + + memset(listen_sa, 0, sizeof(addr)); + *len = sizeof(addr); + if (getsockname(listen_fd, listen_sa, len)) + perror_msg_and_fail("getsockname"); + const unsigned int listen_port = + ntohs(((struct sockaddr_in *) listen_sa) -> sin_port); + printf("getsockname(%d, {sa_family=AF_INET" + ", sin_port=htons(%u), sin_addr=inet_addr(\"127.0.0.1\")}" + ", [%u]) = 0\n", + listen_fd, listen_port, listen_port, (unsigned) *len); + + unsigned int * const optval = tail_alloc(sizeof(unsigned int)); + *len = sizeof(*optval); + if (getsockopt(listen_fd, SOL_TCP, TCP_MAXSEG, optval, len)) + perror_msg_and_fail("getsockopt"); + printf("getsockopt(%d, SOL_TCP, TCP_MAXSEG" + ", [%u], [%u]) = 0\n", + listen_fd, listen_port, *optval, (unsigned) *len); + + const int connect_fd = socket(PF_INET, SOCK_STREAM, 0); + if (connect_fd < 0) + perror_msg_and_fail("socket"); + const unsigned long connect_inode = inode_of_sockfd(connect_fd); + printf("socket(PF_INET, SOCK_STREAM, IPPROTO_IP) = %d\n", + connect_fd, connect_inode); + + *len = sizeof(addr); + if (connect(connect_fd, listen_sa, *len)) + perror_msg_and_fail("connect"); + printf("connect(%d, {sa_family=AF_INET, sin_port=htons(%u)" + ", sin_addr=inet_addr(\"127.0.0.1\")}, %u) = 0\n", + connect_fd, connect_inode, listen_port, (unsigned) *len); + + struct sockaddr * const accept_sa = tail_alloc(sizeof(addr)); + memset(accept_sa, 0, sizeof(addr)); + *len = sizeof(addr); + const int accept_fd = accept(listen_fd, accept_sa, len); + if (accept_fd < 0) + perror_msg_and_fail("accept"); + const unsigned int connect_port = + ntohs(((struct sockaddr_in *) accept_sa) -> sin_port); + printf("accept(%d, {sa_family=AF_INET" + ", sin_port=htons(%u), sin_addr=inet_addr(\"127.0.0.1\")}" + ", [%u]) = %d127.0.0.1:%u]>\n", + listen_fd, listen_port, connect_port, (unsigned) *len, + accept_fd, listen_port, connect_port); + + memset(accept_sa, 0, sizeof(addr)); + *len = sizeof(addr); + if (getpeername(accept_fd, accept_sa, len)) + perror_msg_and_fail("getpeername"); + printf("getpeername(%d127.0.0.1:%u]>" + ", {sa_family=AF_INET, sin_port=htons(%u)" + ", sin_addr=inet_addr(\"127.0.0.1\")}, [%u]) = 0\n", + accept_fd, listen_port, connect_port, connect_port, + (unsigned) *len); + + memset(listen_sa, 0, sizeof(addr)); + *len = sizeof(addr); + if (getpeername(connect_fd, listen_sa, len)) + perror_msg_and_fail("getpeername"); + printf("getpeername(%d127.0.0.1:%u]>" + ", {sa_family=AF_INET, sin_port=htons(%u)" + ", sin_addr=inet_addr(\"127.0.0.1\")}, [%u]) = 0\n", + connect_fd, connect_port, listen_port, listen_port, + (unsigned) *len); + + *len = sizeof(*optval); + if (setsockopt(connect_fd, SOL_TCP, TCP_MAXSEG, optval, *len)) + perror_msg_and_fail("setsockopt"); + printf("setsockopt(%d127.0.0.1:%u]>" + ", SOL_TCP, TCP_MAXSEG, [%u], %u) = 0\n", + connect_fd, connect_port, listen_port, *optval, + (unsigned) *len); + + char text[] = "text"; + assert(sendto(connect_fd, text, sizeof(text) - 1, + MSG_DONTROUTE | MSG_DONTWAIT, NULL, 0) == sizeof(text) - 1); + printf("sendto(%d127.0.0.1:%u]>, \"%s\", %u" + ", MSG_DONTROUTE|MSG_DONTWAIT, NULL, 0) = %u\n", + connect_fd, connect_port, listen_port, text, + (unsigned) sizeof(text) - 1, (unsigned) sizeof(text) - 1); + + assert(close(connect_fd) == 0); + printf("close(%d127.0.0.1:%u]>) = 0\n", + connect_fd, connect_port, listen_port); + + assert(recvfrom(accept_fd, text, sizeof(text) - 1, MSG_WAITALL, + NULL, NULL) == sizeof(text) - 1); + printf("recvfrom(%d127.0.0.1:%u]>, \"%s\", %u" + ", MSG_WAITALL, NULL, NULL) = %u\n", + accept_fd, listen_port, connect_port, text, + (unsigned) sizeof(text) - 1, (unsigned) sizeof(text) - 1); + + assert(close(accept_fd) == 0); + printf("close(%d127.0.0.1:%u]>) = 0\n", + accept_fd, listen_port, connect_port); + + assert(close(listen_fd) == 0); + printf("close(%d) = 0\n", + listen_fd, listen_port); + + puts("+++ exited with 0 +++"); + return 0; +} diff --git a/tests/net-yy.test b/tests/net-yy-inet.test similarity index 67% rename from tests/net-yy.test rename to tests/net-yy-inet.test index 8316cacf..9a7c96e0 100755 --- a/tests/net-yy.test +++ b/tests/net-yy-inet.test @@ -2,7 +2,7 @@ # # Check decoding of ip:port pairs associated with socket descriptors # -# Copyright (c) 2014-2015 Dmitry V. Levin +# Copyright (c) 2014-2016 Dmitry V. Levin # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -34,23 +34,16 @@ framework_skip_ '/proc/self/fd/ is not available' check_prog sed - run_prog ./netlink_inet_diag -run_prog ./inet-accept-connect-send-recv -run_strace_merge -yy -eclose,network $args - -child="$(sed -rn '/SIGCHLD/ s/^.*, si_pid=([1-9][0-9]*), .*/\1/p' "$LOG")" -[ -n "$child" ] || - dump_log_and_fail_with 'failed to find pid of child process' - -rm -f "$LOG"-* -sed -rn "/^$child"' /!d; / socket\(/,$ s/^[0-9]+ +[^ ]+ (.+)/\1/p' "$LOG" > "$LOG"-connect && -sed -rn "/^$child"' /d; /SIGCHLD/d; / socket\(/,$ s/^[0-9]+ +[^ ]+ (.+)/\1/p' "$LOG" > "$LOG"-accept || - dump_log_and_fail_with 'failed to separate logs' -match_awk "$LOG-connect" "$srcdir"/net-yy-connect.awk "$STRACE $args connect output mismatch" -match_awk "$LOG-accept" "$srcdir"/net-yy-accept.awk "$STRACE $args accept output mismatch" +addr="${ME_%.test}-local-stream" +run_prog "./${ME_%.test}" $addr > /dev/null -rm -f "$LOG"-connect "$LOG"-accept +OUT="$LOG.out" +EXP="$LOG.exp" +run_strace -a22 -yy -eclose,network $args > "$EXP" +# Filter out close() calls made by ld.so and libc. +sed -n '/socket/,$p' < "$LOG" > "$OUT" -exit 0 +match_diff "$OUT" "$EXP" +rm -f "$EXP" "$OUT"