]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/dist: return dropped tests from misc/cgo/test
authorLynn Boger <laboger@linux.vnet.ibm.com>
Tue, 14 Nov 2017 20:50:38 +0000 (15:50 -0500)
committerBrad Fitzpatrick <bradfitz@golang.org>
Sat, 18 Nov 2017 00:33:04 +0000 (00:33 +0000)
In a previous change to cmd/dist/test.go to fix some pie
testcases, a few other tests were incorrectly dropped.
This returns the testcases that shouldn't have been removed.

Fixes #22708

Change-Id: I2f735f4fd3a378f0f45d12a99768638aeb4787c7
Reviewed-on: https://go-review.googlesource.com/77650
Run-TryBot: Russ Cox <rsc@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
src/cmd/dist/test.go

index 49435880ec7a0967fbe787ec57f1635c9bd505fd..3339e0437af84611783cfb8cea42dd22a0d0720f 100644 (file)
@@ -949,6 +949,22 @@ func (t *tester) cgoTest(dt *distTest) error {
                        // static linking on FreeBSD/ARM with clang. (cgo depends on
                        // -fPIC fundamentally.)
                default:
+                       cmd := t.dirCmd("misc/cgo/test",
+                               compilerEnvLookup(defaultcc, goos, goarch), "-xc", "-o", "/dev/null", "-static", "-")
+                       cmd.Stdin = strings.NewReader("int main() {}")
+                       if err := cmd.Run(); err != nil {
+                               fmt.Println("No support for static linking found (lacks libc.a?), skip cgo static linking test.")
+                       } else {
+                               if goos != "android" {
+                                       t.addCmd(dt, "misc/cgo/testtls", "go", "test", "-ldflags", `-linkmode=external -extldflags "-static -pthread"`)
+                               }
+                               t.addCmd(dt, "misc/cgo/nocgo", "go", "test")
+                               t.addCmd(dt, "misc/cgo/nocgo", "go", "test", "-ldflags", `-linkmode=external`)
+                               if goos != "android" {
+                                       t.addCmd(dt, "misc/cgo/nocgo", "go", "test", "-ldflags", `-linkmode=external -extldflags "-static -pthread"`)
+                               }
+                       }
+
                        if t.supportedBuildmode("pie") {
                                t.addCmd(dt, "misc/cgo/test", "go", "test", "-buildmode=pie")
                                t.addCmd(dt, "misc/cgo/testtls", "go", "test", "-buildmode=pie")