[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] tests: support stderr verification with returns_()
From: |
Pádraig Brady |
Subject: |
[PATCH] tests: support stderr verification with returns_() |
Date: |
Tue, 24 Feb 2015 17:38:10 +0000 |
* 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.
---
ChangeLog | 7 +++++++
tests/init.sh | 10 +++++++++-
2 files changed, 16 insertions(+), 1 deletion(-)
diff --git a/ChangeLog b/ChangeLog
index 47b3b03..2262efa 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2015-02-24 P??draig Brady <address@hidden>
+
+ 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 <address@hidden>
passfd: avoid valgrind uninitalised data warning
diff --git a/tests/init.sh b/tests/init.sh
index ac1e1a2..9f403c5 100644
--- a/tests/init.sh
+++ b/tests/init.sh
@@ -100,10 +100,18 @@ framework_failure_ () { warn_ "$ME_: set-up failure: $@";
Exit 99; }
# 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.
--
2.1.0
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [PATCH] tests: support stderr verification with returns_(),
Pádraig Brady <=