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/2] [gdb/testsuite] Handle missing gdc in gdb.dlang/dlang-start.exp
Date: Mon, 27 Mar 2023 11:36:31 +0200	[thread overview]
Message-ID: <20230327093631.15655-2-tdevries@suse.de> (raw)
In-Reply-To: <20230327093631.15655-1-tdevries@suse.de>

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 fd4688b0635..921f67064d3 100644
--- a/gdb/testsuite/gdb.dlang/dlang-start.exp
+++ b/gdb/testsuite/gdb.dlang/dlang-start.exp
@@ -17,6 +17,7 @@
 
 load_lib d-support.exp
 require allow_d_tests
+require {can_compile d}
 
 # 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 f8046ffe84d..813b755215e 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -2461,6 +2461,18 @@ proc allow_d_tests {} {
     return 1
 }
 
+# Return a 1 if we can compile source files in LANG.
+
+gdb_caching_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 try Rust tests, 0 to skip them.
 proc allow_rust_tests {} {
     if { ![isnative] } {
@@ -4634,6 +4646,10 @@ proc gdb_simple_compile {name code {type object} {compile_flags {}} {object obj}
 	    set ext "cpp"
 	    break
 	}
+	if { "$flag" eq "d" } {
+	    set ext "d"
+	    break
+	}
     }
     set src [standard_temp_file $name.$ext]
     set obj [standard_temp_file $name.$postfix]
-- 
2.35.3


      reply	other threads:[~2023-03-27  9:36 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-27  9:36 [pushed 1/2] [gdb/testsuite] Remove superfluous pid in temp files Tom de Vries
2023-03-27  9:36 ` Tom de Vries [this message]

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=20230327093631.15655-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).