# HG changeset patch # User Pádraig Brady # Date 1424107239 0 # Node ID 0ad1f4c9eed50a33647a9646afed3ca5e53bc0e5 # Parent b4da4a9fe406b18ecb280e2a453c271294eb7237 tests: support stderr verification with returns_() * tests/init.sh (returns_): Disable tracing for this wrapper function, so that stderr of the wrapped command is unchanged, allowing for verification of the contents. diff --git a/ChangeLog b/ChangeLog --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2015-02-24 Pádraig Brady + + tests: support stderr verification with returns_() + * tests/init.sh (returns_): Disable tracing for this wrapper + function, so that stderr of the wrapped command is unchanged, + allowing for verification of the contents. + 2015-02-24 Pavel Hrdina passfd: avoid valgrind uninitalised data warning diff --git a/tests/init.sh b/tests/init.sh --- a/tests/init.sh +++ b/tests/init.sh @@ -100,10 +100,18 @@ # instead check an explicit exit code like # returns_ 1 command ... || fail returns_ () { + # Disable tracing so it doesn't interfere with stderr of the wrapped command + { set +x; } 2>/dev/null + local exp_exit="$1" shift "$@" - test $? -eq $exp_exit + test $? -eq $exp_exit && ret_=0 || ret_=1 + + if test "$VERBOSE" = yes && test "$gl_set_x_corrupts_stderr_" = false; then + set -x + fi + { return $ret_; } 2>/dev/null } # Sanitize this shell to POSIX mode, if possible.