diff options
author | Tom de Vries <tdevries@suse.de> | 2021-09-10 18:36:36 +0200 |
---|---|---|
committer | Tom de Vries <tdevries@suse.de> | 2021-09-10 18:36:36 +0200 |
commit | 7883d1e157780165060234d3722589fae6449adb (patch) | |
tree | a65cb245865902d2573e4b28d6f7ee3b15b7af79 | |
parent | 55fc911ad67c55f41fabb757726b641601d7870a (diff) | |
download | gdb-7883d1e157780165060234d3722589fae6449adb.zip gdb-7883d1e157780165060234d3722589fae6449adb.tar.gz gdb-7883d1e157780165060234d3722589fae6449adb.tar.bz2 |
[gdb/testsuite] Handle unrecognized command line option in gdb_compile_test
When running the gdb testsuite with gnatmake-4.8, I get many fails of the
following form:
...
gcc: error: unrecognized command line option '-fgnat-encodings=all'^M
gnatmake: "gdb.ada/O2_float_param/foo.adb" compilation error^M
compiler exited with status 1
compilation failed: gcc ... gdb.ada/O2_float_param/foo.adb
gcc: error: unrecognized command line option '-fgnat-encodings=all'
gnatmake: "gdb.ada/O2_float_param/foo.adb" compilation error
FAIL: gdb.ada/O2_float_param.exp: scenario=all: compilation foo.adb
...
Fix this by marking the test unsupported instead, such that we have:
...
UNSUPPORTED: gdb.ada/O2_float_param.exp: scenario=all: compilation foo.adb \
(unsupported option '-fgnat-encodings=all')
...
Tested on x86_64-linux.
gdb/testsuite/ChangeLog:
2021-09-10 Tom de Vries <tdevries@suse.de>
* lib/gdb.exp (gdb_compile_test): Handle unrecognized command line
option.
-rw-r--r-- | gdb/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gdb/testsuite/lib/gdb.exp | 35 |
2 files changed, 29 insertions, 11 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 807d302..9c2df65 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2021-09-10 Tom de Vries <tdevries@suse.de> + + * lib/gdb.exp (gdb_compile_test): Handle unrecognized command line + option. + 2021-09-09 Tom de Vries <tdevries@suse.de> * gdb.base/coredump-filter-build-id.exp: Handle older eu-unstrip. diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp index ec54b94..236917e 100644 --- a/gdb/testsuite/lib/gdb.exp +++ b/gdb/testsuite/lib/gdb.exp @@ -2155,21 +2155,34 @@ proc gdb_interact { } { # Examine the output of compilation to determine whether compilation # failed or not. If it failed determine whether it is due to missing # compiler or due to compiler error. Report pass, fail or unsupported -# as appropriate +# as appropriate. proc gdb_compile_test {src output} { + set msg "compilation [file tail $src]" + if { $output == "" } { - pass "compilation [file tail $src]" - } elseif { [regexp {^[a-zA-Z_0-9]+: Can't find [^ ]+\.$} $output] } { - unsupported "compilation [file tail $src]" - } elseif { [regexp {.*: command not found[\r|\n]*$} $output] } { - unsupported "compilation [file tail $src]" - } elseif { [regexp {.*: [^\r\n]*compiler not installed[^\r\n]*[\r|\n]*$} $output] } { - unsupported "compilation [file tail $src]" - } else { - verbose -log "compilation failed: $output" 2 - fail "compilation [file tail $src]" + pass $msg + return + } + + if { [regexp {^[a-zA-Z_0-9]+: Can't find [^ ]+\.$} $output] + || [regexp {.*: command not found[\r|\n]*$} $output] + || [regexp {.*: [^\r\n]*compiler not installed[^\r\n]*[\r|\n]*$} $output] } { + unsupported "$msg (missing compiler)" + return } + + set gcc_re ".*: error: unrecognized command line option " + set clang_re ".*: error: unsupported option " + if { [regexp "(?:$gcc_re|$clang_re)(\[^ \t;\r\n\]*)" $output dummy option] + && $option != "" } { + unsupported "$msg (unsupported option $option)" + return + } + + # Unclassified compilation failure, be more verbose. + verbose -log "compilation failed: $output" 2 + fail "$msg" } # Return a 1 for configurations for which we don't even want to try to |