From: Simon Marchi <simon.marchi@polymtl.ca>
To: Tiezhu Yang <yangtiezhu@loongson.cn>, gdb-patches@sourceware.org
Cc: Pedro Alves <pedro@palves.net>
Subject: Re: [PATCH v4 2/4] gdb: testsuite: add new gdb_attach to check "attach" command
Date: Mon, 21 Mar 2022 11:00:25 -0400 [thread overview]
Message-ID: <54270fdb-4067-4be9-7621-e12f2d2e2361@polymtl.ca> (raw)
In-Reply-To: <1647655887-13964-3-git-send-email-yangtiezhu@loongson.cn>
On 2022-03-18 22:11, Tiezhu Yang wrote:
> This commit adds new gdb_attach to centralize the failure checking of
> "attach" command. Return 0 if attach failed, otherwise return 1.
>
> Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
> ---
> gdb/testsuite/lib/gdb.exp | 24 ++++++++++++++++++++++++
> 1 file changed, 24 insertions(+)
>
> diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
> index 89dcd0a..149a1c3 100644
> --- a/gdb/testsuite/lib/gdb.exp
> +++ b/gdb/testsuite/lib/gdb.exp
> @@ -5111,6 +5111,30 @@ proc can_spawn_for_attach { } {
> return 1
> }
>
> +# Centralize the failure checking of "attach" command.
> +# Return 0 if attach failed, otherwise return 1.
> +
> +proc gdb_attach { testpid args } {
> + parse_args {
> + {pattern ""}
> + }
> +
> + if { [llength $args] != 0 } {
> + error "Unexpected arguments: $args"
> + }
> +
> + gdb_test_multiple "attach $testpid" "attach" {
> + -re -wrap "Attaching to.*ptrace: Operation not permitted\\." {
> + unsupported "$gdb_test_name (Operation not permitted)"
> + return 0
> + }
> + -re -wrap "$pattern" {
> + pass $gdb_test_name
> + return 1
> + }
> + }
> +}
I guess we need a "return 0" at the end of the function, in case the test does fail?
Simon
next prev parent reply other threads:[~2022-03-21 15:00 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-19 2:11 [PATCH v4 0/4] gdb: add gdb_attach to fix failed testcases Tiezhu Yang
2022-03-19 2:11 ` [PATCH v4 1/4] gdb: testsuite: remove attach test from can_spawn_for_attach Tiezhu Yang
2022-03-19 2:11 ` [PATCH v4 2/4] gdb: testsuite: add new gdb_attach to check "attach" command Tiezhu Yang
2022-03-21 15:00 ` Simon Marchi [this message]
2022-03-22 3:27 ` Tiezhu Yang
2022-03-19 2:11 ` [PATCH v4 3/4] gdb: testsuite: use gdb_attach to fix attach-pie-noexec.exp Tiezhu Yang
2022-03-19 2:11 ` [PATCH v4 4/4] gdb: testsuite: use gdb_attach to fix jit-elf.exp Tiezhu Yang
2022-03-21 23:04 ` [PATCH v4 0/4] gdb: add gdb_attach to fix failed testcases Kevin Buettner
2022-03-22 3:30 ` Tiezhu Yang
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=54270fdb-4067-4be9-7621-e12f2d2e2361@polymtl.ca \
--to=simon.marchi@polymtl.ca \
--cc=gdb-patches@sourceware.org \
--cc=pedro@palves.net \
--cc=yangtiezhu@loongson.cn \
/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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).