aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite
diff options
context:
space:
mode:
authorTom de Vries <tdevries@suse.de>2024-09-23 22:03:56 +0200
committerTom de Vries <tdevries@suse.de>2024-09-23 22:03:56 +0200
commit2edcfde44c5bf915af5fbe2f25ebafd7ba57fad3 (patch)
tree8627469d2a9ba3da5435a1bbb38b77072dff4702 /gdb/testsuite
parent336bb2a1c1d24f5db07394a109f7cd6c5b58b10d (diff)
downloadgdb-2edcfde44c5bf915af5fbe2f25ebafd7ba57fad3.zip
gdb-2edcfde44c5bf915af5fbe2f25ebafd7ba57fad3.tar.gz
gdb-2edcfde44c5bf915af5fbe2f25ebafd7ba57fad3.tar.bz2
[gdb/testsuite] Avoid large timeout in gdb.base/checkpoint.exp
I ran the testsuite in an environment simulating a stressed system, and the only test-cases that timed out in gdb.base were gdb.base/checkpoint.exp and gdb.base/checkpoint-ns.exp (which includes gdb.base/checkpoints.exp). In test-case gdb.base/checkpoint.exp there's a part where the timeout is increased with 120 seconds (in the default case that's from 10 to 130), to accommodate for a single command creating 600+ checkpoints. Instead, rewrite the test to present a gdb prompt each time a checkpoint is created, for which the default timeout is sufficient. Also ensure that the amount of checkpoints added is exactly 600 rather than 600+. Tested on aarch64-linux. Approved-By: Tom Tromey <tom@tromey.com>
Diffstat (limited to 'gdb/testsuite')
-rw-r--r--gdb/testsuite/gdb.base/checkpoint.exp50
1 files changed, 32 insertions, 18 deletions
diff --git a/gdb/testsuite/gdb.base/checkpoint.exp b/gdb/testsuite/gdb.base/checkpoint.exp
index f87f528..31b5a13 100644
--- a/gdb/testsuite/gdb.base/checkpoint.exp
+++ b/gdb/testsuite/gdb.base/checkpoint.exp
@@ -295,30 +295,48 @@ clean_restart $binfile
runto_main
gdb_breakpoint $break1_loc
-gdb_test "commands\nsilent\nif (lines % 2)\ncheckpoint\nend\n continue\nend" \
+set cmd \
+ [join \
+ [list \
+ "commands" \
+ "if (lines % 2)" \
+ " checkpoint" \
+ "else" \
+ " continue" \
+ "end" \
+ "end"] \
+ "\n"]
+gdb_test $cmd \
"" \
"set checkpoint breakpoint"
-set prev_timeout $timeout
-set timeout [expr $timeout + 120]
-verbose "Timeout now $timeout sec."
-
-gdb_breakpoint $break2_loc
-gdb_test "continue" "breakpoint 2.*" "break2 with many checkpoints"
+set nr_ok 0
+for {set iter 0} {$iter < 600} {incr iter} {
+ set ok 0
+ gdb_test_multiple "continue" "" {
+ -re -wrap "breakpoint 1.*" {
+ set ok 1
+ }
+ -re -wrap "" {
+ }
+ }
+ if { $ok } {
+ incr nr_ok
+ } else {
+ break
+ }
+}
+gdb_assert { $nr_ok == 600 } "break1 with many checkpoints"
set count 0
set msg "info checkpoints with at least 600 checkpoints"
gdb_test_multiple "info checkpoints" $msg {
- -re " $decimal process \[^\r\]*\r\n" {
+ -re "\r\n $decimal process \[^\r\]*" {
incr count
exp_continue
}
- -re "$gdb_prompt $" {
- if { $count >= 600 } {
- pass $msg
- } else {
- fail $msg
- }
+ -re -wrap "" {
+ gdb_assert { $count == 600 } $gdb_test_name
}
}
@@ -329,10 +347,6 @@ gdb_test_multiple "info checkpoints" $msg {
gdb_test "kill" "" "kill all one with many checkpoints" \
"Kill the program being debugged.*y or n. $" "y"
-# Restore old timeout
-set timeout $prev_timeout
-verbose "Timeout now $timeout sec."
-
#
# Finished: cleanup
#