]> granicus.if.org Git - strace/commitdiff
tests: add opipe.test
authorDmitry V. Levin <ldv@altlinux.org>
Fri, 5 Feb 2016 01:19:37 +0000 (01:19 +0000)
committerDmitry V. Levin <ldv@altlinux.org>
Fri, 5 Feb 2016 14:58:41 +0000 (14:58 +0000)
Check that -o |pipe_command works.  In particular, check that
strace waits for completion of piped command.

* tests/opipe.test: New test.
* tests/Makefile.am (TESTS): Add it.

tests/Makefile.am
tests/opipe.test [new file with mode: 0755]

index da74adc227a5a5fe6377f58c52b5952f4f5246ec..f39207be70225304f149ca1cf5e6372ecda2e782 100644 (file)
@@ -311,6 +311,7 @@ TESTS = \
        detach-sleeping.test \
        detach-stopped.test \
        detach-running.test \
+       opipe.test \
        restart_syscall.test \
        $(LIBUNWIND_TESTS)
 
diff --git a/tests/opipe.test b/tests/opipe.test
new file mode 100755 (executable)
index 0000000..fda1b94
--- /dev/null
@@ -0,0 +1,19 @@
+#!/bin/sh
+
+# Check how -o '|pipe' works.
+
+. "${srcdir=.}/init.sh"
+
+OUT="$LOG.out"
+EXP="$LOG.exp"
+
+check_prog grep
+run_prog grep chdir $srcdir/umovestr.expected > "$EXP"
+run_prog ./umovestr
+
+> "$LOG" || fail_ "failed to write $LOG"
+$STRACE -o "|cat > $LOG && $SLEEP_A_BIT && grep chdir < $LOG > $OUT" -e chdir $args ||
+       dump_log_and_fail_with "$STRACE $args failed"
+
+match_diff "$OUT" "$EXP"
+rm -f "$EXP" "$OUT"