aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gdb/testsuite/gdb.base/structs.exp204
1 files changed, 63 insertions, 141 deletions
diff --git a/gdb/testsuite/gdb.base/structs.exp b/gdb/testsuite/gdb.base/structs.exp
index fcdde93..ae847f8 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