public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Simon Marchi <simon.marchi@polymtl.ca>
To: Tiezhu Yang <yangtiezhu@loongson.cn>, gdb-patches@sourceware.org
Subject: Re: [PATCH v4 1/2] gdb: testsuite: print explicit test result in can_spawn_for_attach()
Date: Tue, 22 Feb 2022 09:42:52 -0500	[thread overview]
Message-ID: <ea85148e-623e-f99f-b2ff-f39a9628504f@polymtl.ca> (raw)
In-Reply-To: <1645533747-32005-2-git-send-email-yangtiezhu@loongson.cn>

On 2022-02-22 07:42, Tiezhu Yang wrote:
> In the current code, there is no test result when execute the following
> commands:
> 
>   $ make check-gdb TESTS="gdb.base/attach-pie-noexec.exp" RUNTESTFLAGS="--target_board=remote-gdbserver-on-localhost"
>   $ make check-gdb TESTS="gdb.base/attach-pie-noexec.exp" RUNTESTFLAGS="--target_board=native-gdbserver"
> 
> It is better to print explicit test result in can_spawn_for_attach().
> 
> Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>

It could be that some test uses this procedure not to skip some tests,
but to choose between two alternatives.  In that case, we wouldn't want
to show an "UNTESTED".  On the other hand, if you can confirm that all
current uses of can_spawn_for_attach are for simply skipping tests, then
it's probably fine.

To make it non-ambiguous, we could rename can_spawn_for_attach to
skip_attach_tests, very similar to the skip_python_tests procedure.
Then it would be clear what it is for (skipping attach tests if attach
is not supported by the target).  And skip_python_tests does show an
"UNSUPPORTED" if Python support is disabled, so it would makes sense to
do the same for attach.

I think that "unsupported" is more accurate than "untested" in this
case:

https://www.gnu.org/software/dejagnu/manual/untested-procedure.html
https://www.gnu.org/software/dejagnu/manual/unsupported-procedure.html

> ---
>  gdb/testsuite/lib/gdb.exp | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
> index a3717a4..d15ab90 100644
> --- a/gdb/testsuite/lib/gdb.exp
> +++ b/gdb/testsuite/lib/gdb.exp
> @@ -5063,6 +5063,7 @@ proc can_spawn_for_attach { } {
>      # back the pid of the program.  On remote boards, that would give
>      # us instead the PID of e.g., the ssh client, etc.
>      if [is_remote target] then {
> +	untested "skipping tests due to is_remote target"
>  	return 0
>      }
>  
> @@ -5070,6 +5071,7 @@ proc can_spawn_for_attach { } {
>      # stub-like, where GDB finds the program already started on
>      # initial connection.
>      if {[target_info exists use_gdb_stub]} {
> +	untested "skipping tests due to use_gdb_stub"
>  	return 0
>      }

So I would suggest using:

  unsupported "skip attach tests (target is remote)"
  unsupported "skip attach tests (target is stub)"

That makes "skipping attach tests" the name of the test (identical in
both cases), and the part in parenthesis is additional details.  See:

  https://sourceware.org/gdb/wiki/GDBTestcaseCookbook#Do_not_use_.22tail_parentheses.22_on_test_messages

Simon

  reply	other threads:[~2022-02-22 14:43 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-22 12:42 [PATCH v4 0/2] Modify can_spawn_for_attach Tiezhu Yang
2022-02-22 12:42 ` [PATCH v4 1/2] gdb: testsuite: print explicit test result in can_spawn_for_attach() Tiezhu Yang
2022-02-22 14:42   ` Simon Marchi [this message]
2022-02-22 12:42 ` [PATCH v4 2/2] gdb: testsuite: fix wrong expected result in attach-pie-noexec.exp 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=ea85148e-623e-f99f-b2ff-f39a9628504f@polymtl.ca \
    --to=simon.marchi@polymtl.ca \
    --cc=gdb-patches@sourceware.org \
    --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).