]> Cypherpunks repositories - gostls13.git/commitdiff
misc/cgo: skip cgotest.TestCrossPackageTests on iOS and set PWD
authorBryan C. Mills <bcmills@google.com>
Tue, 26 Feb 2019 03:09:46 +0000 (22:09 -0500)
committerBryan C. Mills <bcmills@google.com>
Tue, 26 Feb 2019 13:29:07 +0000 (13:29 +0000)
I hope that this will fix the tests on iOS, but 'gomote create' isn't
giving me an instance I can test with. (Please patch and test before
approving.)

Updates #15919
Updates #30228

Change-Id: I1b7cd30d5b127a1ad3243b329fa005d229f69a24
Reviewed-on: https://go-review.googlesource.com/c/163726
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Elias Naur <mail@eliasnaur.com>
misc/cgo/life/life_test.go
misc/cgo/stdio/stdio_test.go
misc/cgo/test/pkg_test.go
misc/cgo/testcarchive/carchive_test.go
misc/cgo/testcshared/cshared_test.go
misc/cgo/testplugin/plugin_test.go
misc/cgo/testshared/shared_test.go

index 3b17adae740bf0f5891331a5577118bd460b3a21..0f024c9d1d4f709bfd14c40a823716d66faea369 100644 (file)
@@ -37,6 +37,7 @@ func testMain(m *testing.M) int {
        if err := os.Chdir(modRoot); err != nil {
                log.Panic(err)
        }
+       os.Setenv("PWD", modRoot)
        if err := ioutil.WriteFile("go.mod", []byte("module cgolife\n"), 0666); err != nil {
                log.Panic(err)
        }
index cb32da84442fcc714dc44165d6434ee85eaefa4a..85ab6ae3e5a7e63208e79e091dfbfb7097f0d6c6 100644 (file)
@@ -37,6 +37,7 @@ func testMain(m *testing.M) int {
        if err := os.Chdir(modRoot); err != nil {
                log.Panic(err)
        }
+       os.Setenv("PWD", modRoot)
        if err := ioutil.WriteFile("go.mod", []byte("module cgostdio\n"), 0666); err != nil {
                log.Panic(err)
        }
index 9c8a61e871ec81e496027eaac2d635f2dcc71cf8..6857609a10428e64a691ff48e2803b565a5f4e3e 100644 (file)
@@ -9,6 +9,7 @@ import (
        "os"
        "os/exec"
        "path/filepath"
+       "runtime"
        "strings"
        "testing"
 )
@@ -26,6 +27,13 @@ import (
 // this shim and move the tests currently located in testdata back into the
 // parent directory.
 func TestCrossPackageTests(t *testing.T) {
+       if runtime.GOOS == "darwin" {
+               switch runtime.GOARCH {
+               case "arm", "arm64":
+                       t.Skip("Can't exec cmd/go subprocess on iOS.")
+               }
+       }
+
        GOPATH, err := ioutil.TempDir("", "cgotest")
        if err != nil {
                t.Fatal(err)
index d6b35fb9ec7ddf37ea75fa58c5a1270cc3b2a71d..611a770245c5fb79c0bbaf6277b964b37c958553 100644 (file)
@@ -60,6 +60,7 @@ func testMain(m *testing.M) int {
        if err := os.Chdir(modRoot); err != nil {
                log.Panic(err)
        }
+       os.Setenv("PWD", modRoot)
        if err := ioutil.WriteFile("go.mod", []byte("module testcarchive\n"), 0666); err != nil {
                log.Panic(err)
        }
index 163cea2136b6611dc11dca0281eb7755695a9d97..833650e5e6732cdae0f89bb01fee433f80652345 100644 (file)
@@ -132,6 +132,7 @@ func testMain(m *testing.M) int {
        if err := os.Chdir(modRoot); err != nil {
                log.Panic(err)
        }
+       os.Setenv("PWD", modRoot)
        if err := ioutil.WriteFile("go.mod", []byte("module testcshared\n"), 0666); err != nil {
                log.Panic(err)
        }
index 8bea9e5356f919c06a227cf86b19000ac5edac26..2c110494d0539cc49cd7376f6e4fe56ae045ff14 100644 (file)
@@ -51,12 +51,14 @@ func TestMain(m *testing.M) {
        if err := os.Chdir(altRoot); err != nil {
                log.Panic(err)
        }
+       os.Setenv("PWD", altRoot)
        goCmd(nil, "build", "-buildmode=plugin", "-o", filepath.Join(modRoot, "plugin-mismatch.so"), "./plugin-mismatch")
 
        os.Setenv("GOPATH", GOPATH)
        if err := os.Chdir(modRoot); err != nil {
                log.Panic(err)
        }
+       os.Setenv("PWD", modRoot)
 
        os.Setenv("LD_LIBRARY_PATH", modRoot)
 
index 9a8c3989762d19a3ff4e79affdcbe8d0cd88eecf..ac1a1c7f1a8cca20da9448ad244eb529e1a8fce7 100644 (file)
@@ -126,6 +126,7 @@ func testMain(m *testing.M) (int, error) {
                fmt.Printf("+ cd %s\n", modRoot)
        }
        os.Chdir(modRoot)
+       os.Setenv("PWD", modRoot)
        if err := ioutil.WriteFile("go.mod", []byte("module testshared\n"), 0666); err != nil {
                return 0, err
        }