aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/validation/test-suite
diff options
authorLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2017-05-28 16:59:43 +0200
committerLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2017-05-28 21:10:26 +0200
commitcc80cf751ee229520283e15d24f40b6605cc40c5 (patch)
treed7dda11d2f7b9f4e445a6a10ad4cb8db20322fab /validation/test-suite
parentcb879872644ac28665f118949f47aa180494d84f (diff)
downloadsparse-dev-cc80cf751ee229520283e15d24f40b6605cc40c5.tar.gz
testsuite: grep the output patterns only when needed
For some testcase, it is checked if the output contains or not some given pattern, or we're checking the number of time a pattern is present in the output. This is done with grep and some glue. But for most testcases there is nothing to check and this grepping is just wasted CPU cycles. Fix this by using the already known tags to see if we need to do this grepping or not. This speedup the testsuite by another 15%. Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Diffstat (limited to 'validation/test-suite')
-rwxr-xr-xvalidation/test-suite33
1 files changed, 19 insertions, 14 deletions
diff --git a/validation/test-suite b/validation/test-suite
index ce2ca454..e33d9780 100755
--- a/validation/test-suite
+++ b/validation/test-suite
@@ -244,22 +244,27 @@ do_test()
fi
# verify the 'check-output-contains/excludes' tags
- has_each_patterns "$file" 'check-output-contains' $file.output.got
- if [ "$?" -ne "0" ]; then
- error "Actual output doesn't contain some of the expected patterns."
- test_failed=1
+ if [ $check_output_contains -eq 1 ]; then
+ has_each_patterns "$file" 'check-output-contains' $file.output.got
+ if [ "$?" -ne "0" ]; then
+ error "Actual output doesn't contain some of the expected patterns."
+ test_failed=1
+ fi
fi
- has_none_patterns "$file" 'check-output-excludes' $file.output.got
- if [ "$?" -ne "0" ]; then
- error "Actual output contains some patterns which are not expected."
- test_failed=1
+ if [ $check_output_excludes -eq 1 ]; then
+ has_none_patterns "$file" 'check-output-excludes' $file.output.got
+ if [ "$?" -ne "0" ]; then
+ error "Actual output contains some patterns which are not expected."
+ test_failed=1
+ fi
fi
-
- # verify the 'check-output-pattern-X-times' tags
- nbr_patterns "$file" 'check-output-pattern' $file.output.got
- if [ "$?" -ne "0" ]; then
- error "Actual output doesn't contain the pattern the expected number."
- test_failed=1
+ if [ $check_output_pattern -eq 1 ]; then
+ # verify the 'check-output-pattern-X-times' tags
+ nbr_patterns "$file" 'check-output-pattern' $file.output.got
+ if [ "$?" -ne "0" ]; then
+ error "Actual output doesn't contain the pattern the expected number."
+ test_failed=1
+ fi
fi
[ "$test_failed" -eq "$must_fail" ] || failed=1