[PATCH] testprogs:subunit.sh: Add function for expected failures.

Andrew Kroeger andrew at id10ts.net
Tue Sep 8 15:01:26 MDT 2009


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 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/testprogs/blackbox/subunit.sh b/testprogs/blackbox/subunit.sh
index cee8cf6..e16aee7 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
+}
-- 
1.6.0.6


--------------000702080806020802060003
Content-Type: text/plain;
 name="0008-s4-pwsettings-Added-blackbox-tests.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="0008-s4-pwsettings-Added-blackbox-tests.patch"



More information about the samba-technical mailing list