diff options
author | Tom de Vries <tdevries@suse.de> | 2021-09-03 17:40:10 +0200 |
---|---|---|
committer | Tom de Vries <tdevries@suse.de> | 2021-09-03 17:40:10 +0200 |
commit | e34a209edf13f64c2b13a79186563a501ee28df5 (patch) | |
tree | 82d65cbbc86da6863035b554f529d051b7efff4d | |
parent | 5c177fed07e31081fa88f2dc5ca000363fbb3ad9 (diff) | |
download | gdb-e34a209edf13f64c2b13a79186563a501ee28df5.zip gdb-e34a209edf13f64c2b13a79186563a501ee28df5.tar.gz gdb-e34a209edf13f64c2b13a79186563a501ee28df5.tar.bz2 |
[gdb/testsuite] Add untested case in gdb.gdb/complaints.exp
When building gdb with "-Wall -O2 -g -flto=auto", I run into:
...
(gdb) call clear_complaints()^M
No symbol "clear_complaints" in current context.^M
(gdb) FAIL: gdb.gdb/complaints.exp: clear complaints
...
The problem is that lto has optimized away clear_complaints, and consequently
the selftests cannot run.
Fix this by:
- using info function to detect presence of clear_complaints
- handling the absence of clear_complaints by calling untested
...
(gdb) UNTESTED: gdb.gdb/complaints.exp: \
Cannot find clear_complaints, skipping test
...
Tested on x86_64-linux.
gdb/testsuite/ChangeLog:
2021-09-03 Tom de Vries <tdevries@suse.de>
* gdb.gdb/complaints.exp: Use untested if clear_complaints cannot
be found.
-rw-r--r-- | gdb/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gdb/testsuite/gdb.gdb/complaints.exp | 20 |
2 files changed, 25 insertions, 0 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 42aae6b..ba3eb59 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,5 +1,10 @@ 2021-09-03 Tom de Vries <tdevries@suse.de> + * gdb.gdb/complaints.exp: Use untested if clear_complaints cannot + be found. + +2021-09-03 Tom de Vries <tdevries@suse.de> + * lib/selftest-support.exp: Emit untested when not being able to set breakpoint. diff --git a/gdb/testsuite/gdb.gdb/complaints.exp b/gdb/testsuite/gdb.gdb/complaints.exp index c70825b..2391d66 100644 --- a/gdb/testsuite/gdb.gdb/complaints.exp +++ b/gdb/testsuite/gdb.gdb/complaints.exp @@ -104,6 +104,26 @@ proc test_empty_complaint { cmd msg } { } proc test_empty_complaints { } { + global decimal + + set re [multi_line \ + "All functions matching regular expression \[^:\]*:" \ + "" \ + "File \[^\r\n\]*/complaints\\.c:" \ + "$decimal:\tvoid clear_complaints\\(\\);"] + + set found 0 + gdb_test_multiple "info function ^clear_complaints()$" "" { + -re -wrap $re { + set found 1 + } + -re -wrap "" { + } + } + if { ! $found } { + untested "Cannot find clear_complaints, skipping test" + return 0 + } test_empty_complaint "call clear_complaints()" \ "clear complaints" |