From patchwork Wed Feb 19 11:27:01 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom de Vries X-Patchwork-Id: 38222 Received: (qmail 102821 invoked by alias); 19 Feb 2020 11:27:07 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 102790 invoked by uid 89); 19 Feb 2020 11:27:07 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-25.2 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, SPF_PASS autolearn=ham version=3.3.1 spammy= X-HELO: mx2.suse.de Received: from mx2.suse.de (HELO mx2.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 19 Feb 2020 11:27:05 +0000 Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 4109DAEC1 for ; Wed, 19 Feb 2020 11:27:03 +0000 (UTC) Date: Wed, 19 Feb 2020 12:27:01 +0100 From: Tom de Vries To: gdb-patches@sourceware.org Subject: [PATCH][gdb/testsuite] Handle missing gccgo Message-ID: <20200219112700.GA17397@delia> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.10.1 (2018-07-13) X-IsSubscribed: yes Hi, Without gccgo installed I see in stdout/stderr: ... Running /data/gdb_versions/devel/src/gdb/testsuite/gdb.go/print.exp ... Running /data/gdb_versions/devel/src/gdb/testsuite/gdb.go/handcall.exp ... gdb compile failed, default_target_compile: Can't find gccgo. Running /data/gdb_versions/devel/src/gdb/testsuite/gdb.go/max-depth.exp ... gdb compile failed, default_target_compile: Can't find gccgo. Running /data/gdb_versions/devel/src/gdb/testsuite/gdb.go/integers.exp ... gdb compile failed, default_target_compile: Can't find gccgo. Running /data/gdb_versions/devel/src/gdb/testsuite/gdb.go/unsafe.exp ... gdb compile failed, default_target_compile: Can't find gccgo. Running /data/gdb_versions/devel/src/gdb/testsuite/gdb.go/package.exp ... gdb compile failed, default_target_compile: Can't find gccgo. Running /data/gdb_versions/devel/src/gdb/testsuite/gdb.go/types.exp ... gdb compile failed, default_target_compile: Can't find gccgo. Running /data/gdb_versions/devel/src/gdb/testsuite/gdb.go/chan.exp ... gdb compile failed, default_target_compile: Can't find gccgo. Running /data/gdb_versions/devel/src/gdb/testsuite/gdb.go/strings.exp ... gdb compile failed, default_target_compile: Can't find gccgo. Running /data/gdb_versions/devel/src/gdb/testsuite/gdb.go/basic-types.exp ... Running /data/gdb_versions/devel/src/gdb/testsuite/gdb.go/hello.exp ... gdb compile failed, default_target_compile: Can't find gccgo. Running /data/gdb_versions/devel/src/gdb/testsuite/gdb.go/methods.exp ... gdb compile failed, default_target_compile: Can't find gccgo. ... Fix this by introducing a gdb_caching_proc support_go_compile, and using it in the complaining test-cases. Tested on x86_64-linux, with and without gccgo installed. OK for trunk? Thanks, - Tom [gdb/testsuite] Handle missing gccgo gdb/testsuite/ChangeLog: 2020-02-19 Tom de Vries * lib/gdb.exp (support_go_compile): New gdb_caching_proc. (gdb_simple_compile): Handle compile_flags go by using .go extension for source file. * gdb.go/chan.exp: Use support_go_compile. * gdb.go/handcall.exp: Same. * gdb.go/hello.exp: Same. * gdb.go/integers.exp: Same. * gdb.go/max-depth.exp: Same. * gdb.go/methods.exp: Same. * gdb.go/package.exp: Same. * gdb.go/strings.exp: Same. * gdb.go/types.exp: Same. * gdb.go/unsafe.exp: Same. --- gdb/testsuite/gdb.go/chan.exp | 1 + gdb/testsuite/gdb.go/handcall.exp | 1 + gdb/testsuite/gdb.go/hello.exp | 1 + gdb/testsuite/gdb.go/integers.exp | 1 + gdb/testsuite/gdb.go/max-depth.exp | 1 + gdb/testsuite/gdb.go/methods.exp | 1 + gdb/testsuite/gdb.go/package.exp | 1 + gdb/testsuite/gdb.go/strings.exp | 1 + gdb/testsuite/gdb.go/types.exp | 1 + gdb/testsuite/gdb.go/unsafe.exp | 1 + gdb/testsuite/lib/gdb.exp | 21 ++++++++++++++++++++- 11 files changed, 30 insertions(+), 1 deletion(-) diff --git a/gdb/testsuite/gdb.go/chan.exp b/gdb/testsuite/gdb.go/chan.exp index 2281ede820..d3799d5414 100644 --- a/gdb/testsuite/gdb.go/chan.exp +++ b/gdb/testsuite/gdb.go/chan.exp @@ -21,6 +21,7 @@ load_lib "go.exp" if { [skip_go_tests] } { continue } +if { [support_go_compile] == 0 } { continue } standard_testfile .go diff --git a/gdb/testsuite/gdb.go/handcall.exp b/gdb/testsuite/gdb.go/handcall.exp index 360f35155c..0ae2e606bf 100644 --- a/gdb/testsuite/gdb.go/handcall.exp +++ b/gdb/testsuite/gdb.go/handcall.exp @@ -20,6 +20,7 @@ load_lib "go.exp" if { [skip_go_tests] } { continue } +if { [support_go_compile] == 0 } { continue } standard_testfile .go diff --git a/gdb/testsuite/gdb.go/hello.exp b/gdb/testsuite/gdb.go/hello.exp index 1096f6475b..e2ed54a93a 100644 --- a/gdb/testsuite/gdb.go/hello.exp +++ b/gdb/testsuite/gdb.go/hello.exp @@ -20,6 +20,7 @@ load_lib "go.exp" if { [skip_go_tests] } { continue } +if { [support_go_compile] == 0 } { continue } standard_testfile .go diff --git a/gdb/testsuite/gdb.go/integers.exp b/gdb/testsuite/gdb.go/integers.exp index efd3358235..7d567dbf19 100644 --- a/gdb/testsuite/gdb.go/integers.exp +++ b/gdb/testsuite/gdb.go/integers.exp @@ -20,6 +20,7 @@ load_lib "go.exp" if { [skip_go_tests] } { continue } +if { [support_go_compile] == 0 } { continue } standard_testfile .go diff --git a/gdb/testsuite/gdb.go/max-depth.exp b/gdb/testsuite/gdb.go/max-depth.exp index 7fef984767..82879ce2fc 100644 --- a/gdb/testsuite/gdb.go/max-depth.exp +++ b/gdb/testsuite/gdb.go/max-depth.exp @@ -20,6 +20,7 @@ load_lib "go.exp" if { [skip_go_tests] } { continue } +if { [support_go_compile] == 0 } { continue } standard_testfile .go diff --git a/gdb/testsuite/gdb.go/methods.exp b/gdb/testsuite/gdb.go/methods.exp index 0d23a69f3d..e698cf378f 100644 --- a/gdb/testsuite/gdb.go/methods.exp +++ b/gdb/testsuite/gdb.go/methods.exp @@ -20,6 +20,7 @@ load_lib "go.exp" if { [skip_go_tests] } { continue } +if { [support_go_compile] == 0 } { continue } standard_testfile .go diff --git a/gdb/testsuite/gdb.go/package.exp b/gdb/testsuite/gdb.go/package.exp index 53b0617f08..cb181c7728 100644 --- a/gdb/testsuite/gdb.go/package.exp +++ b/gdb/testsuite/gdb.go/package.exp @@ -20,6 +20,7 @@ load_lib "go.exp" if { [skip_go_tests] } { continue } +if { [support_go_compile] == 0 } { continue } standard_testfile package1.go package2.go diff --git a/gdb/testsuite/gdb.go/strings.exp b/gdb/testsuite/gdb.go/strings.exp index d34498daa2..5da69a92f6 100644 --- a/gdb/testsuite/gdb.go/strings.exp +++ b/gdb/testsuite/gdb.go/strings.exp @@ -18,6 +18,7 @@ load_lib "go.exp" if { [skip_go_tests] } { continue } +if { [support_go_compile] == 0 } { continue } standard_testfile .go diff --git a/gdb/testsuite/gdb.go/types.exp b/gdb/testsuite/gdb.go/types.exp index fedc377ca1..c8d7e21ac6 100644 --- a/gdb/testsuite/gdb.go/types.exp +++ b/gdb/testsuite/gdb.go/types.exp @@ -20,6 +20,7 @@ load_lib "go.exp" if { [skip_go_tests] } { continue } +if { [support_go_compile] == 0 } { continue } standard_testfile .go diff --git a/gdb/testsuite/gdb.go/unsafe.exp b/gdb/testsuite/gdb.go/unsafe.exp index 89e2fff3c0..c1f625729c 100644 --- a/gdb/testsuite/gdb.go/unsafe.exp +++ b/gdb/testsuite/gdb.go/unsafe.exp @@ -20,6 +20,7 @@ load_lib "go.exp" if { [skip_go_tests] } { continue } +if { [support_go_compile] == 0 } { continue } standard_testfile .go diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp index d5e2295703..d8ebddf63c 100644 --- a/gdb/testsuite/lib/gdb.exp +++ b/gdb/testsuite/lib/gdb.exp @@ -2490,6 +2490,18 @@ gdb_caching_proc support_complex_tests { } executable] } +# Return 1 if compiling go is supported. +gdb_caching_proc support_go_compile { + + return [gdb_can_simple_compile go-hello { + package main + import "fmt" + func main() { + fmt.Println("hello world") + } + } executable go] +} + # Return 1 if GDB can get a type for siginfo from the target, otherwise # return 0. @@ -3631,7 +3643,14 @@ proc gdb_simple_compile {name code {type object} {compile_flags {}} {object obj} set postfix "s" } } - set src [standard_temp_file $name-[pid].c] + set ext "c" + foreach flag $compile_flags { + if { "$flag" == "go" } { + set ext "go" + break + } + } + set src [standard_temp_file $name-[pid].$ext] set obj [standard_temp_file $name-[pid].$postfix] set compile_flags [concat $compile_flags {debug nowarnings quiet}]