public inbox for gdb-cvs@sourceware.org help / color / mirror / Atom feed
From: Tom de Vries <vries@sourceware.org> To: gdb-cvs@sourceware.org Subject: [binutils-gdb] [gdb/testsuite] Handle with_set arch Date: Mon, 14 Nov 2022 11:12:29 +0000 (GMT) [thread overview] Message-ID: <20221114111229.930233858412@sourceware.org> (raw) https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=7f21d259bcefda58b701af01cc6a749c8133fb2b commit 7f21d259bcefda58b701af01cc6a749c8133fb2b Author: Tom de Vries <tdevries@suse.de> Date: Mon Nov 14 12:12:19 2022 +0100 [gdb/testsuite] Handle with_set arch I realized that the more irregular output of show arch: ... (gdb) show arch^M The target architecture is set to "auto" (currently "i386").^M ... would be a problem for something like: ... with_set arch powerpc:common64 {} ... and indeed: ... (gdb) set arch powerpc:common64^M The target architecture is set to "powerpc:common64".^M (gdb) FAIL: gdb.base/foo.exp: set arch powerpc:common64 ... and: ... (gdb) set arch set to "auto" (currently "i386")^M Undefined item: "set".^M ... Fix this in with_set by handling this type of output. Tested on x86_64-linux. Diff: --- gdb/testsuite/lib/gdb.exp | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp index 40a7c7728d1..bdb8da9daf9 100644 --- a/gdb/testsuite/lib/gdb.exp +++ b/gdb/testsuite/lib/gdb.exp @@ -5924,18 +5924,36 @@ proc with_set { var val body } { } } + # Handle 'set to "auto" (currently "i386")'. + set save [regsub {^set to} $save ""] + set save [regsub {\([^\r\n]+\)$} $save ""] + set save [string trim $save] + set save [regsub -all {^"|"$} $save ""] + if { $save == "" } { perror "Did not manage to set $var" } else { # Set var. - gdb_test_no_output -nopass "set $var $val" + set cmd "set $var $val" + gdb_test_multiple $cmd "" { + -re -wrap "^$cmd" { + } + -re -wrap " is set to \"?$val\"?\\." { + } + } } set code [catch {uplevel 1 $body} result] # Restore saved setting. if { $save != "" } { - gdb_test_no_output -nopass "set $var $save" + set cmd "set $var $save" + gdb_test_multiple $cmd "" { + -re -wrap "^$cmd" { + } + -re -wrap "is set to \"?$save\"?( \\(\[^)\]*\\))?\\." { + } + } } if {$code == 1} {
reply other threads:[~2022-11-14 11:12 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20221114111229.930233858412@sourceware.org \ --to=vries@sourceware.org \ --cc=gdb-cvs@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: linkBe 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).