[TOY PATCH] test-lib: &&-chaining tester

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

 



Signed-off-by: Jonathan Nieder <jrnieder@xxxxxxxxx>
---
Hi Elijah,

Elijah Newren wrote:

> This patch series fixes many of the missing &&s in the testsuite.

Thanks again.  Here's a little glimpse of a future without missing &&s
to play with.

 t/test-lib.sh |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/t/test-lib.sh b/t/test-lib.sh
index 932f45b..e3a0e68 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -393,7 +393,17 @@ test_debug () {
 	test "$debug" = "" || eval "$1"
 }
 
+check_command_chaining_ () {
+	eval >&3 2>&4 "(exit 189) && $1"
+	eval_chain_ret=$?
+	if test "$eval_chain_ret" != 189
+	then
+		error 'bug in the test script: missing "&&" in test commands'
+	fi
+}
+
 test_run_ () {
+	check_command_chaining_ "$1"
 	test_cleanup=:
 	eval >&3 2>&4 "$1"
 	eval_ret=$?
@@ -697,6 +707,7 @@ test_cmp() {
 # the test to pass.
 
 test_when_finished () {
+	check_command_chaining_ "$test_cleanup"
 	test_cleanup="{ $*
 		} && (exit \"\$eval_ret\"); eval_ret=\$?; $test_cleanup"
 }
-- 
1.7.2.3

--
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]