]> granicus.if.org Git - strace/commitdiff
tests: rewrite pipe syscall decoding check from match_grep to match_diff
authorDmitry V. Levin <ldv@altlinux.org>
Sun, 12 Feb 2017 14:12:41 +0000 (14:12 +0000)
committerDmitry V. Levin <ldv@altlinux.org>
Sun, 12 Feb 2017 14:12:41 +0000 (14:12 +0000)
* configure.ac (AC_CHECK_FUNCS): Remove pipe2.
* tests/pipe.c: Include <asm/unistd.h>, skip the test if [!__NR_pipe]
instead of [!HAVE_PIPE2].
(main): Do not call pipe2.
* tests/pipe.test: Skip the test if libc pipe wrapper does not use
pipe syscall, rewrite from match_grep to match_diff.
* tests/pipe.expected: Update expected output.

configure.ac
tests/pipe.c
tests/pipe.expected
tests/pipe.test

index 018a8df390f9d3b2a692332cf41900be0552dbba..7004bd3ff2944df648015007b726b3404a08defe 100644 (file)
@@ -270,7 +270,6 @@ AC_CHECK_FUNCS(m4_normalize([
        futimens
        if_indextoname
        open64
-       pipe2
        prctl
        preadv
        process_vm_readv
index 68217f208e47bb0e78da55ceaf461b1fe2833a07..41c7f2154feaceb802765bd91126812534568a98 100644 (file)
@@ -1,4 +1,6 @@
 /*
+ * Check decoding of pipe syscall.
+ *
  * Copyright (c) 2015-2016 Dmitry V. Levin <ldv@altlinux.org>
  * All rights reserved.
  *
@@ -26,8 +28,9 @@
  */
 
 #include "tests.h"
+#include <asm/unistd.h>
 
-#ifdef HAVE_PIPE2
+#ifdef __NR_pipe
 
 # include <stdio.h>
 # include <fcntl.h>
@@ -38,20 +41,15 @@ main(void)
 {
        (void) close(0);
        (void) close(1);
-       int fds[2];
+       int *const fds = tail_alloc(sizeof(*fds) * 2);
        if (pipe(fds))
                perror_msg_and_fail("pipe");
 
-       (void) close(0);
-       (void) close(1);
-       if (pipe2(fds, O_NONBLOCK))
-               perror_msg_and_skip("pipe2");
-
        return 0;
 }
 
 #else
 
-SKIP_MAIN_UNDEFINED("HAVE_PIPE2")
+SKIP_MAIN_UNDEFINED("__NR_pipe")
 
 #endif
index 675cb85b2fcca5dd9c056b95d1b7a9b44f9d2ef1..2e46336c328607bf2ca5fc215e8f9b691ef10153 100644 (file)
@@ -1,2 +1,2 @@
-pipe(\(\[0, 1\]|2\(\[0, 1\], 0)\) += 0
-pipe2\(\[0, 1\], O_NONBLOCK\) += 0
+pipe([0, 1]) = 0
++++ exited with 0 +++
index a445f86e14ec0cee7c364c22f6a4444a7d7bf775..0ae414d49ebbc6776dc093d0aae03ce67a23faf1 100755 (executable)
@@ -1,16 +1,13 @@
 #!/bin/sh
 
-# Check pipe/pipe2 syscalls decoding.
-
+# Check decoding of pipe syscall.
 . "${srcdir=.}/init.sh"
 
-syscall=pipe2
-for n in pipe; do
-       $STRACE -e$n -h > /dev/null && syscall=$syscall,$n
-done
-
 run_prog
-run_strace -e$syscall $args
-match_grep
+run_strace -a13 -epipe $args
+
+check_prog grep
+LC_ALL=C grep -x "pipe(.*" "$LOG" > /dev/null ||
+       skip_ 'test executable does not use pipe syscall'
 
-exit 0
+match_diff