]> granicus.if.org Git - strace/commitdiff
tests: simplify sendfile.test and sendfile64.test
authorDmitry V. Levin <ldv@altlinux.org>
Tue, 29 Mar 2016 17:01:02 +0000 (17:01 +0000)
committerDmitry V. Levin <ldv@altlinux.org>
Tue, 29 Mar 2016 17:01:02 +0000 (17:01 +0000)
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.

tests/sendfile.c
tests/sendfile.test
tests/sendfile64.c
tests/sendfile64.test

index 18e046d13f6230cab2cb662770cd1a362cce06fc..b1c75743c5ae024184f68350491d3a0ef5e77cc6 100644 (file)
@@ -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);
index b978fd9dfaf7a513bb7c0cf2bc30f7e809e604f7..0d5010f7a7a9c66d0f4ad935f2cc50a13a20e9e1 100755 (executable)
@@ -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"
index 418e6c177cc66cff4d8257bb22987610f1eafd8e..7c4a6f5fd2d49cca0a0053be6cd187207fc6c453 100644 (file)
@@ -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);
index 025e61b3cd0092f11a286fa565a4677371ce2237..8c11feb8334ea4053c18b589be910be31c4dbc15 100755 (executable)
@@ -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"