public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Kevin Buettner <kevinb@redhat.com>
To: gdb-patches@sourceware.org, Tiezhu Yang <yangtiezhu@loongson.cn>
Subject: Re: [PATCH v5 2/2] gdb: testsuite: fix wrong expected result in attach-pie-noexec.exp
Date: Fri, 18 Mar 2022 13:43:53 -0700	[thread overview]
Message-ID: <20220318134353.5dd21787@f35-zws-1> (raw)
In-Reply-To: <20220318130723.469573af@f35-zws-1>

I've spent a few more minutes looking at the current version
of can_spawn_for_attach.  The latter part of it currently looks
like this:

...
    gdb_test_multiple "attach $test_pid" "can spawn for attach" {
        -re -wrap "Attaching to process $test_pid\r\n.*No executable file now.*" {
          pass $gdb_test_name
          kill_wait_spawned_process $test_spawn_id
          return 1
        }
        -re -wrap "Attaching to process $test_pid\r\n.*ptrace: Operation not permitted\\." {
          unsupported "$gdb_test_name (Operation not permitted)"
          kill_wait_spawned_process $test_spawn_id
          return 0
        }
        -re -wrap "Attaching to process $test_pid\r\n.*Attaching to process $test_pid failed" {
          unsupported "$gdb_test_name (Attaching to process failed)"
          kill_wait_spawned_process $test_spawn_id
          return 0
        }
        -re -wrap "Attaching to process $test_pid\r\n.*XML support was disabled at compile time.*" {
          pass $gdb_test_name
          kill_wait_spawned_process $test_spawn_id
          return 1
        }
        -re "A program is being debugged already.  Kill it. .y or n. " {
          send_gdb "y\n"
          exp_continue
        }
    }

    kill_wait_spawned_process $test_spawn_id

    # Assume yes.
    return 1
}

Note that there are return statements for all but one of the
gdb_test_multiple cases with a final return (assuming yes) at the end
of the proc.  Assuming "yes" seems wrong to me; when
gdb_test_multiple fails (due to not matching any of the explicit REs),
it'll FAIL.  I think we should be returning 0 when that happens.
However, this means that you'll need to match all cases which
should pass and return 1 for those cases.

I also think you revisit Pedro's remarks regarding caching procs
passing or failing here:

https://sourceware.org/pipermail/gdb-patches/2022-March/186311.html

Kevin


  reply	other threads:[~2022-03-18 20:43 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-23  2:45 [PATCH v5 0/2] Modify can_spawn_for_attach Tiezhu Yang
2022-02-23  2:45 ` [PATCH v5 1/2] gdb: testsuite: print explicit test result in can_spawn_for_attach Tiezhu Yang
2022-02-23  2:45 ` [PATCH v5 2/2] gdb: testsuite: fix wrong expected result in attach-pie-noexec.exp Tiezhu Yang
2022-03-03 18:45   ` Pedro Alves
2022-03-18 20:07   ` Kevin Buettner
2022-03-18 20:43     ` Kevin Buettner [this message]
2022-02-28  6:59 ` [PATCH v5 0/2] Modify can_spawn_for_attach Tiezhu Yang
2022-02-28 14:36   ` Simon Marchi
2022-03-01 14:12     ` Simon Marchi
2022-03-02  6:42       ` Tiezhu Yang
2022-03-03 15:46         ` Simon Marchi

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=20220318134353.5dd21787@f35-zws-1 \
    --to=kevinb@redhat.com \
    --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).