Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Josip Seketa <josip.seketa@gmail.com>
To: gdb-patches@sourceware.org
Cc: Tom de Vries <tdevries@suse.de>
Subject: [PATCH] gdb/testsuite: accept any shell's error in non-existing-program.exp
Date: Sun, 08 Nov 2026 14:09:53 +0000	[thread overview]
Message-ID: <179414699302.1085057.4969927483463461350@gmail.com> (raw)

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


                 reply	other threads:[~2026-11-08 14:10 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=179414699302.1085057.4969927483463461350@gmail.com \
    --to=josip.seketa@gmail.com \
    --cc=gdb-patches@sourceware.org \
    --cc=tdevries@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox