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 2/3] [gdb/testsuite] Refactor gdb.cp/subtypes.exp
Date: Mon, 28 Aug 2023 13:47:01 +0200	[thread overview]
Message-ID: <20230828114702.4905-2-tdevries@suse.de> (raw)
In-Reply-To: <20230828114702.4905-1-tdevries@suse.de>

Make test-case gdb.cp/subtypes.exp less repetitive by using foreach.

Tested on x86_64-linux.
---
 gdb/testsuite/gdb.cp/subtypes.exp | 40 +++++++++++++++++--------------
 1 file changed, 22 insertions(+), 18 deletions(-)

diff --git a/gdb/testsuite/gdb.cp/subtypes.exp b/gdb/testsuite/gdb.cp/subtypes.exp
index afad478cba3..48c9784dd68 100644
--- a/gdb/testsuite/gdb.cp/subtypes.exp
+++ b/gdb/testsuite/gdb.cp/subtypes.exp
@@ -33,23 +33,27 @@ if {[prepare_for_testing "failed to prepare" $testfile \
 gdb_test "ptype Outer::Inner::InnerInner" \
     "type = struct Outer::Inner::InnerInner.*"
 gdb_test "ptype Outer::Inner" "type = struct Outer::Inner.*"
-gdb_test "ptype main::Foo" "type = struct Foo.*"
-gdb_test "ptype main::Bar" "type = struct Bar.*"
-gdb_test "ptype main::Baz" "type = struct Baz.*"
+
+foreach s { Foo Bar Baz } {
+    gdb_test "ptype main::$s" "type = struct $s.*"
+}
+
 gdb_test "ptype Outer::Oenum" "type = enum class Outer::Oenum.*"
-gdb_test "ptype foobar<int>::Foo" "type = struct Foo.*"
-gdb_test "ptype foobar<int>::Bar" "type = struct Bar.*"
-gdb_test "ptype foobar<int>::Baz" "type = struct Baz.*"
-gdb_test "ptype foobar<char>::Foo" "type = struct Foo.*"
-gdb_test "ptype foobar<char>::Bar" "type = struct Bar.*"
-gdb_test "ptype foobar<char>::Baz" "type = struct Baz.*"
+
+foreach t { int char } {
+    foreach s { Foo Bar Baz } {
+	gdb_test "ptype foobar<$t>::$s" "type = struct $s.*"
+    }
+}
+
 gdb_breakpoint "Outer::Inner::doit" message
-gdb_breakpoint "main::Foo::doit" message
-gdb_breakpoint "main::Bar::doit" message
-gdb_breakpoint "main::Baz::doit" message
-gdb_breakpoint "foobar<int>(int)::Foo::doit" message
-gdb_breakpoint "foobar<int>(int)::Bar::doit" message
-gdb_breakpoint "foobar<int>(int)::Baz::doit" message
-gdb_breakpoint "foobar<char>(int)::Foo::doit" message
-gdb_breakpoint "foobar<char>(int)::Bar::doit" message
-gdb_breakpoint "foobar<char>(int)::Baz::doit" message
+
+foreach s { Foo Bar Baz } {
+    gdb_breakpoint "main::${s}::doit" message
+}
+
+foreach t { int char } {
+    foreach s { Foo Bar Baz } {
+	gdb_breakpoint "foobar<$t>(int)::${s}::doit" message
+    }
+}
-- 
2.35.3


  reply	other threads:[~2023-08-28 11:46 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-28 11:47 [pushed 1/3] [gdb/testsuite] Handle gdb.cp/*.exp with older compiler Tom de Vries
2023-08-28 11:47 ` Tom de Vries [this message]
2023-08-28 11:47 ` [pushed 3/3] [gdb/testsuite] Add xfail in gdb.cp/subtypes.exp Tom de Vries

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=20230828114702.4905-2-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).