public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Tom de Vries <tdevries@suse.de>
To: gdb-patches@sourceware.org
Subject: [pushed] [gdb/testsuite] Enable gdb.arch/s390-disassembler-options.exp for --enable-targets=all
Date: Wed, 30 Nov 2022 18:49:49 +0100	[thread overview]
Message-ID: <20221130174949.9624-1-tdevries@suse.de> (raw)

On s390x-linux, I run into:
...
DUPLICATE: gdb.arch/s390-disassembler-options.exp: \
  show disassembler-options esa
...

First, reproduce this on x86_64-linux with --enable-targets=all, by replacing
the test for 'istarget "s390*-*-*"' with a test for 'get_set_option_choices
"set architecture" "s390"'.

Fix the DUPLICATE by using with_test_prefix.

Also modernize the test-case by using clean_restart instead of gdb_exit/gdb_start.

Tested on x86_64-linux.
---
 .../gdb.arch/s390-disassembler-options.exp    | 36 ++++++++++---------
 1 file changed, 20 insertions(+), 16 deletions(-)

diff --git a/gdb/testsuite/gdb.arch/s390-disassembler-options.exp b/gdb/testsuite/gdb.arch/s390-disassembler-options.exp
index 7ba9e51cc3c..df6c2363069 100644
--- a/gdb/testsuite/gdb.arch/s390-disassembler-options.exp
+++ b/gdb/testsuite/gdb.arch/s390-disassembler-options.exp
@@ -18,39 +18,43 @@
 # This test exercises set/show disassembler-options results are preserved
 # across multiple set architecture calls.
 
-if {![istarget "s390*-*-*"]} {
-    verbose "Skipping S390 disassembler options."
-    return
-}
-
-gdb_exit
-gdb_start
+clean_restart
 
-set option "esa"
+set archs [get_set_option_choices "set architecture" "s390"]
 set arch1 "s390:64-bit"
 set arch2 "s390:31-bit"
+foreach arch [list $arch1 $arch2] {
+    if { [lsearch -exact $archs $arch] == -1 } {
+	return
+    }
+}
 
-gdb_test "set architecture $arch1" \
+set option "esa"
+
+with_test_prefix $arch1 {
+    gdb_test "set architecture $arch1" \
 	"The target architecture is set to \"$arch1\"\." \
 	"set architecture $arch1"
 
-gdb_test_no_output "set disassembler-options"
-gdb_test "show disassembler-options" \
+    gdb_test_no_output "set disassembler-options"
+    gdb_test "show disassembler-options" \
 	"The current disassembler options are ''.*" \
 	"show NULL disassembler-options"
 
-gdb_test_no_output "set disassembler-options $option"
-gdb_test "show disassembler-options" \
+    gdb_test_no_output "set disassembler-options $option"
+    gdb_test "show disassembler-options" \
 	"The current disassembler options are '$option'.*" \
 	"show disassembler-options $option"
+}
 
 # Change architectures and verify the disassembler options have been preserved.
 
-gdb_test "set architecture $arch2" \
+with_test_prefix $arch2 {
+    gdb_test "set architecture $arch2" \
 	"The target architecture is set to \"$arch2\"\." \
 	"set architecture $arch2"
 
-gdb_test "show disassembler-options" \
+    gdb_test "show disassembler-options" \
 	"The current disassembler options are '$option'.*" \
 	"show disassembler-options $option"
-
+}

base-commit: 885d86436c3f9ab0a13f39647860b526faa92cf8
-- 
2.35.3


                 reply	other threads:[~2022-11-30 17:49 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=20221130174949.9624-1-tdevries@suse.de \
    --to=tdevries@suse.de \
    --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).