[08/11] gdb, testsuite: handle async close in monitor-exit-quit.exp

Message ID 20260518183316.127043-9-mohamed.bouhaouel@intel.com
State New
Headers
Series Enable non-stop mode by default for remote targets |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_gdb_build--master-aarch64 success Build passed
linaro-tcwg-bot/tcwg_gdb_build--master-arm success Build passed
linaro-tcwg-bot/tcwg_gdb_check--master-aarch64 success Test passed
linaro-tcwg-bot/tcwg_gdb_check--master-arm success Test passed

Commit Message

Bouhaouel, Mohamed May 18, 2026, 6:33 p.m. UTC
  From: "Bouhaouel, Mohamed" <mohamed.bouhaouel@intel.com>

With non-stop remote targets, the "Remote connection closed"
notification arrives asynchronously after "monitor exit" and may appear
while processing the quit command, causing test failures.

Fix by using "with confirm off -- quit" and handling the async
notification in the quit sequence.
---
 gdb/testsuite/gdb.server/monitor-exit-quit.exp | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
  

Patch

diff --git a/gdb/testsuite/gdb.server/monitor-exit-quit.exp b/gdb/testsuite/gdb.server/monitor-exit-quit.exp
index cb90169ef0c..f0db907576e 100644
--- a/gdb/testsuite/gdb.server/monitor-exit-quit.exp
+++ b/gdb/testsuite/gdb.server/monitor-exit-quit.exp
@@ -50,11 +50,16 @@  set gdbserver_gdbport [lindex $res 1]
 gdb_target_cmd $gdbserver_protocol $gdbserver_gdbport
 
 gdb_test_no_output "monitor exit"
-gdb_test_no_output "set confirm off"
 
 set do_cleanup 1
 
-gdb_test_multiple "quit" "" {
+gdb_test_multiple "with confirm off -- quit" "" {
+    -re -wrap "Remote connection closed.*" {
+	# With non-stop remote targets, the "Remote connection closed"
+	# notification is delivered asynchronously and may appear while
+	# processing the quit command.
+	exp_continue
+    }
     -re -wrap "" {
 	fail "$gdb_test_name (prompt)"
 	# Let default_gdb_exit do the cleanup.