From: Tom de Vries via Gdb-patches <gdb-patches@sourceware.org>
To: gdb-patches@sourceware.org
Subject: [committed][gdb/testsuite] Check compilation result in gdb.base/structs.exp
Date: Thu, 30 Sep 2021 19:09:48 +0200 [thread overview]
Message-ID: <20210930170947.GA25116@delia> (raw)
Hi,
When running test-case gdb.base/structs.exp with target board unix/-bad, I
get:
...
gdb compile failed, gcc: error: unrecognized command line option '-bad'
UNTESTED: gdb.base/structs.exp: failed to prepare
ERROR: tcl error sourcing src/gdb/testsuite/gdb.base/structs.exp.
ERROR: can't read "use_gdb_stub": no such variable
...
Fix this by checking the compilation result.
Fix the resulting DUPLICATEs using with_test_prefix.
Tested on x86_64-linux.
Committed to trunk.
Thanks,
- Tom
[gdb/testsuite] Check compilation result in gdb.base/structs.exp
---
gdb/testsuite/gdb.base/structs.exp | 204 ++++++++++++-------------------------
1 file changed, 63 insertions(+), 141 deletions(-)
diff --git a/gdb/testsuite/gdb.base/structs.exp b/gdb/testsuite/gdb.base/structs.exp
index fcdde93cdd0..ae847f85a50 100644
--- a/gdb/testsuite/gdb.base/structs.exp
+++ b/gdb/testsuite/gdb.base/structs.exp
@@ -71,12 +71,10 @@ proc start_structs_test { types } {
}
# Make certain that the output is consistent
- with_test_prefix "types=$types" {
- gdb_test_no_output "set print sevenbit-strings"
- gdb_test_no_output "set print address off"
- gdb_test_no_output "set width 0"
- gdb_test_no_output "set print elements 300"
- }
+ gdb_test_no_output "set print sevenbit-strings"
+ gdb_test_no_output "set print address off"
+ gdb_test_no_output "set width 0"
+ gdb_test_no_output "set print elements 300"
# Advance to main
if { ![runto_main] } then {
@@ -484,33 +482,43 @@ proc test_struct_returns { n } {
# Test every single char struct from 1..17 in size. This is what the
# original "structs" test was doing.
-start_structs_test { tc }
-test_struct_calls 1
-test_struct_calls 2
-test_struct_calls 3
-test_struct_calls 4
-test_struct_calls 5
-test_struct_calls 6
-test_struct_calls 7
-test_struct_calls 8
-test_struct_calls 9
-test_struct_calls 10
-test_struct_calls 11
-test_struct_calls 12
-test_struct_calls 13
-test_struct_calls 14
-test_struct_calls 15
-test_struct_calls 16
-test_struct_calls 17
-test_struct_returns 1
-test_struct_returns 2
-test_struct_returns 3
-test_struct_returns 4
-test_struct_returns 5
-test_struct_returns 6
-test_struct_returns 7
-test_struct_returns 8
+proc test { types c r } {
+ with_test_prefix types=[join $types "-"] {
+ if { [start_structs_test $types] } {
+ return
+ }
+
+ if { [llength $c] == 0 } {
+ # Done.
+ } elseif { [llength $c] == 1 } {
+ test_struct_calls [lindex $c 0]
+ } elseif { [llength $c] == 2 } {
+ set low_c [lindex $c 0]
+ set high_c [lindex $c 1]
+ for {set i $low_c} {$i <= $high_c} {incr i} {
+ test_struct_calls $i
+ }
+ } else {
+ error "invalid list length"
+ }
+
+ if { [llength $r] == 0 } {
+ # Done.
+ } elseif { [llength $r] == 1 } {
+ test_struct_returns [lindex $r 0]
+ } elseif { [llength $r] == 2 } {
+ set low_r [lindex $r 0]
+ set high_r [lindex $r 1]
+ for {set i $low_r} {$i <= $high_r} {incr i} {
+ test_struct_returns $i
+ }
+ } else {
+ error "invalid list length"
+ }
+ }
+}
+test { tc } {1 17} {1 8}
# Let the fun begin.
@@ -527,165 +535,79 @@ test_struct_returns 8
# naturally aligned. Padding being added where needed.
# Approx size: 2, 4, ...
-start_structs_test { ts }
-test_struct_calls 1
-test_struct_calls 2
-test_struct_calls 3
-test_struct_calls 4
-test_struct_calls 5
-test_struct_returns 1
-test_struct_returns 2
-test_struct_returns 3
-test_struct_returns 4
+test { ts } {1 5} {1 4}
# Approx size: 4, 8, ...
-start_structs_test { ti }
-test_struct_calls 1
-test_struct_calls 2
-test_struct_calls 3
-test_struct_returns 1
-test_struct_returns 2
+test { ti } {1 3} {1 2}
# Approx size: 4, 8, ...
-start_structs_test { tl }
-test_struct_calls 1
-test_struct_calls 2
-test_struct_calls 3
-test_struct_returns 1
-test_struct_returns 2
+test { tl } {1 3} {1 2}
# Approx size: 8, 16, ...
-start_structs_test { tll }
-test_struct_calls 1
-test_struct_calls 2
-test_struct_returns 1
+test { tll } {1 2} {1}
if { !$skip_float_test } {
# Approx size: 4, 8, ...
- start_structs_test { tf }
- test_struct_calls 1
- test_struct_calls 2
- test_struct_calls 3
- test_struct_returns 1
- test_struct_returns 2
+ test { tf } {1 3} {1 2}
# Approx size: 8, 16, ...
- start_structs_test { td }
- test_struct_calls 1
- test_struct_calls 2
- test_struct_returns 1
+ test { td } {1 2} {1}
# Approx size: 16, 32, ...
- start_structs_test { tld }
- test_struct_calls 1
- test_struct_calls 2
- test_struct_returns 1
+ test { tld } {1 2} {1}
}
# Approx size: 2+1=3, 4, ...
-start_structs_test { ts tc }
-test_struct_calls 2
-test_struct_calls 3
-test_struct_calls 4
-test_struct_calls 5
-test_struct_calls 6
-test_struct_calls 7
-test_struct_calls 8
-test_struct_returns 2
+test { ts tc } {2 8} {2}
# Approx size: 4+1=5, 6, ...
-start_structs_test { ti tc }
-test_struct_calls 2
-test_struct_calls 3
-test_struct_calls 4
-test_struct_calls 5
-test_struct_calls 6
-test_struct_returns 2
+test { ti tc } {2 6} {2}
# Approx size: 4+1=5, 6, ...
-start_structs_test { tl tc }
-test_struct_calls 2
-test_struct_calls 3
-test_struct_calls 4
-test_struct_calls 5
-test_struct_calls 6
-test_struct_returns 2
+test { tl tc } {2 6} {2}
# Approx size: 8+1=9, 10, ...
-start_structs_test { tll tc }
-test_struct_calls 2
+test { tll tc } {2} {}
if { !$skip_float_test } {
# Approx size: 4+1=5, 6, ...
- start_structs_test { tf tc }
- test_struct_calls 2
- test_struct_calls 3
- test_struct_calls 4
- test_struct_calls 5
- test_struct_calls 6
- test_struct_returns 2
+ test { tf tc } {2 6} {2}
# Approx size: 8+1=9, 10, ...
- start_structs_test { td tc }
- test_struct_calls 2
+ test { td tc } {2} {}
# Approx size: 16+1=17, 18, ...
- start_structs_test { tld tc }
- test_struct_calls 2
+ test { tld tc } {2} {}
}
# Approx size: (1+1)+2=4, 6, ...
-start_structs_test { tc ts }
-test_struct_calls 2
-test_struct_calls 3
-test_struct_calls 4
-test_struct_calls 5
-test_struct_calls 6
-test_struct_returns 2
+test { tc ts } {2 6} {2}
# Approx size: (1+3)+4=8, 12, ...
-start_structs_test { tc ti }
-test_struct_calls 2
-test_struct_calls 3
-test_struct_calls 4
-test_struct_returns 2
+test { tc ti } {2 4} {2}
# Approx size: (1+3)+4=8, 12, ...
-start_structs_test { tc tl }
-test_struct_calls 2
-test_struct_calls 3
-test_struct_calls 4
-test_struct_returns 2
+test { tc tl } {2 4} {2}
# Approx size: (1+7)+8=16, 24, ...
-start_structs_test { tc tll }
-test_struct_calls 2
+test { tc tll } {2} {}
if { !$skip_float_test } {
# Approx size: (1+3)+4=8, 12, ...
- start_structs_test { tc tf }
- test_struct_calls 2
- test_struct_calls 3
- test_struct_calls 4
+ test { tc tf } {2 4} {}
# Approx size: (1+7)+8=16, 24, ...
- start_structs_test { tc td }
- test_struct_calls 2
+ test { tc td } {2} {}
# Approx size: (1+15)+16=32, 48, ...
- start_structs_test { tc tld }
- test_struct_calls 2
+ test { tc tld } {2} {}
# Some float combinations
# Approx size: 8+4=12, 16, ...
- start_structs_test { td tf }
- test_struct_calls 2
- test_struct_returns 2
+ test { td tf } {2} {2}
# Approx size: (4+4)+8=16, 32, ...
- start_structs_test { tf td }
- test_struct_calls 2
- test_struct_returns 2
+ test { tf td } {2} {2}
}
return 0
reply other threads:[~2021-09-30 17:11 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210930170947.GA25116@delia \
--to=gdb-patches@sourceware.org \
--cc=tdevries@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox