[gdb/testsuite] Fix funcall_ref.exp xpass
authorTom de Vries <tdevries@suse.de>
Wed, 19 Feb 2020 21:33:42 +0000 (22:33 +0100)
committerTom de Vries <tdevries@suse.de>
Wed, 19 Feb 2020 21:33:42 +0000 (22:33 +0100)
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.

gdb/testsuite/ChangeLog:

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

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

gdb/testsuite/ChangeLog
gdb/testsuite/gdb.ada/funcall_ref.exp

index 0dff20d38357e2fdba80eb695d4486dde185462a..bfa1afc7f0f95595724c477f4af11b6b7fa780db 100644 (file)
@@ -1,3 +1,7 @@
+2020-02-19  Tom de Vries  <tdevries@suse.de>
+
+       * gdb.ada/funcall_ref.exp: Replace xfail setup by unsupported check.
+
 2020-02-19  Doug Evans  <dje@google.com>
 
        PR rust/25535
index 2992e56a2094cbdf6faa71914dafbce1439f6758..02664f6ad3296cc385ff4fc563884588f78f91ec 100644 (file)
@@ -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!\"\\)"
This page took 0.032965 seconds and 4 git commands to generate.