linux-sparse.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
To: linux-sparse@vger.kernel.org
Cc: Christopher Li <sparse@chrisli.org>,
	Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Subject: [PATCH 1/2] testsuite: allow commands to use pipes
Date: Mon, 21 Nov 2016 05:14:20 +0100	[thread overview]
Message-ID: <20161121041421.34576-2-luc.vanoostenryck@gmail.com> (raw)
In-Reply-To: <20161121041421.34576-1-luc.vanoostenryck@gmail.com>

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@gmail.com>
---
 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


  reply	other threads:[~2016-11-21  4:14 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-21  4:14 [PATCH 0/2] normalize bb's label names for testing Luc Van Oostenryck
2016-11-21  4:14 ` Luc Van Oostenryck [this message]
2016-11-21  4:14 ` [PATCH 2/2] testsuite: add a script to normalize label names Luc Van Oostenryck
2016-11-22 10:02 ` [PATCH 0/2] normalize bb's label names for testing Christopher Li
2016-11-22 13:27   ` Luc Van Oostenryck
2016-11-22 16:44     ` Christopher Li
2016-11-22 17:02       ` Luc Van Oostenryck
2016-11-22 15:42   ` [PATCH] give comparable label's names to basic blocks Luc Van Oostenryck

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20161121041421.34576-2-luc.vanoostenryck@gmail.com \
    --to=luc.vanoostenryck@gmail.com \
    --cc=linux-sparse@vger.kernel.org \
    --cc=sparse@chrisli.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).