]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
gdb/testsuite: Remove duplicates from gdb.mi/mi-nonstop-exit.exp
authorLancelot SIX <lsix@lancelotsix.com>
Tue, 23 Nov 2021 13:42:13 +0000 (13:42 +0000)
committerLancelot SIX <lsix@lancelotsix.com>
Fri, 7 Jan 2022 22:43:34 +0000 (22:43 +0000)
When running the testsuite, I have:

    Running .../gdb/testsuite/gdb.mi/mi-nonstop-exit.exp ...
    DUPLICATE: gdb.mi/mi-nonstop-exit.exp: breakpoint at main
    DUPLICATE: gdb.mi/mi-nonstop-exit.exp: mi runto main

This test runs the same sequence of operations twice.  Refactor the code
by running both of those sequences within a foreach_with_prefix block to
ensure that the commands have unique test names.

Tested on x86_64-linux.

gdb/testsuite/gdb.mi/mi-nonstop-exit.exp

index 17e8de5b8bd5b973c4ebac2a2a7c434534a0ff86..9e650b82534e88c7e63f62f0e18fbab2ff960b2a 100644 (file)
@@ -39,24 +39,15 @@ save_vars { GDBFLAGS } {
 mi_gdb_test "-gdb-set mi-async 1" ".*"
 mi_detect_async
 
-if { [mi_runto_main] < 0 } {
-    continue
-}
-
-mi_send_resuming_command "exec-continue" "continue"
-
-mi_expect_stop "exited-normally" "" "" "" "" "" "finished exec continue"
+foreach_with_prefix iteration {1 2} {
+    mi_delete_breakpoints
+    if { [mi_runto_main] < 0 } {
+        continue
+    }
 
-# Run the program again.
+    mi_send_resuming_command "exec-continue" "continue"
 
-mi_delete_breakpoints
-
-if { [mi_runto_main] < 0 } {
-    continue
+    mi_expect_stop "exited-normally" "" "" "" "" "" "finished exec continue"
 }
 
-mi_send_resuming_command "exec-continue" "continue (2)"
-
-mi_expect_stop "exited-normally" "" "" "" "" "" "finished exec continue (2)"
-
 mi_gdb_exit