diff options
| author | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2017-09-04 10:31:42 +0200 |
|---|---|---|
| committer | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2017-09-16 10:40:26 +0200 |
| commit | e82ef9b847274e428682dd889194da54c9945a58 (patch) | |
| tree | 51d17a3c79c223979f755537b15fb0a22af05554 /validation | |
| parent | 620eed0a3813c1263f39a2e166db1dc35a126e45 (diff) | |
| download | sparse-dev-e82ef9b847274e428682dd889194da54c9945a58.tar.gz | |
testsuite: better message for pattern absence/presence
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Diffstat (limited to 'validation')
| -rwxr-xr-x | validation/test-suite | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/validation/test-suite b/validation/test-suite index 953b7637..bdc1424f 100755 --- a/validation/test-suite +++ b/validation/test-suite @@ -96,11 +96,14 @@ has_patterns() patt="$2" ofile="$3" cmp="$4" + msg="$5" grep "$patt:" "$ifile" | \ sed -e "s/^.*$patt: *\(.*\)$/\1/" | \ while read val; do grep -s -q "$val" "$ofile" if [ "$?" $cmp 0 ]; then + error "test '$ifile' failed" + error " Pattern '$val' unexpectedly $msg" return 1 fi done @@ -115,7 +118,7 @@ has_patterns() # returns 0 if all present, 1 otherwise has_each_patterns() { - has_patterns "$1" "$2" "$3" -ne + has_patterns "$1" "$2" "$4" -ne "$3" } ## @@ -125,7 +128,7 @@ has_each_patterns() # returns 1 if any present, 0 otherwise has_none_patterns() { - has_patterns "$1" "$2" "$3" -eq + has_patterns "$1" "$2" "$4" -eq "$3" } ## @@ -256,16 +259,14 @@ do_test() # verify the 'check-output-contains/excludes' tags if [ $check_output_contains -eq 1 ]; then - has_each_patterns "$file" 'check-output-contains' $file.output.got + has_each_patterns "$file" 'check-output-contains' absent $file.output.got if [ "$?" -ne "0" ]; then - error "Actual output doesn't contain some of the expected patterns." test_failed=1 fi fi if [ $check_output_excludes -eq 1 ]; then - has_none_patterns "$file" 'check-output-excludes' $file.output.got + has_none_patterns "$file" 'check-output-excludes' present $file.output.got if [ "$?" -ne "0" ]; then - error "Actual output contains some patterns which are not expected." test_failed=1 fi fi |
