public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Bruno Larsen <blarsen@redhat.com>
To: "gdb-patches@sourceware.org" <gdb-patches@sourceware.org>
Subject: [PINGv4] [PATCH] gdb/testsuite: modernize gdb.base/maint.exp
Date: Mon, 13 Jun 2022 17:03:44 -0300	[thread overview]
Message-ID: <33687f4b-582e-49ef-943c-673c03f0c8fd@redhat.com> (raw)
In-Reply-To: <cb926557-625c-8b53-cd31-0afb2943b6ce@redhat.com>

ping!

Cheers!
Bruno Larsen

On 6/6/22 09:43, Bruno Larsen wrote:
> ping!
> 
> Cheers!
> Bruno Larsen
> 
> On 5/30/22 08:14, Bruno Larsen wrote:
>> ping!
>>
>> Cheers!
>> Bruno Larsen
>>
>> On 5/23/22 11:14, Bruno Larsen wrote:
>>> ping
>>>
>>> Cheers!
>>> Bruno Larsen
>>>
>>> On 5/9/22 15:04, Bruno Larsen wrote:
>>>> gdb.base/maint.exp was using several gdb_expect statements, probably
>>>> because this test case predates the existance of gdb_test_multiple. This
>>>> commit updates the test case to use gdb_test_multiple, making it more
>>>> resilient to internal errors and such.
>>>>
>>>> The only gdb_expect left in the testcase is one that specifically looks
>>>> for an internal error being triggered as a PASS.
>>>> ---
>>>>   gdb/testsuite/gdb.base/maint.exp | 109 ++++++++-----------------------
>>>>   1 file changed, 29 insertions(+), 80 deletions(-)
>>>>
>>>> diff --git a/gdb/testsuite/gdb.base/maint.exp b/gdb/testsuite/gdb.base/maint.exp
>>>> index 45ccdc6584e..2efdda9aed7 100644
>>>> --- a/gdb/testsuite/gdb.base/maint.exp
>>>> +++ b/gdb/testsuite/gdb.base/maint.exp
>>>> @@ -155,18 +155,10 @@ set have_psyms [expr ! ( $have_gdb_index || $readnow_p )]
>>>>   # guo: on linux this command output is huge.  for some reason splitting up
>>>>   # the regexp checks works.
>>>>   #
>>>> -send_gdb "maint check-psymtabs\n"
>>>> -gdb_expect  {
>>>> -    -re "^maint check-psymtabs" {
>>>> -    gdb_expect {
>>>> -        -re "$gdb_prompt $" {
>>>> -        pass "maint check-psymtabs"
>>>> -        }
>>>> -        timeout { fail "(timeout) maint check-psymtabs" }
>>>> -    }
>>>> +gdb_test_multiple "maint check-psymtabs" "maint check-psymtabs" {
>>>> +    -re -wrap "^maint check-psymtabs.*" {
>>>> +    pass "maint check-psymtabs"
>>>>       }
>>>> -    -re ".*$gdb_prompt $"     { fail "maint check-psymtabs" }
>>>> -    timeout         { fail "(timeout) maint check-psymtabs" }
>>>>   }
>>>>   # This command does not produce any output unless there is some problem
>>>> @@ -270,62 +262,38 @@ if { $have_psyms } {
>>>>                  "maint print psymbols -pc" \
>>>>                  "maint print psymbols -pc main $psymbols_output"]
>>>>       foreach { test_name command } $test_list {
>>>> -    send_gdb "$command\n"
>>>> -        gdb_expect  {
>>>> -        -re "^maint print psymbols \[^\n\]*\r\n$gdb_prompt $" {
>>>> -            send_gdb "shell ls $psymbols_output\n"
>>>> -            gdb_expect {
>>>> -            -re "$psymbols_output_re\r\n$gdb_prompt $" {
>>>> -                # We want this grep to be as specific as possible,
>>>> -                # so it's less likely to match symbol file names in
>>>> -                # psymbols_output.  Yes, this actually happened;
>>>> -                # poor expect got tons of output, and timed out
>>>> -                # trying to match it.   --- Jim Blandy <jimb@cygnus.com>
>>>> -                send_gdb "shell grep 'main.*function' $psymbols_output\n"
>>>> -                gdb_expect {
>>>> -                -re ".main., function, $hex.*$gdb_prompt $" {
>>>> -                    pass "$test_name 1"
>>>> -                }
>>>> -                -re ".*main.  .., function, $hex.*$gdb_prompt $" {
>>>> -                    pass "$test_name 2"
>>>> -                }
>>>> -                -re ".*$gdb_prompt $" { fail "$test_name" }
>>>> -                timeout { fail "$test_name (timeout)" }
>>>> -                }
>>>> +    gdb_test_multiple "$command" "$test_name" {
>>>> +        -re  -wrap "^maint print psymbols \[^\n\]*" {
>>>> +        gdb_test_multiple "shell grep 'main.*function' $psymbols_output"\
>>>> +            "$test_name internal"{
>>>> +            -re -wrap ".main., function, $hex.*" {
>>>> +                gdb_test "shell rm -f $psymbols_output" ".*" \
>>>> +                "${test_name}: shell rm -f psymbols_output"
>>>> +                pass "$test_name 1"
>>>> +            }
>>>> +            -re -wrap ".*main.  .., function, $hex.*" {
>>>>                   gdb_test "shell rm -f $psymbols_output" ".*" \
>>>>                   "${test_name}: shell rm -f psymbols_output"
>>>> +                pass "$test_name 2"
>>>>               }
>>>> -            -re ".*$gdb_prompt $" { fail "$test_name" }
>>>> -            timeout { fail "$test_name (timeout)" }
>>>> -            }
>>>>           }
>>>> -        -re ".*$gdb_prompt $" { fail "$test_name" }
>>>> -        timeout { fail "$test_name (timeout)" }
>>>>           }
>>>> +    }
>>>>       }
>>>>   }
>>>>   set msymbols_output [standard_output_file msymbols_output]
>>>>   set msymbols_output_re [string_to_regexp $msymbols_output]
>>>> -send_gdb "maint print msymbols -objfile ${binfile} $msymbols_output\n"
>>>> -gdb_expect  {
>>>> -    -re "^maint print msymbols \[^\n\]*\r\n$gdb_prompt $" {
>>>> -    send_gdb "shell ls $msymbols_output\n"
>>>> -    gdb_expect {
>>>> -        -re "$msymbols_output_re\r\n$gdb_prompt $" {
>>>> -        gdb_test "shell grep factorial $msymbols_output" \
>>>> -            "\\\[ *$decimal\\\] \[tT\]\[ \t\]+$hex \\.?factorial.*" \
>>>> -            "maint print msymbols, absolute pathname"
>>>> -        gdb_test "shell rm -f $msymbols_output" ".*" \
>>>> -            "shell rm -f msymbols_output"
>>>> -        }
>>>> -        -re ".*$gdb_prompt $" { fail "maint print msymbols" }
>>>> -        timeout { fail "maint print msymbols (timeout)" }
>>>> -    }
>>>> +gdb_test_multiple "maint print msymbols -objfile ${binfile} $msymbols_output" \
>>>> +"printing msymbols" {
>>>> +    -re -wrap "^maint print msymbols \[^\n\]*" {
>>>> +    gdb_test "shell grep factorial $msymbols_output" \
>>>> +        "\\\[ *$decimal\\\] \[tT\]\[ \t\]+$hex \\.?factorial.*" \
>>>> +        "maint print msymbols, absolute pathname"
>>>> +    gdb_test "shell rm -f $msymbols_output" ".*" \
>>>> +        "shell rm -f msymbols_output"
>>>>       }
>>>> -    -re ".*$gdb_prompt $" { fail "maint print msymbols" }
>>>> -    timeout { fail "maint print msymbols (timeout)" }
>>>>   }
>>>>   # Check that maint print msymbols allows relative pathnames
>>>> @@ -363,31 +331,12 @@ set test_list [list \
>>>>              "maint print symbols -pc" \
>>>>              "maint print symbols -pc main $symbols_output"]
>>>>   foreach { test_name command } $test_list {
>>>> -    send_gdb "$command\n"
>>>> -    gdb_expect {
>>>> -    -re "^maint print symbols \[^\n\]*\r\n$gdb_prompt $" {
>>>> -        send_gdb "shell ls $symbols_output\n"
>>>> -        gdb_expect {
>>>> -        -re "$symbols_output_re\r\n$gdb_prompt $" {
>>>> -            # See comments for `maint print psymbols'.
>>>> -            send_gdb "shell grep 'main(.*block' $symbols_output\n"
>>>> -            gdb_expect {
>>>> -            -re "int main\\(int, char \\*\\*, char \\*\\*\\); block.*$gdb_prompt $" {
>>>> -                pass "$test_name"
>>>> -            }
>>>> -            -re ".*$gdb_prompt $" { fail "$test_name" }
>>>> -            timeout { fail "$test_name (timeout)" }
>>>> -            }
>>>> -            gdb_test "shell rm -f $symbols_output" ".*" \
>>>> -            "$test_name: shell rm -f symbols_output"
>>>> -        }
>>>> -        -re ".*$gdb_prompt $" { fail "$test_name" }
>>>> -        timeout { fail "$test_name (timeout)" }
>>>> -        }
>>>> -    }
>>>> -    -re ".*$gdb_prompt $" { fail "$test_name" }
>>>> -    timeout { fail "$test_name (timeout)" }
>>>> -    }
>>>> +    gdb_test_no_output "$command" "$test_name generate"
>>>> +    gdb_test "shell grep 'main(.*block' $symbols_output"\
>>>> +    "int main\\(int, char \\*\\*, char \\*\\*\\); block.*"\
>>>> +    "$test_name read"
>>>> +    gdb_test "shell rm -f $symbols_output" ".*" \
>>>> +    "$test_name: shell rm -f symbols_output"
>>>>   }
>>>>   set msg "maint print type"


  reply	other threads:[~2022-06-13 20:03 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-09 18:04 Bruno Larsen
2022-05-23 14:14 ` [PING] " Bruno Larsen
2022-05-30 11:14   ` [PINGv2] " Bruno Larsen
2022-06-06 12:43     ` [PINGv3] " Bruno Larsen
2022-06-13 20:03       ` Bruno Larsen [this message]
2022-06-20 13:29         ` [PINGv5] " Bruno Larsen
2022-06-21 15:52 ` Andrew Burgess
2022-06-21 19:45   ` Bruno Larsen
2022-06-21 19:54     ` [PATCHv2] " Bruno Larsen
2022-06-24 13:20     ` [PATCH] " Andrew Burgess
2022-06-24 15:13       ` Pedro Alves
2022-06-24 15:16     ` Pedro Alves
2022-06-24 15:23     ` Pedro Alves
2022-06-24 15:22   ` Pedro Alves
2022-06-24 17:51     ` Keith Seitz
2022-06-24 17:54       ` Bruno Larsen
2022-06-24 18:41       ` Pedro Alves
2022-06-27 10:13       ` Andrew Burgess
2022-06-28 18:36 ` [PATCHv3] " Bruno Larsen
2022-06-29 10:33   ` Andrew Burgess
2022-06-29 14:00     ` Bruno Larsen
2022-06-29 14:53 ` [PATCHv4] " Bruno Larsen
2022-07-13 11:22   ` [PING][PATCHv4] " Bruno Larsen
2022-07-15 16:49     ` Tom Tromey
2022-07-15 17:20       ` Bruno Larsen

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=33687f4b-582e-49ef-943c-673c03f0c8fd@redhat.com \
    --to=blarsen@redhat.com \
    --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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).