From: Pedro Alves <palves@redhat.com>
To: Sergio Durigan Junior <sergiodj@redhat.com>,
GDB Patches <gdb-patches@sourceware.org>
Cc: Luis Machado <lgustavo@codesourcery.com>
Subject: Re: [PATCH v3] Make environ.exp run on all platforms (and create info-program.exp)
Date: Thu, 27 Apr 2017 14:53:00 -0000 [thread overview]
Message-ID: <03a5e3b7-054a-4c2b-a41b-b496333f349a@redhat.com> (raw)
In-Reply-To: <20170426222833.9679-1-sergiodj@redhat.com>
On 04/26/2017 11:28 PM, Sergio Durigan Junior wrote:
> Changes since v2:
>
> - Removed \t when matching the output of 'info program'.
>
> This has been on my TODO list for a while. There's a really old bug
> about this (PR testsuite/8595), and there was no reason for
> environ.exp to be specific for hppa* targets. So this patch removes
> this constraint, modernizes the testcase, and cleans up some things.
> Most of the tests remained, and some were rewritten (especially the
> one that checks if "show environment" works, which is something kind
> of hard to do).
It'd be good to cross check for overlap with gdb.base/testenv.exp.
> # Verify that we can show all currently-set environment variables.
> -# (It's a bit hacky, but nonetheless probably safe to check for at
> -# least the SHELL variable.)
> -#
> -# need to increase timeout because of very long output
> -set oldtimeout $timeout
> -set timeout [expr "$timeout + 300"]
> -
> -send_gdb "show environment\n"
> -gdb_expect {
> - -re ".*SHELL=(\[a-zA-Z0-9\]*).*$gdb_prompt $"\
> - {pass "show environment"}
> - -re "$gdb_prompt $"\
> - {fail "show environment"}
> - timeout {fail "(timeout) show environment"}
> -}
> -set timeout $oldtimeout
> +# It's hard to do this verification since we can't really compare each
> +# entry with the current environment. So we just check to see if
> +# there is anything that looks like an environment variable being
> +# printed.
> +gdb_test "show environment" "(\[A-Za-z_\]+=.*)+" \
> + "show environment works"
We can easily set a variable in the environment before spawning GDB.
We'd just have to limit that specific test to when not testing with a
remote host, I think? See gdb.base/gdbhistsize-history.exp for example.
> +gdb_test_multiple "unset environment" $msg {
> + -re "Delete all environment variables.*y or n.*$" {
> + gdb_test_no_output "y" $msg
> + }
> + -re "$gdb_prompt $" {
> + fail $msg
> + }
> }
The '-re "$gdb_prompt $"' part is not necessary because
gdb_test_multiple already does that by default.
And then you can use gdb_test for this:
gdb_test "unset environment" "" $msg \
"Delete all environment variables. .y or n. $" \
"y"
> -# Verify that GDB can manipulate the distinguished PATH variable.
> -#
> -send_gdb "path /tmp/FOOBARBAZGRUNGESPAZBALL\n"
> -gdb_expect {
> - -re ".*Executable and object file path: /tmp/FOOBARBAZGRUNGESPAZBALL.*$gdb_prompt $"\
> - {pass "issue path"}
> - -re "$gdb_prompt $"\
> - {fail "issue path"}
> - timeout {fail "(timeout) issue path"}
> -}
> -send_gdb "show paths\n"
> -gdb_expect {
> - -re "Executable and object file path: /tmp/FOOBARBAZGRUNGESPAZBALL.*$gdb_prompt $"\
> - {pass "show paths"}
> - -re "$gdb_prompt $"\
> - {fail "show paths"}
> - timeout {fail "(timeout) show paths"}
Any reason these "path" command tests are dropped?
(AFAICS, the MI equivalent is tested by gdb.mi/mi-basics.exp).
> -}
> +gdb_test_no_output "set environment FOOBARBAZGRUNGESPAZBALL = foo" \
> + "set environment variable with trailing whitespace"
> +gdb_test "show environment FOOBARBAZGRUNGESPAZBALL" \
> + "FOOBARBAZGRUNGESPAZBALL = foo" \
> + "confirm set environment variable with trailing whitespace"
>
> gdb_exit
> return 0
> diff --git a/gdb/testsuite/gdb.base/info-program.exp b/gdb/testsuite/gdb.base/info-program.exp
> new file mode 100644
> index 0000000..e5e5fb9
> --- /dev/null
> +++ b/gdb/testsuite/gdb.base/info-program.exp
> @@ -0,0 +1,45 @@
> +# Copyright 2017 Free Software Foundation, Inc.
If the moved code is based on older code, the original copyright year
must be preserved.
Thanks,
Pedro Alves
next prev parent reply other threads:[~2017-04-27 14:53 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-31 17:29 [PATCH] " Sergio Durigan Junior
2017-04-12 23:30 ` Sergio Durigan Junior
2017-04-13 14:35 ` Luis Machado
2017-04-13 18:26 ` Sergio Durigan Junior
2017-04-13 18:29 ` Luis Machado
2017-04-13 18:34 ` Sergio Durigan Junior
2017-04-20 19:54 ` Luis Machado
2017-04-25 20:47 ` [PATCH v2] " Sergio Durigan Junior
2017-04-26 18:43 ` Luis Machado
2017-04-26 19:42 ` Sergio Durigan Junior
2017-04-26 22:28 ` [PATCH v3] " Sergio Durigan Junior
2017-04-27 14:53 ` Pedro Alves [this message]
2017-04-27 19:06 ` Sergio Durigan Junior
2017-04-27 22:37 ` Pedro Alves
2017-04-29 0:32 ` Sergio Durigan Junior
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=03a5e3b7-054a-4c2b-a41b-b496333f349a@redhat.com \
--to=palves@redhat.com \
--cc=gdb-patches@sourceware.org \
--cc=lgustavo@codesourcery.com \
--cc=sergiodj@redhat.com \
/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