[SAMBA4][PATCH]: Properly capture test error output

Andrew Kroeger andrew at sprocks.gotdns.com
Thu May 22 03:15:04 GMT 2008


All:

Please find attached a patch to properly capture and display error 
output in the subunit.sh test framework.

Additionally, a patch is included to .gitignore to ignore some files 
that are created and remain after running "make test".

The patches have also been pushed to git://git.id10ts.net/samba.git, in 
the v4-0-local branch.

Thanks,
Andrew
-------------- next part --------------
>From c0234d13192c1871971b45121249395ef15c5ae5 Mon Sep 17 00:00:00 2001
From: Andrew Kroeger <andrew at sprocks.gotdns.com>
Date: Wed, 21 May 2008 02:07:45 -0500
Subject: [PATCH] subunit.sh: Properly capture and pass on the command output.

Previously, the output from $cmdline was never captured.  In case of a
failure, there was no output being passed to the subunit_fail_test() function,
but that function contains a call to "cat -".  This caused the script to hang
indefinitely waiting for input.

We now capture $cmdline output (including mapping stderr to stdout) using
backticks, and then pipe that output to the subunit_fail_test() if there is
a failure.
---
 testprogs/blackbox/subunit.sh |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/testprogs/blackbox/subunit.sh b/testprogs/blackbox/subunit.sh
index 7a6b21e..100dfd1 100755
--- a/testprogs/blackbox/subunit.sh
+++ b/testprogs/blackbox/subunit.sh
@@ -56,12 +56,12 @@ testit () {
 	shift
 	cmdline="$*"
 	subunit_start_test "$name"
-	$cmdline
+	output=`$cmdline 2>&1`
 	status=$?
 	if [ x$status = x0 ]; then
 		subunit_pass_test "$name"
 	else
-		subunit_fail_test "$name"
+		echo $output | subunit_fail_test "$name"
 	fi
 	return $status
 }
-- 
1.5.4.5

-------------- next part --------------
>From 617d4b666514f997510a942c6f8aba6a4ae5e40e Mon Sep 17 00:00:00 2001
From: Andrew Kroeger <andrew at sprocks.gotdns.com>
Date: Wed, 21 May 2008 02:18:23 -0500
Subject: [PATCH] gitignore: Ignore some output files from make test.

---
 .gitignore |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/.gitignore b/.gitignore
index 75949c6..1e574f0 100644
--- a/.gitignore
+++ b/.gitignore
@@ -196,3 +196,7 @@ source/data.mk
 source/librpc/idl-deps
 source/libcli/netlogon_proto.h
 source/libcli/ndr_netlogon_proto.h
+source/foo.tdb
+source/gentest_seeds.dat
+source/templates.ldb
+source/torture.tdb
-- 
1.5.4.5



More information about the samba-technical mailing list