diff options
| author | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2017-05-28 16:52:02 +0200 |
|---|---|---|
| committer | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2017-05-28 21:10:25 +0200 |
| commit | cb879872644ac28665f118949f47aa180494d84f (patch) | |
| tree | 542492d38c29f69145c9a2ad1ea2291ae91b389a | |
| parent | 3d511f88d9d6bbc46ec15415bf29f89d51ee2b9c (diff) | |
| download | sparse-dev-cb879872644ac28665f118949f47aa180494d84f.tar.gz | |
testsuite: grep the expected output only when needed
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@gmail.com>
| -rwxr-xr-x | validation/test-suite | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/validation/test-suite b/validation/test-suite index fa4cd36c..ce2ca454 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." |
