Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom de Vries <tdevries@suse.de>
To: gdb-patches@sourceware.org
Subject: [PATCH][gdb/testsuite] Fix funcall_ref.exp xpass
Date: Tue, 18 Feb 2020 14:21:00 -0000	[thread overview]
Message-ID: <20200218142054.GA23157@delia> (raw)

Hi,

When running gdb.ada/funcall_ref.exp I run into two XPASSes:
...
(gdb) p get ("Hello world!")^M
$1 = (n => 12, s => "Hello world!")^M
(gdb) XPASS: gdb.ada/funcall_ref.exp: p get ("Hello world!")
ptype get ("Hello world!")^M
type = <ref> record^M
    n: natural;^M
    s: access array (1 .. n) of character;^M
end record^M
(gdb) XPASS: gdb.ada/funcall_ref.exp: ptype get ("Hello world!")
...

The xfails are documented in funcall_ref.exp:
...
 # Currently, GCC describes such functions as returning pointers (instead of
 # references).
 setup_xfail *-*-*
...

Using gnatmake 4.8, we can reproduce the XFAILs:
...
(gdb) p get ("Hello world!")^M
$1 = (access foo.bar) 0x6147b0 <system.secondary_stack.chunk+48>^M
(gdb) XFAIL: gdb.ada/funcall_ref.exp: p get ("Hello world!")
ptype get ("Hello world!")^M
type = access record^M
    n: natural;^M
    s: access array (1 .. n) of character;^M
end record^M
(gdb) XFAIL: gdb.ada/funcall_ref.exp: ptype get ("Hello world!")
...

Fix the XPASSes by:
- removing the xfail setup
- switching the order of the two tests
- detecting the "access record" type and declaring the first test unsupported,
  and skipping the second test

Tested on x86_64-linux, both with gnatmake 4.8.5 and gnatmake 7.5.0.

OK for trunk?

Thanks,
- Tom

[gdb/testsuite] Fix funcall_ref.exp xpass

gdb/testsuite/ChangeLog:

2020-02-18  Tom de Vries  <tdevries@suse.de>

	* gdb.ada/funcall_ref.exp: Replace xfail setup by unsupported check.

---
 gdb/testsuite/gdb.ada/funcall_ref.exp | 33 ++++++++++++++++++++++++---------
 1 file changed, 24 insertions(+), 9 deletions(-)

diff --git a/gdb/testsuite/gdb.ada/funcall_ref.exp b/gdb/testsuite/gdb.ada/funcall_ref.exp
index 2992e56a20..02664f6ad3 100644
--- a/gdb/testsuite/gdb.ada/funcall_ref.exp
+++ b/gdb/testsuite/gdb.ada/funcall_ref.exp
@@ -32,13 +32,28 @@ runto "foo.adb:$bp_location"
 
 # Currently, GCC describes such functions as returning pointers (instead of
 # references).
-setup_xfail *-*-*
+set pass_re [multi_line "type = <ref> record" \
+		 "    n: natural;" \
+		 "    s: access array \\(1 \\.\\. n\\) of character;" \
+		 "end record"]
+set unsupported_re [multi_line "type = access record" \
+		 "    n: natural;" \
+		 "    s: access array \\(1 \\.\\. n\\) of character;" \
+		 "end record"]
+set supported 1
+gdb_test_multiple "ptype get (\"Hello world!\")" "" {
+    -re -wrap $pass_re {
+	pass $gdb_test_name
+    }
+    -re -wrap $unsupported_re {
+	unsupported $gdb_test_name
+	set supported 0
+    }
+}
+
+if { $supported == 0 } {
+    return 0
+}
+
 gdb_test "p get (\"Hello world!\")" \
-         "= \\(n => 12, s => \"Hello world!\"\\)" \
-
-setup_xfail *-*-*
-gdb_test "ptype get (\"Hello world!\")" \
-         [multi_line "type = <ref> record" \
-                     "    n: natural;" \
-                     "    s: access array \\(1 \\.\\. n\\) of character;" \
-                     "end record"] \
+    "= \\(n => 12, s => \"Hello world!\"\\)"


             reply	other threads:[~2020-02-18 14:21 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-18 14:21 Tom de Vries [this message]
2020-02-19 21:25 ` Tom Tromey

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=20200218142054.GA23157@delia \
    --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