[gdb/testsuite] Handle missing gccgo
authorTom de Vries <tdevries@suse.de>
Thu, 20 Feb 2020 05:31:24 +0000 (06:31 +0100)
committerTom de Vries <tdevries@suse.de>
Thu, 20 Feb 2020 05:31:24 +0000 (06:31 +0100)
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.

gdb/testsuite/ChangeLog:

2020-02-20  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.

12 files changed:
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.go/chan.exp
gdb/testsuite/gdb.go/handcall.exp
gdb/testsuite/gdb.go/hello.exp
gdb/testsuite/gdb.go/integers.exp
gdb/testsuite/gdb.go/max-depth.exp
gdb/testsuite/gdb.go/methods.exp
gdb/testsuite/gdb.go/package.exp
gdb/testsuite/gdb.go/strings.exp
gdb/testsuite/gdb.go/types.exp
gdb/testsuite/gdb.go/unsafe.exp
gdb/testsuite/lib/gdb.exp

index f0549c26761eb209dbc7e6472e2d0917d692f42d..cf7b3b14f25d1e86b2cec430d902c11ba4a2f78e 100644 (file)
@@ -1,3 +1,19 @@
+2020-02-20  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.
+
 2020-02-19  Tom de Vries  <tdevries@suse.de>
 
        * gdb.python/lib-types.exp: Make xfail more strict.
index 2281ede820f82dbd6c20b15e8c50ad7bb770364c..d3799d54149e156457df8643822805250e6dc8e0 100644 (file)
@@ -21,6 +21,7 @@
 load_lib "go.exp"
 
 if { [skip_go_tests] } { continue }
+if { [support_go_compile] == 0 } { continue }
 
 standard_testfile .go
 
index 360f35155c7e36a8dbe6b52467e17dca97dd8ec9..0ae2e606bf3a73032b2fbda48aa00ac052e71d4b 100644 (file)
@@ -20,6 +20,7 @@
 load_lib "go.exp"
 
 if { [skip_go_tests] } { continue }
+if { [support_go_compile] == 0 } { continue }
 
 standard_testfile .go
 
index 1096f6475be1ff0eb2f8a1dc1dd45aa55c7a899a..e2ed54a93a25b2f55ce7ab11ba7b6deec86d0e96 100644 (file)
@@ -20,6 +20,7 @@
 load_lib "go.exp"
 
 if { [skip_go_tests] } { continue }
+if { [support_go_compile] == 0 } { continue }
 
 standard_testfile .go
 
index efd33582357f59b960d9d7e2bb45576db2e95e28..7d567dbf19b0e2ce0ef1462b494d634899dd4241 100644 (file)
@@ -20,6 +20,7 @@
 load_lib "go.exp"
 
 if { [skip_go_tests] } { continue }
+if { [support_go_compile] == 0 } { continue }
 
 standard_testfile .go
 
index 7fef9847674d3515c5c06153f277418a32e10a0b..82879ce2fc4bd86e7b9d0a621ea22d7166fcf09c 100644 (file)
@@ -20,6 +20,7 @@
 load_lib "go.exp"
 
 if { [skip_go_tests] } { continue }
+if { [support_go_compile] == 0 } { continue }
 
 standard_testfile .go
 
index 0d23a69f3d8e304986d9d6faa6baaf7763b3b354..e698cf378fd90440076491a2367b8de4f7944b9b 100644 (file)
@@ -20,6 +20,7 @@
 load_lib "go.exp"
 
 if { [skip_go_tests] } { continue }
+if { [support_go_compile] == 0 } { continue }
 
 standard_testfile .go
 
index 53b0617f0847c48ee7f00bd1451db7e044453948..cb181c772837db23edf17c7842f25e174f93ea00 100644 (file)
@@ -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
 
index d34498daa23c0affafbf781ead2749d924845e5f..5da69a92f68c52c6930f0ba0ab74755fd7518c19 100644 (file)
@@ -18,6 +18,7 @@
 load_lib "go.exp"
 
 if { [skip_go_tests] } { continue }
+if { [support_go_compile] == 0 } { continue }
 
 standard_testfile .go
 
index fedc377ca12a3717edb82de4f663cfe295b0ce3c..c8d7e21ac6da7fd2efb81e6f75e67f3f4c6d23a0 100644 (file)
@@ -20,6 +20,7 @@
 load_lib "go.exp"
 
 if { [skip_go_tests] } { continue }
+if { [support_go_compile] == 0 } { continue }
 
 standard_testfile .go
 
index 89e2fff3c07c0f3474b414bb35e9814c81d49a64..c1f625729c8b58789f84ae99ea7b9829b6131be7 100644 (file)
@@ -20,6 +20,7 @@
 load_lib "go.exp"
 
 if { [skip_go_tests] } { continue }
+if { [support_go_compile] == 0 } { continue }
 
 standard_testfile .go
 
index d5e2295703948178ab64674ad3a66af2491a65b3..d8ebddf63cec14ffae109de80a33873f5d8798ea 100644 (file)
@@ -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}]
 
This page took 0.155647 seconds and 4 git commands to generate.