]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
run_dump_test warning/error regexp
authorAlan Modra <amodra@gmail.com>
Sat, 18 Jan 2025 11:51:03 +0000 (22:21 +1030)
committerAlan Modra <amodra@gmail.com>
Mon, 20 Jan 2025 22:12:44 +0000 (08:42 +1030)
This allows you to specify a run_dump_test warning that may or may not
be present using
warning: (warning_text_goes_here)?
ie. the regexp matches an empty string.

binutils/testsuite/lib/binutils-common.exp

index 72664d84bccaa38d659e1d7ae7ddb2123245fd72..41d94d256ecd2af238b0e58af02586891a128512 100644 (file)
@@ -1567,12 +1567,16 @@ proc run_dump_test { name {extra_options {}} } {
                verbose -log "$exitstat with: <$comp_output>, no expected output"
            }
 
-           if { (($want_out(source) == "") == ($comp_output == "")) \
-                    && (($cmdret == 0) == ($want_out(terminal) == 0)) \
-                    && ((($want_out(source) == "regex") \
-                             && [regexp -- $want_out(regex) $comp_output]) \
-                            || (($want_out(source) == "file") \
-                                    && (![regexp_diff "tmpdir/ld.messages" "$srcdir/$subdir/$want_out(file)"]))) } {
+           set ok 0
+           if { ($cmdret == 0) == ($want_out(terminal) == 0) } {
+               switch $want_out(source) {
+                   regex { set ok [regexp -- $want_out(regex) $comp_output] }
+                   file  { set ok [expr ![regexp_diff tmpdir/ld.messages \
+                                          $srcdir/$subdir/$want_out(file)]] }
+                   ""    { set ok [string equal $comp_output ""] }
+               }
+           }
+           if { $ok } {
                # We have the expected output.
                if { $want_out(terminal) || $dumpprogram == "" } {
                    pass $testname