From: Tom de Vries <tdevries@suse.de>
To: gdb-patches@sourceware.org
Subject: [pushed 2/3] [gdb/testsuite] Modernize gdb.base/attach-twice.exp
Date: Mon, 23 Nov 2026 14:03:47 +0100 [thread overview]
Message-ID: <20261123130348.767273-3-tdevries@suse.de> (raw)
In-Reply-To: <20261123130348.767273-1-tdevries@suse.de>
Modernize gdb.base/attach-twice.exp:
- use multi_line, -wrap, $gdb_test_name and subst_vars
- drop the superfluous variable executable
---
gdb/testsuite/gdb.base/attach-twice.exp | 27 ++++++++++++++++---------
1 file changed, 17 insertions(+), 10 deletions(-)
diff --git a/gdb/testsuite/gdb.base/attach-twice.exp b/gdb/testsuite/gdb.base/attach-twice.exp
index e2db55187d2..8daca83380c 100644
--- a/gdb/testsuite/gdb.base/attach-twice.exp
+++ b/gdb/testsuite/gdb.base/attach-twice.exp
@@ -16,9 +16,8 @@
require can_spawn_for_attach
standard_testfile
-set executable ${testfile}
-if { [prepare_for_testing "failed to prepare" $executable] } {
+if { [prepare_for_testing "failed to prepare" $testfile] } {
return
}
@@ -30,17 +29,25 @@ set testpid [spawn_id_get_pid $test_spawn_id]
set child_pid 0
-set test "attach"
-gdb_test_multiple "attach $testpid" $test {
- -re "Attaching to program: \[^\r\n\]*, process $testpid\r\n.*warning: process $testpid is already traced by process (${::decimal})\r\n.*ptrace: Operation not permitted\\.\r\n$gdb_prompt $" {
+set re_pass \
+ [multi_line \
+ [subst_vars {Attaching to program: [^\r\n]*, process $testpid}] \
+ ".*warning: process $testpid is already traced by process ($decimal)" \
+ {.*ptrace: Operation not permitted[.]}]
+set re_fail \
+ [multi_line \
+ [subst_vars {Attaching to program: [^\r\n]*, process $testpid}] \
+ {.*ptrace: Operation not permitted[.]}]
+gdb_test_multiple "attach $testpid" "attach" {
+ -re -wrap $re_pass {
set child_pid $expect_out(1,string)
- pass $test
+ pass $gdb_test_name
}
- -re "Attaching to program: \[^\r\n\]*, process $testpid\r\n.*ptrace: Operation not permitted\\.\r\n$gdb_prompt $" {
- fail $test
+ -re -wrap $re_fail {
+ fail $gdb_test_name
}
- -re "\r\n$gdb_prompt $" {
- xfail $test
+ -re -wrap "" {
+ xfail $gdb_test_name
}
}
--
2.51.0
next prev parent reply other threads:[~2026-11-23 13:05 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-23 13:03 [pushed 0/3] [gdb/testsuite] Modernize two test-cases Tom de Vries
2026-11-23 13:03 ` [pushed 1/3] [gdb/testsuite] Rename variable in test-case gdb.base/attach-twice.exp Tom de Vries
2026-11-23 13:03 ` Tom de Vries [this message]
2026-11-23 13:03 ` [pushed 3/3] [gdb/testsuite] Modernize gdb.base/attach-non-pgrp-leader.exp Tom de Vries
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=20261123130348.767273-3-tdevries@suse.de \
--to=tdevries@suse.de \
--cc=gdb-patches@sourceware.org \
/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