[gdb/testsuite] Handle missing gccgo
Commit Message
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 <tdevries@suse.de>
* 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(-)
Comments
>>>>> "Tom" == Tom de Vries <tdevries@suse.de> writes:
Tom> if { [skip_go_tests] } { continue }
Tom> +if { [support_go_compile] == 0 } { continue }
It seems to me that skip_go_tests should simply do this check.
Tom
On 19-02-2020 22:27, Tom Tromey wrote:
>>>>>> "Tom" == Tom de Vries <tdevries@suse.de> writes:
>
> Tom> if { [skip_go_tests] } { continue }
> Tom> +if { [support_go_compile] == 0 } { continue }
>
> It seems to me that skip_go_tests should simply do this check.
There are two gdb.go tests that don't require gccgo: gdb.go/print.exp
and gdb.go/basic-types.exp.
If we merge support_go_compile into skip_go_tests, then if gccgo is not
present, these two tests will not be run, while they could be run.
WDYT?
Thanks,
- Tom
>>>>> "Tom" == Tom de Vries <tdevries@suse.de> writes:
Tom> If we merge support_go_compile into skip_go_tests, then if gccgo is not
Tom> present, these two tests will not be run, while they could be run.
Tom> WDYT?
Yeah, in that case, I think your original patch is ok.
I considered suggesting that you just remove skip_go_tests from those
two tests. But, at least Rust testing doesn't work this way -- it
splits skip_rust_tests from compilation failures.
Probably either way is fine, since we're just talking about not running
tests. But you already have one patch written...
thanks,
Tom
@@ -21,6 +21,7 @@
load_lib "go.exp"
if { [skip_go_tests] } { continue }
+if { [support_go_compile] == 0 } { continue }
standard_testfile .go
@@ -20,6 +20,7 @@
load_lib "go.exp"
if { [skip_go_tests] } { continue }
+if { [support_go_compile] == 0 } { continue }
standard_testfile .go
@@ -20,6 +20,7 @@
load_lib "go.exp"
if { [skip_go_tests] } { continue }
+if { [support_go_compile] == 0 } { continue }
standard_testfile .go
@@ -20,6 +20,7 @@
load_lib "go.exp"
if { [skip_go_tests] } { continue }
+if { [support_go_compile] == 0 } { continue }
standard_testfile .go
@@ -20,6 +20,7 @@
load_lib "go.exp"
if { [skip_go_tests] } { continue }
+if { [support_go_compile] == 0 } { continue }
standard_testfile .go
@@ -20,6 +20,7 @@
load_lib "go.exp"
if { [skip_go_tests] } { continue }
+if { [support_go_compile] == 0 } { continue }
standard_testfile .go
@@ -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
@@ -18,6 +18,7 @@
load_lib "go.exp"
if { [skip_go_tests] } { continue }
+if { [support_go_compile] == 0 } { continue }
standard_testfile .go
@@ -20,6 +20,7 @@
load_lib "go.exp"
if { [skip_go_tests] } { continue }
+if { [support_go_compile] == 0 } { continue }
standard_testfile .go
@@ -20,6 +20,7 @@
load_lib "go.exp"
if { [skip_go_tests] } { continue }
+if { [support_go_compile] == 0 } { continue }
standard_testfile .go
@@ -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}]