]> granicus.if.org Git - strace/commitdiff
tests: make options-syntax.test tolerant of strace wrappers
authorDmitry V. Levin <ldv@altlinux.org>
Mon, 5 Dec 2016 00:58:36 +0000 (00:58 +0000)
committerDmitry V. Levin <ldv@altlinux.org>
Mon, 5 Dec 2016 03:56:17 +0000 (03:56 +0000)
Change the test to allow wrappers like STRACE="valgrind ./strace".

* tests/options-syntax.test: Strip all words but last from $STRACE
variable in all contexts where the name of strace executable is expected
in its output.

tests/options-syntax.test

index 2972561c90883236729ff13a877c3acac6af8ca1..456631148da2ce1c461023f9445ec7b42c8398d0 100755 (executable)
@@ -39,11 +39,13 @@ check_exit_status_and_stderr()
                        "strace $* failed to print expected diagnostics"
 }
 
+strace_exp="${STRACE##* }"
+
 check_e()
 {
        local pattern="$1"; shift
        cat > "$EXP" << __EOF__
-$STRACE: $pattern
+$strace_exp: $pattern
 __EOF__
        check_exit_status_and_stderr "$@"
 }
@@ -52,8 +54,8 @@ check_h()
 {
        local pattern="$1"; shift
        cat > "$EXP" << __EOF__
-$STRACE: $pattern
-Try '$STRACE -h' for more information.
+$strace_exp: $pattern
+Try '$strace_exp -h' for more information.
 __EOF__
        check_exit_status_and_stderr "$@"
 }
@@ -90,17 +92,17 @@ if [ -n "${UID-}" ]; then
 
        for c in i r t T y; do
                check_e "-$c has no effect with -c
-$STRACE: $umsg" -u :nosuchuser: -c -$c true
+$strace_exp: $umsg" -u :nosuchuser: -c -$c true
        done
                check_e "-i has no effect with -c
-$STRACE: -r has no effect with -c
-$STRACE: -t has no effect with -c
-$STRACE: -T has no effect with -c
-$STRACE: -y has no effect with -c
-$STRACE: $umsg" -u :nosuchuser: -cirtTy true
+$strace_exp: -r has no effect with -c
+$strace_exp: -t has no effect with -c
+$strace_exp: -T has no effect with -c
+$strace_exp: -y has no effect with -c
+$strace_exp: $umsg" -u :nosuchuser: -cirtTy true
 
        check_e "-tt has no effect with -r
-$STRACE: $umsg" -u :nosuchuser: -r -tt true
+$strace_exp: $umsg" -u :nosuchuser: -r -tt true
 fi
 
 args='-p 2147483647'
@@ -110,7 +112,7 @@ $STRACE $args 2> "$LOG" &&
 
 for cmd in PTRACE_SEIZE PTRACE_ATTACH; do
        cat > "$EXP" << __EOF__
-$STRACE: attach: ptrace($cmd, 2147483647): No such process
+$strace_exp: attach: ptrace($cmd, 2147483647): No such process
 __EOF__
        diff -- "$EXP" "$LOG" ||
                continue