From f23647875052856c522e80834b4f03056a052866 Mon Sep 17 00:00:00 2001 From: "Dmitry V. Levin" Date: Wed, 20 Dec 2017 22:58:42 +0000 Subject: [PATCH] tests: consistently use $STRACE_EXE instead of local alternatives * tests/get_regs.test: Replace "${STRACE##* }" with "$STRACE_EXE". * tests/options-syntax.test: Replace "$strace_exp" with "$STRACE_EXE". * tests/syntax.sh: Likewise. --- tests/get_regs.test | 4 ++-- tests/options-syntax.test | 22 +++++++++++----------- tests/syntax.sh | 10 ++++------ 3 files changed, 17 insertions(+), 19 deletions(-) diff --git a/tests/get_regs.test b/tests/get_regs.test index c673fe95..eb69137b 100755 --- a/tests/get_regs.test +++ b/tests/get_regs.test @@ -36,7 +36,7 @@ run_prog ../gettid > /dev/null run_strace -qq -esignal=none -eraw=all -etrace=none ../gettid > /dev/null run_strace -qq -esignal=none -eraw=all -eptrace -o '|grep -c ^ptrace > less' \ - -- ${STRACE##* } -o "$LOG" $args > /dev/null + -- "$STRACE_EXE" -o "$LOG" $args > /dev/null [ "$(cat less)" -gt 0 ] || fail_ "$STRACE $args failed to catch any ptrace syscalls" @@ -44,7 +44,7 @@ run_strace -qq -esignal=none -eraw=all -eptrace -o '|grep -c ^ptrace > less' \ run_strace -qq -esignal=none -eraw=all -etrace=all ../gettid > /dev/null run_strace -qq -esignal=none -eraw=all -eptrace -o '|grep -c ^ptrace > more' \ - -- ${STRACE##* } -o "$LOG" $args > /dev/null + -- "$STRACE_EXE" -o "$LOG" $args > /dev/null [ "$(cat more)" -gt 0 ] || fail_ "$STRACE $args failed to catch any ptrace syscalls" diff --git a/tests/options-syntax.test b/tests/options-syntax.test index a0700fe2..9cfcf5cd 100755 --- a/tests/options-syntax.test +++ b/tests/options-syntax.test @@ -82,12 +82,12 @@ check_h "invalid -s argument: '-42'" -s -42 check_h "invalid -s argument: '1073741824'" -s 1073741824 check_h "invalid -I argument: '5'" -I 5 -../zeroargc "$strace_exp" /bin/true 2> "$LOG" && +../zeroargc "$STRACE_EXE" /bin/true 2> "$LOG" && dump_log_and_fail_with \ 'zeroargc strace failed to handle the error properly' cat > "$EXP" << __EOF__ -$strace_exp: must have PROG [ARGS] or -p PID -Try '$strace_exp -h' for more information. +$STRACE_EXE: must have PROG [ARGS] or -p PID +Try '$STRACE_EXE -h' for more information. __EOF__ diff -u -- "$EXP" "$LOG" > /dev/null || { cat > "$EXP" <<- '__EOF__' @@ -109,17 +109,17 @@ if [ -n "${UID-}" ]; then for c in i r t T y; do check_e "-$c has no effect with -c -$strace_exp: $umsg" -u :nosuchuser: -c -$c true +$STRACE_EXE: $umsg" -u :nosuchuser: -c -$c true done check_e "-i has no effect with -c -$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 +$STRACE_EXE: -r has no effect with -c +$STRACE_EXE: -t has no effect with -c +$STRACE_EXE: -T has no effect with -c +$STRACE_EXE: -y has no effect with -c +$STRACE_EXE: $umsg" -u :nosuchuser: -cirtTy true check_e "-tt has no effect with -r -$strace_exp: $umsg" -u :nosuchuser: -r -tt true +$STRACE_EXE: $umsg" -u :nosuchuser: -r -tt true fi args='-p 2147483647' @@ -129,7 +129,7 @@ $STRACE $args 2> "$LOG" && for cmd in PTRACE_SEIZE PTRACE_ATTACH; do cat > "$EXP" << __EOF__ -$strace_exp: attach: ptrace($cmd, 2147483647): No such process +$STRACE_EXE: attach: ptrace($cmd, 2147483647): No such process __EOF__ diff -- "$EXP" "$LOG" || continue diff --git a/tests/syntax.sh b/tests/syntax.sh index 0a0d2a57..b1c8fdc1 100644 --- a/tests/syntax.sh +++ b/tests/syntax.sh @@ -50,13 +50,11 @@ check_exit_status_and_stderr_using_grep() "strace $* failed to print expected diagnostics" } -strace_exp="${STRACE##* }" - check_e() { local pattern="$1"; shift cat > "$EXP" << __EOF__ -$strace_exp: $pattern +$STRACE_EXE: $pattern __EOF__ check_exit_status_and_stderr "$@" } @@ -65,7 +63,7 @@ check_e_using_grep() { local pattern="$1"; shift cat > "$EXP" << __EOF__ -$strace_exp: $pattern +$STRACE_EXE: $pattern __EOF__ check_exit_status_and_stderr_using_grep "$@" } @@ -74,8 +72,8 @@ check_h() { local pattern="$1"; shift cat > "$EXP" << __EOF__ -$strace_exp: $pattern -Try '$strace_exp -h' for more information. +$STRACE_EXE: $pattern +Try '$STRACE_EXE -h' for more information. __EOF__ check_exit_status_and_stderr "$@" } -- 2.40.0