From 9d10d06a5ec30d555c776c863011b1adb2b39f4f Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Tue, 11 Jun 2024 20:42:12 +0200 Subject: [PATCH] test-framework-sh: Fix 'returns_' to not turn off tracing permanently. * tests/init.sh (returns_): Restore tracing if it was enabled before. --- ChangeLog | 5 +++++ tests/init.sh | 4 +++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index bf6a2ddcb0..e8d05a9c07 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2024-06-11 Bruno Haible + + test-framework-sh: Fix 'returns_' to not turn off tracing permanently. + * tests/init.sh (returns_): Restore tracing if it was enabled before. + 2024-06-09 Bruno Haible c32width tests: Avoid a test failure on Solaris 11 OpenIndiana, OmniOS. diff --git a/tests/init.sh b/tests/init.sh index 6effae27c7..237db02fb0 100644 --- a/tests/init.sh +++ b/tests/init.sh @@ -598,6 +598,7 @@ fi # returns_ 1 command ... || fail returns_ () { # Disable tracing so it doesn't interfere with stderr of the wrapped command + local is_tracing=`{ :; } 2>&1` { set +x; } 2>/dev/null local exp_exit="$1" @@ -605,7 +606,8 @@ returns_ () { "$@" test $? -eq $exp_exit && ret_=0 || ret_=1 - if test "$VERBOSE" = yes && test "$gl_set_x_corrupts_stderr_" = false; then + # Restore tracing if it was enabled. + if test -n "$is_tracing"; then set -x fi { return $ret_; } 2>/dev/null -- 2.39.5