[PATCH 2/6] testsuite: grep the expected output only when needed

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

 



Currently the testsuite always try to extract the expected
output from the test case description.
This is done with grep & sed.

But in some case we're not interested to compare the actual
output with the expected one. And in those cases the grep & sed
are just wasted CPU cycles.

Fix this by extracting the expected output only when we know
that it won't be ignored.

This speedup the testsuite by a modest 1%.

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@xxxxxxxxx>
---
 validation/test-suite | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/validation/test-suite b/validation/test-suite
index fa4cd36cf..ce2ca454c 100755
--- a/validation/test-suite
+++ b/validation/test-suite
@@ -206,12 +206,6 @@ do_test()
 
 	verbose "Using command       : $cmd"
 
-	# grab the expected output
-	sed -n '/check-output-start/,/check-output-end/p' $file \
-		| grep -v check-output > "$file".output.expected
-	sed -n '/check-error-start/,/check-error-end/p' $file \
-		| grep -v check-error > "$file".error.expected
-
 	# grab the expected exit value
 	expected_exit_value=$check_exit_value
 	verbose "Expecting exit value: $expected_exit_value"
@@ -230,6 +224,10 @@ do_test()
 		eval ignore=\$check_${stream}_ignore
 		[ $ignore -eq 1 ] && continue
 
+		# grab the expected output
+		sed -n "/check-$stream-start/,/check-$stream-end/p" $file \
+		| grep -v check-$stream > "$file".$stream.expected
+
 		diff -u "$file".$stream.expected "$file".$stream.got > "$file".$stream.diff
 		if [ "$?" -ne "0" ]; then
 			error "actual $stream text does not match expected $stream text."
-- 
2.13.0

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