From 67a8a8c9e652d0f1aa5a1c593177bd75bc4af284 Mon Sep 17 00:00:00 2001 From: Andrew Kroeger Date: Tue, 8 Sep 2009 16:01:26 -0500 Subject: testprogs:subunit.sh: Add function for expected failures. The testit_expect_failure() function is like the testit() function, with reversed error detection logic. This reversal only affects the pass/fail logic and logging - the original return code from the command is still returned to the calling script. --- testprogs/blackbox/subunit.sh | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'testprogs') diff --git a/testprogs/blackbox/subunit.sh b/testprogs/blackbox/subunit.sh index cee8cf6f45..e16aee76ca 100755 --- a/testprogs/blackbox/subunit.sh +++ b/testprogs/blackbox/subunit.sh @@ -65,3 +65,18 @@ testit () { fi return $status } + +testit_expect_failure () { + name="$1" + shift + cmdline="$*" + subunit_start_test "$name" + output=`$cmdline 2>&1` + status=$? + if [ x$status = x0 ]; then + echo "$output" | subunit_fail_test "$name" + else + subunit_pass_test "$name" + fi + return $status +} -- cgit