From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2205) id 930233858412; Mon, 14 Nov 2022 11:12:29 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 930233858412 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1668424349; bh=Pd/SDyLmvPzpAXoBJxCUcqiaINCVYvZs0akbknuKvKI=; h=From:To:Subject:Date:From; b=utegbuURzIGh8hYbf3J1+fAvZ6NeDfbZNwG3rNz/4F1zO1tbG5LfL29Ysr7f6FWs4 t8IHRQZDeqgbvzXF9pm/nZ4pUjO3ykkclobWBAlfT0q4HLhtLaNeQUhijJVAI3toDe uTIGQmN8TTwfAwgoZm1FwHmqzfDB1CHUPjl8H9Wc= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Tom de Vries To: gdb-cvs@sourceware.org Subject: [binutils-gdb] [gdb/testsuite] Handle with_set arch X-Act-Checkin: binutils-gdb X-Git-Author: Tom de Vries X-Git-Refname: refs/heads/master X-Git-Oldrev: 8d45c3a82a0eb5ecfc9049bed5569f9e27e3be8c X-Git-Newrev: 7f21d259bcefda58b701af01cc6a749c8133fb2b Message-Id: <20221114111229.930233858412@sourceware.org> Date: Mon, 14 Nov 2022 11:12:29 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D7f21d259bcef= da58b701af01cc6a749c8133fb2b commit 7f21d259bcefda58b701af01cc6a749c8133fb2b Author: Tom de Vries Date: Mon Nov 14 12:12:19 2022 +0100 [gdb/testsuite] Handle with_set arch =20 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 ... =20 Fix this in with_set by handling this type of output. =20 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 } { } } =20 + # 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 =3D=3D "" } { 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\"?\\." { + } + } } =20 set code [catch {uplevel 1 $body} result] =20 # Restore saved setting. if { $save !=3D "" } { - 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\"?( \\(\[^)\]*\\))?\\." { + } + } } =20 if {$code =3D=3D 1} {