[PATCH 1/2] testsuite: allow commands to use pipes

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

 



This can be usefull for filtering, transforming the normal
output in order to normalize it so that it can be compared
or to ignore things irrelevant to the test.

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@xxxxxxxxx>
---
 validation/test-pipe-cmd.c | 13 +++++++++++++
 validation/test-suite      |  6 +++---
 2 files changed, 16 insertions(+), 3 deletions(-)
 create mode 100644 validation/test-pipe-cmd.c

diff --git a/validation/test-pipe-cmd.c b/validation/test-pipe-cmd.c
new file mode 100644
index 00000000..8e86e9c3
--- /dev/null
+++ b/validation/test-pipe-cmd.c
@@ -0,0 +1,13 @@
+3
+2
+1
+/*
+ * check-name: test-pipe-cmd
+ * check-command: sparse $file | sort
+ * check-output-start
+
+1
+2
+3
+ * check-output-end
+ */
diff --git a/validation/test-suite b/validation/test-suite
index df5a7c60..9f4974c7 100755
--- a/validation/test-suite
+++ b/validation/test-suite
@@ -106,8 +106,8 @@ do_test()
 	cmd=`eval echo $default_path/$default_cmd`
 	get_value "check-command" $file
 	if [ "$?" -eq "0" ]; then
-		last_result=`echo $last_result | sed -e 's/^ *//'`
-		cmd=`eval echo $default_path/$last_result`
+		last_result=`echo "$last_result" | sed -e 's/^ *//'`
+		cmd=`eval echo "\"$default_path/$last_result\""`
 	fi
 
 	# check for disabled commands
@@ -142,7 +142,7 @@ do_test()
 
 
 	# grab the actual output & exit value
-	$cmd 1> $file.output.got 2> $file.error.got
+	eval $cmd 1> $file.output.got 2> $file.error.got
 	actual_exit_value=$?
 
 	for stream in output error; do
-- 
2.10.2

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



[Index of Archives]     [Newbies FAQ]     [LKML]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Trinity Fuzzer Tool]

  Powered by Linux