Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH] gdb/testsuite: accept any shell's error in non-existing-program.exp
@ 2026-11-08 14:09 Josip Seketa
  0 siblings, 0 replies; only message in thread
From: Josip Seketa @ 2026-11-08 14:09 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom de Vries

With startup-with-shell, gdbserver runs the program through $SHELL,
and the test expects the error that a POSIX shell or bash prints for a
missing program:

  exec: non-existing-program: not found

Other shells word it differently.  With SHELL=/usr/bin/zsh:

  zsh:1: command not found: non-existing-program
  During startup program exited with code 127.
  Exiting
  FAIL: gdb.server/non-existing-program.exp: gdbserver exits cleanly

Accept any line that names the program, followed by the exit with code
127.
---
Tested on x86_64 GNU/Linux with native-gdbserver and
native-extended-gdbserver: passes with SHELL set to /bin/sh, bash, zsh
and fish; without this patch it fails with zsh and fish.

I have no FSF copyright assignment.  This is my own work, not my
employer's.

 gdb/testsuite/gdb.server/non-existing-program.exp | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/gdb/testsuite/gdb.server/non-existing-program.exp b/gdb/testsuite/gdb.server/non-existing-program.exp
index 34a9f047a24..6729981cac6 100644
--- a/gdb/testsuite/gdb.server/non-existing-program.exp
+++ b/gdb/testsuite/gdb.server/non-existing-program.exp
@@ -47,8 +47,10 @@ expect {
 	exp_continue
     }
     # Likewise, but with startup-with-shell enabled, which is the
-    # default behavior.
-    -re "stdin/stdout redirected.*exec: non-existing-program: not found\r\nDuring startup program exited with code 127\.\r\nExiting\r\n" {
+    # default behavior.  Each shell words the error its own way, for
+    # example "exec: non-existing-program: not found" or "command not
+    # found: non-existing-program", over one line or more.
+    -re "stdin/stdout redirected.*non-existing-program\[^\r\n\]*\r\n.*During startup program exited with code 127\.\r\nExiting\r\n" {
 	set saw_exiting 1
 	exp_continue
     }
-- 
2.56.0


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-11-08 14:10 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-08 14:09 [PATCH] gdb/testsuite: accept any shell's error in non-existing-program.exp Josip Seketa

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox