aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.base/dump.exp
diff options
context:
space:
mode:
authorAndrew Burgess <andrew.burgess@embecosm.com>2019-09-15 21:50:17 -0400
committerAndrew Burgess <andrew.burgess@embecosm.com>2019-10-03 17:48:03 +0100
commit2b74ba5a194fdfb152465e786a173b039e28964a (patch)
tree4add8f54de9161e60ad746ce0dafd2750860d601 /gdb/testsuite/gdb.base/dump.exp
parent58eb20d527dbb0ebf26c21ecb32263def26d4593 (diff)
downloadgdb-2b74ba5a194fdfb152465e786a173b039e28964a.zip
gdb-2b74ba5a194fdfb152465e786a173b039e28964a.tar.gz
gdb-2b74ba5a194fdfb152465e786a173b039e28964a.tar.bz2
gdb/testsuite: Reduce test name duplication in gdb.base tests
This commit removes some, but not all, of the test name duplication within the gdb.base tests. On my local machine this takes the number of duplicate test names in this set of tests from 454 to 145. It is possible that different setups might encounter more duplicate tests. gdb/testsuite/ChangeLog: * gdb.base/break-interp.exp: Reduce test name duplication. * gdb.base/call-sc.exp: Likewise. * gdb.base/callfuncs.exp: Likewise. * gdb.base/charset.exp: Likewise. * gdb.base/dump.exp: Likewise. * gdb.base/ena-dis-br.exp: Likewise. * gdb.base/relational.exp: Likewise. * gdb.base/step-over-syscall.exp: Likewise. * gdb.base/structs.exp: Likewise.
Diffstat (limited to 'gdb/testsuite/gdb.base/dump.exp')
-rw-r--r--gdb/testsuite/gdb.base/dump.exp44
1 files changed, 27 insertions, 17 deletions
diff --git a/gdb/testsuite/gdb.base/dump.exp b/gdb/testsuite/gdb.base/dump.exp
index 77db179..7635b6b 100644
--- a/gdb/testsuite/gdb.base/dump.exp
+++ b/gdb/testsuite/gdb.base/dump.exp
@@ -30,6 +30,17 @@ if [istarget "alpha*-*-*"] then {
lappend options "additional_flags=-Wl,-taso"
}
+# Runs the command 'print zero_all ()'. Uses the PRINT_ZERO_ALL_COUNT
+# global to ensure the test names are unique.
+set print_zero_all_count 0
+proc print_zero_all { } {
+ global print_zero_all_count
+
+ incr print_zero_all_count
+ gdb_test "print zero_all ()" " = void" \
+ "call ${print_zero_all_count} to zero_all function"
+}
+
# Debian9/Ubuntu16.10 onwards default to PIE enabled. Ensure it is disabled as
# this causes addresses to be out of range for IHEX.
lappend options {nopie}
@@ -272,7 +283,6 @@ proc test_restore_saved_value { restore_args msg oldval newval } {
if ![string compare $is64bitonly "no"] then {
- gdb_test "print zero_all ()" ".*"
test_restore_saved_value "[set intarr1.srec]" "array as value, srec" \
$array_val "intarray"
@@ -280,7 +290,7 @@ if ![string compare $is64bitonly "no"] then {
test_restore_saved_value "[set intstr1.srec]" "struct as value, srec" \
$struct_val "intstruct"
- gdb_test "print zero_all ()" "void" "zero all"
+ print_zero_all
test_restore_saved_value "[set intarr2.srec]" "array as memory, srec" \
$array_val "intarray"
@@ -288,7 +298,7 @@ if ![string compare $is64bitonly "no"] then {
test_restore_saved_value "[set intstr2.srec]" "struct as memory, srec" \
$struct_val "intstruct"
- gdb_test "print zero_all ()" ".*"
+ print_zero_all
test_restore_saved_value "[set intarr1.ihex]" "array as value, ihex" \
$array_val "intarray"
@@ -296,7 +306,7 @@ if ![string compare $is64bitonly "no"] then {
test_restore_saved_value "[set intstr1.ihex]" "struct as value, ihex" \
$struct_val "intstruct"
- gdb_test "print zero_all ()" ".*"
+ print_zero_all
test_restore_saved_value "[set intarr2.ihex]" "array as memory, ihex" \
$array_val "intarray"
@@ -304,7 +314,7 @@ if ![string compare $is64bitonly "no"] then {
test_restore_saved_value "[set intstr2.ihex]" "struct as memory, ihex" \
$struct_val "intstruct"
- gdb_test "print zero_all ()" ".*"
+ print_zero_all
test_restore_saved_value "[set intarr1.tekhex]" "array as value, tekhex" \
$array_val "intarray"
@@ -312,7 +322,7 @@ if ![string compare $is64bitonly "no"] then {
test_restore_saved_value "[set intstr1.tekhex]" "struct as value, tekhex" \
$struct_val "intstruct"
- gdb_test "print zero_all ()" ".*"
+ print_zero_all
test_restore_saved_value "[set intarr2.tekhex]" "array as memory, tekhex" \
$array_val "intarray"
@@ -321,7 +331,7 @@ if ![string compare $is64bitonly "no"] then {
$struct_val "intstruct"
}
-gdb_test "print zero_all ()" ".*"
+print_zero_all
test_restore_saved_value "[set intarr1.bin] binary $array_start" \
"array as value, binary" \
@@ -331,7 +341,7 @@ test_restore_saved_value "[set intstr1.bin] binary $struct_start" \
"struct as value, binary" \
$struct_val "intstruct"
-gdb_test "print zero_all ()" ".*"
+print_zero_all
test_restore_saved_value "[set intarr2.bin] binary $array_start" \
"array as memory, binary" \
@@ -350,7 +360,7 @@ set array2_offset \
set struct2_offset \
[capture_value "(char *) &intstruct2 - (char *) &intstruct"]
-gdb_test "print zero_all ()" ".*"
+print_zero_all
if ![string compare $is64bitonly "no"] then {
@@ -362,7 +372,7 @@ if ![string compare $is64bitonly "no"] then {
"struct copy, srec" \
$struct_val "intstruct2"
- gdb_test "print zero_all ()" ".*"
+ print_zero_all
test_restore_saved_value "[set intarr1.ihex] $array2_offset" \
"array copy, ihex" \
@@ -372,7 +382,7 @@ if ![string compare $is64bitonly "no"] then {
"struct copy, ihex" \
$struct_val "intstruct2"
- gdb_test "print zero_all ()" ".*"
+ print_zero_all
test_restore_saved_value "[set intarr1.tekhex] $array2_offset" \
"array copy, tekhex" \
@@ -383,7 +393,7 @@ if ![string compare $is64bitonly "no"] then {
$struct_val "intstruct2"
}
-gdb_test "print zero_all ()" ".*"
+print_zero_all
test_restore_saved_value "[set intarr1.bin] binary $array2_start" \
"array copy, binary" \
@@ -410,7 +420,7 @@ set element4_offset \
[capture_value "/x (char *) &intarray\[4\] - (char *) &intarray\[0\]"]
if ![string compare $is64bitonly "no"] then {
- gdb_test "print zero_all ()" ".*"
+ print_zero_all
test_restore_saved_value "[set intarr1.srec] 0 $element3_start $element4_start" \
"array partial, srec" 4 "intarray\[3\]"
@@ -418,7 +428,7 @@ if ![string compare $is64bitonly "no"] then {
gdb_test "print intarray\[2\] == 0" " = 1" "element 2 not changed - 1"
gdb_test "print intarray\[4\] == 0" " = 1" "element 4 not changed - 1"
- gdb_test "print zero_all ()" ".*"
+ print_zero_all
test_restore_saved_value "[set intarr1.ihex] 0 $element3_start $element4_start" \
"array partial, ihex" 4 "intarray\[3\]"
@@ -426,7 +436,7 @@ if ![string compare $is64bitonly "no"] then {
gdb_test "print intarray\[2\] == 0" " = 1" "element 2 not changed - 2"
gdb_test "print intarray\[4\] == 0" " = 1" "element 4 not changed - 2"
- gdb_test "print zero_all ()" ".*"
+ print_zero_all
test_restore_saved_value "[set intarr1.tekhex] 0 $element3_start $element4_start" \
"array partial, tekhex" 4 "intarray\[3\]"
@@ -435,7 +445,7 @@ if ![string compare $is64bitonly "no"] then {
gdb_test "print intarray\[4\] == 0" " = 1" "element 4 not changed - 3"
}
-gdb_test "print zero_all ()" ".*"
+print_zero_all
test_restore_saved_value \
"[set intarr1.bin] binary $array_start $element3_offset $element4_offset" \
@@ -445,7 +455,7 @@ gdb_test "print intarray\[2\] == 0" " = 1" "element 2 not changed - 4"
gdb_test "print intarray\[4\] == 0" " = 1" "element 4 not changed - 4"
if ![string compare $is64bitonly "no"] then {
- gdb_test "print zero_all ()" ".*" ""
+ print_zero_all
# restore with expressions
test_restore_saved_value \