From patchwork Mon Mar 27 09:36:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom de Vries X-Patchwork-Id: 66931 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 7F21B3851C20 for ; Mon, 27 Mar 2023 09:36:56 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7F21B3851C20 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1679909816; bh=QUJHy8Besun1mOA596RemUKLXxUEpOIqaxyq/Ooc09s=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=rXKJf1Dby3mZ20LONHsJrOdWj4lTqdZZ4u5EKqBUUSA97r3MjPVVm7mMm1vq/V6X3 gSRYfcT3pMyOMR1wUMBOQVUBYK8aI1TQL2oL/Y00UW7mxFPYE7BsFfoukqAxZGCXJK /SVqEZ2Rx5zfTCyl8LAdaE8lldycxC3RiCstGpQw= X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2001:67c:2178:6::1d]) by sourceware.org (Postfix) with ESMTPS id BFF0F3858CDA for ; Mon, 27 Mar 2023 09:36:32 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org BFF0F3858CDA Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id DC53F1FD6B for ; Mon, 27 Mar 2023 09:36:31 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id C9A72138ED for ; Mon, 27 Mar 2023 09:36:31 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id uPYbMJ9jIWStaQAAMHmgww (envelope-from ) for ; Mon, 27 Mar 2023 09:36:31 +0000 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 Message-Id: <20230327093631.15655-2-tdevries@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20230327093631.15655-1-tdevries@suse.de> References: <20230327093631.15655-1-tdevries@suse.de> MIME-Version: 1.0 X-Spam-Status: No, score=-12.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Tom de Vries via Gdb-patches From: Tom de Vries Reply-To: Tom de Vries Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org Sender: "Gdb-patches" 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]