From: Dmitry V. Levin Date: Tue, 29 Mar 2016 17:01:02 +0000 (+0000) Subject: tests: simplify sendfile.test and sendfile64.test X-Git-Tag: v4.12~477 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a990e8c671c2507a5379d84ef21402ec81057f78;p=strace tests: simplify sendfile.test and sendfile64.test Use the executable itself for input by default. * tests/sendfile.c (main): Use av[0] instead of av[1] for input. * tests/sendfile64.c (main): Likewise. * tests/sendfile.test: Invoke run_prog without arguments. * tests/sendfile64.test: Likewise. --- diff --git a/tests/sendfile.c b/tests/sendfile.c index 18e046d1..b1c75743 100644 --- a/tests/sendfile.c +++ b/tests/sendfile.c @@ -42,7 +42,7 @@ int main(int ac, const char **av) { - assert(ac == 2); + assert(ac == 1); (void) close(0); if (open("/dev/zero", O_RDONLY) != 0) @@ -52,9 +52,9 @@ main(int ac, const char **av) if (socketpair(AF_UNIX, SOCK_STREAM, 0, sv)) perror_msg_and_skip("socketpair"); - int reg_in = open(av[1], O_RDONLY); + int reg_in = open(av[0], O_RDONLY); if (reg_in < 0) - perror_msg_and_fail("open: %s", av[1]); + perror_msg_and_fail("open: %s", av[0]); struct stat stb; assert(fstat(reg_in, &stb) == 0); diff --git a/tests/sendfile.test b/tests/sendfile.test index b978fd9d..0d5010f7 100755 --- a/tests/sendfile.test +++ b/tests/sendfile.test @@ -4,8 +4,7 @@ . "${srcdir=.}/init.sh" -exe="./${ME_%.test}" -run_prog "$exe" "$exe" > /dev/null +run_prog > /dev/null OUT="$LOG.out" run_strace -a24 -esendfile $args > "$OUT" match_diff "$LOG" "$OUT" diff --git a/tests/sendfile64.c b/tests/sendfile64.c index 418e6c17..7c4a6f5f 100644 --- a/tests/sendfile64.c +++ b/tests/sendfile64.c @@ -42,7 +42,7 @@ int main(int ac, const char **av) { - assert(ac == 2); + assert(ac == 1); (void) close(0); if (open("/dev/zero", O_RDONLY) != 0) @@ -52,9 +52,9 @@ main(int ac, const char **av) if (socketpair(AF_UNIX, SOCK_STREAM, 0, sv)) perror_msg_and_skip("socketpair"); - int reg_in = open(av[1], O_RDONLY); + int reg_in = open(av[0], O_RDONLY); if (reg_in < 0) - perror_msg_and_fail("open: %s", av[1]); + perror_msg_and_fail("open: %s", av[0]); struct stat stb; assert(fstat(reg_in, &stb) == 0); diff --git a/tests/sendfile64.test b/tests/sendfile64.test index 025e61b3..8c11feb8 100755 --- a/tests/sendfile64.test +++ b/tests/sendfile64.test @@ -4,8 +4,7 @@ . "${srcdir=.}/init.sh" -exe="./${ME_%.test}" -run_prog "$exe" "$exe" > /dev/null +run_prog > /dev/null OUT="$LOG.out" run_strace -a24 -esendfile64 $args > "$OUT" match_diff "$LOG" "$OUT"