[PATCH 7/7] tests: make test_expect_code quieter on success

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



A command exiting with the expected status is not particularly
notable.

While the indication of progress might be useful when tracking down
where in a test a failure has happened, the same applies to most other
test helpers, which are quiet about success, so this single helper's
output stands out in an unpleasant way.  An alternative method for
showing progress information might to invent a --progress option that
runs tests with "set -x", or until that is available, to run tests
using commands like

	prove -v -j2 --shuffle --exec='sh -x' t2202-add-addremove.sh

Signed-off-by: Jonathan Nieder <jrnieder@xxxxxxxxx>
---
That's the end of the series.  This last one should probably have
been called 7/6 or sent separately as an RFC, since it's more a
matter of taste.  It was just something I ran into while trying out
the tests.

Hopefully the series wasn't too boring.  Thanks for reading.

 t/test-lib.sh |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/t/test-lib.sh b/t/test-lib.sh
index 8a274fb..a174f66 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -731,12 +731,11 @@ test_expect_code () {
 	exit_code=$?
 	if test $exit_code = $want_code
 	then
-		echo >&2 "test_expect_code: command exited with $exit_code: $*"
 		return 0
-	else
-		echo >&2 "test_expect_code: command exited with $exit_code, we wanted $want_code $*"
-		return 1
 	fi
+
+	echo >&2 "test_expect_code: command exited with $exit_code, we wanted $want_code $*"
+	return 1
 }
 
 # test_cmp is a helper function to compare actual and expected output.
-- 
1.7.5.1

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]