diff options
| -rw-r--r-- | Documentation/test-suite.rst | 8 | ||||
| -rw-r--r-- | validation/optim/testsuite.c | 12 | ||||
| -rwxr-xr-x | validation/test-suite | 27 |
3 files changed, 47 insertions, 0 deletions
diff --git a/Documentation/test-suite.rst b/Documentation/test-suite.rst index 333106ee..4ff2db2f 100644 --- a/Documentation/test-suite.rst +++ b/Documentation/test-suite.rst @@ -88,6 +88,14 @@ Tag's syntax of the number of times the pattern should occur in the output. If *min* or *max* is ``-`` the corresponding check is ignored. +``check-output-match(``\ *start*\ ``):`` *pattern* + + Check that in the output (stdout) all lines starting with the + first pattern also contains the second pattern. This should be + reserved for matching IR instructions since the '.$size' suffix + is ignored in the first pattern but is expected to be followed + by a space character. + Using test-suite ================ diff --git a/validation/optim/testsuite.c b/validation/optim/testsuite.c new file mode 100644 index 00000000..15c9bdd6 --- /dev/null +++ b/validation/optim/testsuite.c @@ -0,0 +1,12 @@ +int foo(void) +{ + return 0; +} + +/* + * check-name: testsuite + * check-command: test-linearize -Wno-decl $file + * + * check-output-ignore + * check-output-match(ret): \\$0 + */ diff --git a/validation/test-suite b/validation/test-suite index f7d992dc..37f9cdb5 100755 --- a/validation/test-suite +++ b/validation/test-suite @@ -77,6 +77,7 @@ get_tag_value() check_output_contains=0 check_output_excludes=0 check_output_pattern=0 + check_output_match=0 check_arch_ignore="" check_arch_only="" check_assert="" @@ -100,6 +101,7 @@ get_tag_value() check-output-contains:) check_output_contains=1 ;; check-output-excludes:) check_output_excludes=1 ;; check-output-pattern) check_output_pattern=1 ;; + check-output-match) check_output_match=1 ;; check-arch-ignore:) arch=$(uname -m) check_arch_ignore="$val" ;; check-arch-only:) arch=$(uname -m) @@ -205,6 +207,24 @@ minmax_patterns() } ## +match_patterns() +{ + ifile="$1" + patt="$2" + ofile="$3" + grep "$patt" "$ifile" | sed -e "s/^.*$patt(\(.*\)): *\(.*\)$/\1 \2/" | \ + while read ins pat; do + grep -s "^ $ins\\.*[0-9]* " "$ofile" | grep -v -s -q "$pat" + if [ "$?" -ne 1 ]; then + error " IR doesn't match '$pat'" + return 1 + fi + done + + return $? +} + +## # arg_file(filename) - checks if filename exists arg_file() { @@ -395,6 +415,13 @@ do_test() test_failed=1 fi fi + if [ $check_output_match -eq 1 ]; then + # verify the 'check-output-match($insn): $patt' tags + match_patterns "$file" 'check-output-match' $file.output.got + if [ "$?" -ne "0" ]; then + test_failed=1 + fi + fi if [ "$must_fail" -eq "1" ]; then if [ "$test_failed" -eq "1" ]; then |
