]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
[gdb/testsuite] Fix error in gdb.server/server-kill-python.exp
authorTom de Vries <tdevries@suse.de>
Wed, 12 Jun 2024 17:15:45 +0000 (19:15 +0200)
committerTom de Vries <tdevries@suse.de>
Wed, 12 Jun 2024 17:15:45 +0000 (19:15 +0200)
With test-case gdb.server/server-kill-python.exp, I sometimes run into:
...
builtin_spawn gdb -nw -nx -q -iex set height 0 -iex set width 0 \
  -data-directory data-directory^M
kill^M
(gdb) kill^M
file server-kill-python^M
The program is not being run.^M
(gdb) ERROR: Couldn't load server-kill-python into GDB.
...

The problem is that the spawn produces a prompt, but it's not explicitly
consumed.

This is a regression since commit 0f077fcae0f ("[gdb/testsuite] Simplify
gdb.server/server-kill-python.exp").

Fix this by consuming the initial prompt.

PR testsuite/31819
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31819
Fixes: 0f077fcae0f ("[gdb/testsuite] Simplify gdb.server/server-kill-python.exp"
gdb/testsuite/gdb.server/server-kill-python.exp

index e9066caa6cbab09903f387175788528c5f83b3c4..a771e6f66598767bd4a842e17ff60dca27803fd3 100644 (file)
@@ -61,6 +61,12 @@ if {[gdb_spawn]} {
     return
 }
 
+gdb_test_multiple "" "initial prompt" {
+    -re "^$gdb_prompt $" {
+       pass $gdb_test_name
+    }
+}
+
 gdb_load $binfile
 gdb_target_cmd $gdbserver_protocol $gdbserver_gdbport