2019-08-08 14:14:27 +00:00
|
|
|
[gdb/testsuite] Compile ada hello world for skip_ada_tests
|
|
|
|
|
|
|
|
For openSUSE Leap 15.0 with gcc-PIE installed (which makes gcc create PIE
|
|
|
|
executables by default) we get:
|
|
|
|
...
|
|
|
|
FAIL: gdb.ada/O2_float_param.exp: compilation foo.adb
|
|
|
|
...
|
|
|
|
|
|
|
|
The problem is that while gcc-PIE affects gcc, it does not affect gnatlink,
|
|
|
|
so it links in the libgnat.a, rather than libgnat_pic.a. [ This is
|
|
|
|
bsc#1115034. ]
|
|
|
|
|
|
|
|
[ Without gcc-PIE, we have a related problem: if we run ada tests with
|
|
|
|
--target_board=unix/-fPIE/-pie, which makes sure PIE executables are generated
|
|
|
|
for c/c++ test-cases, still we get non-PIE ada executables, because gnatmake
|
|
|
|
does not pass -pie to gnatlink. And if gnatmake would pass -pie to gnatlink,
|
|
|
|
we'd run into the same FAIL as above because gnatlink does not use use
|
|
|
|
libgnat_pic.a when -pie is specified (this is PR gcc/87936). So, in order to
|
|
|
|
have ada tests generate PIE executables, we need
|
|
|
|
--target_board=unix/-fPIE/-largs/-pie/-lgnat_pic/-margs, which will not work
|
|
|
|
with c/c++ test-cases. ]
|
|
|
|
|
|
|
|
For now, we check whether we can compile an ada hello world, and if not,
|
|
|
|
generate an UNSUPPORTED in either skip_ada_tests or gdb_compile_ada, to
|
|
|
|
not have this problem result in ~200 FAILs.
|
|
|
|
|
|
|
|
gdb/testsuite/ChangeLog:
|
|
|
|
|
2020-11-30 14:28:07 +00:00
|
|
|
2020-11-06 Tom de Vries <tdevries@suse.de>
|
2019-08-08 14:14:27 +00:00
|
|
|
|
2020-11-30 14:28:07 +00:00
|
|
|
* lib/ada.exp (gdb_compile_ada): Call gdb_can_compile_ada.
|
2019-08-08 14:14:27 +00:00
|
|
|
(gdb_can_compile_ada): New gdb_caching_proc.
|
|
|
|
* lib/gdb.exp: Add load_lib ada.exp.
|
|
|
|
(skip_ada_tests): Return 1 if !gdb_can_compile_ada.
|
|
|
|
|
|
|
|
---
|
2020-11-30 14:28:07 +00:00
|
|
|
gdb/testsuite/lib/ada.exp | 31 +++++++++++++++++++++++++++++++
|
2019-08-08 14:14:27 +00:00
|
|
|
gdb/testsuite/lib/gdb.exp | 6 ++++++
|
2020-11-30 14:28:07 +00:00
|
|
|
2 files changed, 37 insertions(+)
|
2019-08-08 14:14:27 +00:00
|
|
|
|
|
|
|
diff --git a/gdb/testsuite/lib/ada.exp b/gdb/testsuite/lib/ada.exp
|
2020-11-30 14:28:07 +00:00
|
|
|
index 0ffc5957c8..8370ce5b9b 100644
|
2019-08-08 14:14:27 +00:00
|
|
|
--- a/gdb/testsuite/lib/ada.exp
|
|
|
|
+++ b/gdb/testsuite/lib/ada.exp
|
2020-11-30 14:28:07 +00:00
|
|
|
@@ -87,12 +87,43 @@ proc gdb_compile_ada_1 {source dest type options} {
|
|
|
|
# compile was successful.
|
2019-08-08 14:14:27 +00:00
|
|
|
|
2020-11-30 14:28:07 +00:00
|
|
|
proc gdb_compile_ada {source dest type options} {
|
2019-08-08 14:14:27 +00:00
|
|
|
+ if { [gdb_can_compile_ada] == 0 } {
|
|
|
|
+ global gdb_test_file_name
|
|
|
|
+ unsupported "$gdb_test_file_name"
|
|
|
|
+ return "Cannot compile ada"
|
|
|
|
+ }
|
2020-11-30 14:28:07 +00:00
|
|
|
set result [gdb_compile_ada_1 $source $dest $type $options]
|
|
|
|
|
2019-08-08 14:14:27 +00:00
|
|
|
gdb_compile_test $source $result
|
|
|
|
return $result
|
|
|
|
}
|
|
|
|
|
|
|
|
+gdb_caching_proc gdb_can_compile_ada {
|
|
|
|
+ set name "hello"
|
|
|
|
+ set dir "[pwd]/tmp-ada-hello-[pid]"
|
|
|
|
+ set src "$dir/$name.adb"
|
|
|
|
+ set dest "$dir/$name"
|
|
|
|
+
|
|
|
|
+ set code {
|
|
|
|
+ with Ada.Text_IO;
|
|
|
|
+
|
|
|
|
+ procedure Hello is
|
|
|
|
+ begin
|
|
|
|
+ Ada.Text_IO.Put_Line("Hello, world!");
|
|
|
|
+ end Hello;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ file mkdir $dir
|
|
|
|
+ gdb_produce_source $src $code
|
2020-11-30 14:28:07 +00:00
|
|
|
+ set res [gdb_compile_ada_1 $src $dest executable {debug}]
|
2019-08-08 14:14:27 +00:00
|
|
|
+ file delete -force $dir
|
|
|
|
+
|
|
|
|
+ if { $res != "" } {
|
|
|
|
+ return 0
|
|
|
|
+ }
|
|
|
|
+ return 1
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
# Like standard_testfile, but for Ada. Historically the Ada tests
|
|
|
|
# used a different naming convention from many of the other gdb tests,
|
|
|
|
# and this difference was preserved during the conversion to
|
|
|
|
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
|
2020-11-30 14:28:07 +00:00
|
|
|
index 653f145c1c..a0f2961a75 100644
|
2019-08-08 14:14:27 +00:00
|
|
|
--- a/gdb/testsuite/lib/gdb.exp
|
|
|
|
+++ b/gdb/testsuite/lib/gdb.exp
|
2020-11-30 14:28:07 +00:00
|
|
|
@@ -84,6 +84,7 @@ load_lib cache.exp
|
2019-08-08 14:14:27 +00:00
|
|
|
load_lib gdb-utils.exp
|
|
|
|
load_lib memory.exp
|
2020-11-30 14:28:07 +00:00
|
|
|
load_lib check-test-names.exp
|
2019-08-08 14:14:27 +00:00
|
|
|
+load_lib ada.exp
|
|
|
|
|
|
|
|
global GDB
|
|
|
|
|
2020-11-30 14:28:07 +00:00
|
|
|
@@ -2093,6 +2094,11 @@ proc skip_fortran_tests {} {
|
2019-08-08 14:14:27 +00:00
|
|
|
# Return a 1 if I don't even want to try to test ada.
|
|
|
|
|
|
|
|
proc skip_ada_tests {} {
|
|
|
|
+ if { [gdb_can_compile_ada] == 0 } {
|
|
|
|
+ global gdb_test_file_name
|
|
|
|
+ unsupported "$gdb_test_file_name"
|
|
|
|
+ return 1
|
|
|
|
+ }
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|