gdb/gdb-testsuite-handle-missing-gdc-in-gdb.dlang-dlang-.patch

78 lines
2.2 KiB
Diff

From f53b5ad4cd27738387f22e067881a15a2327ba5b Mon Sep 17 00:00:00 2001
From: Tom de Vries <tdevries@suse.de>
Date: Mon, 27 Mar 2023 11:35:26 +0200
Subject: [PATCH 3/6] [gdb/testsuite] Handle missing gdc in
gdb.dlang/dlang-start.exp
On openSUSE Leap 15.4, I get:
...
Running gdb.dlang/dlang-start.exp ...
gdb compile failed, default_target_compile: Can't find gdc.
UNTESTED: gdb.dlang/dlang-start.exp: failed to prepare
...
Fix this by:
- introducing a new proc can_compile, and
- requiring "can_compile d" in the test-case,
such that I have instead:
...
Running gdb.dlang/dlang-start.exp ...
UNSUPPORTED: gdb.dlang/dlang-start.exp: require failed: can_compile d
...
Tested on x86_64-linux, on openSUSE Leap 15.4 and Fedora 37.
---
gdb/testsuite/gdb.dlang/dlang-start.exp | 1 +
gdb/testsuite/lib/gdb.exp | 16 ++++++++++++++++
2 files changed, 17 insertions(+)
diff --git a/gdb/testsuite/gdb.dlang/dlang-start.exp b/gdb/testsuite/gdb.dlang/dlang-start.exp
index 3e5b6050c07..413e8514968 100644
--- a/gdb/testsuite/gdb.dlang/dlang-start.exp
+++ b/gdb/testsuite/gdb.dlang/dlang-start.exp
@@ -18,6 +18,7 @@
load_lib d-support.exp
if { [skip_d_tests] } { continue }
+if { ![can_compile d] } { continue }
# This testcase verifies the behavior of the `start' command, which
# does not work when we use the gdb stub...
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index 095d8930edb..b6e30204371 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -2471,6 +2471,18 @@ proc skip_d_tests {} {
return 0
}
+# Return a 1 if we can compile source files in LANG.
+
+proc can_compile { lang } {
+
+ if { $lang == "d" } {
+ set src { void main() {} }
+ return [gdb_can_simple_compile can_compile_$lang $src executable {d}]
+ }
+
+ error "can_compile doesn't support lang: $lang"
+}
+
# Return 1 to skip Rust tests, 0 to try them.
proc skip_rust_tests {} {
if { ![isnative] } {
@@ -4632,6 +4644,10 @@ proc gdb_simple_compile {name code {type object} {compile_flags {}} {object obj}
set ext "go"
break
}
+ if { "$flag" eq "d" } {
+ set ext "d"
+ break
+ }
}
set src [standard_temp_file $name-[pid].$ext]
set obj [standard_temp_file $name-[pid].$postfix]
--
2.35.3