all: use GOROOT/bin/go instead of go for tests

Using 'go' command in tests is confusing when using a different version
of Go (e.g., go1.13rc1). Use GOROOT/bin/go so that the same Go is used.

Change-Id: I0ca297207acc5e7fd8b291f544302f6c7b0d38e1
Reviewed-on: https://go-review.googlesource.com/c/mobile/+/191517
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
Run-TryBot: Hyang-Ah Hana Kim <hyangah@gmail.com>
This commit is contained in:
Hajime Hoshi
2019-08-23 15:22:30 +00:00
parent e8b3e6111d
commit fe31116dde
3 changed files with 11 additions and 6 deletions
+3 -2
View File
@@ -37,12 +37,13 @@ func testMain(m *testing.M) int {
exe = ".exe"
}
if runtime.GOOS != "android" {
gocmd := filepath.Join(runtime.GOROOT(), "bin", "go")
gomobileBin = filepath.Join(binDir, "gomobile"+exe)
gobindBin := filepath.Join(binDir, "gobind"+exe)
if out, err := exec.Command("go", "build", "-o", gomobileBin, "golang.org/x/mobile/cmd/gomobile").CombinedOutput(); err != nil {
if out, err := exec.Command(gocmd, "build", "-o", gomobileBin, "golang.org/x/mobile/cmd/gomobile").CombinedOutput(); err != nil {
log.Fatalf("gomobile build failed: %v: %s", err, out)
}
if out, err := exec.Command("go", "build", "-o", gobindBin, "golang.org/x/mobile/cmd/gobind").CombinedOutput(); err != nil {
if out, err := exec.Command(gocmd, "build", "-o", gobindBin, "golang.org/x/mobile/cmd/gobind").CombinedOutput(); err != nil {
log.Fatalf("gobind build failed: %v: %s", err, out)
}
PATH := os.Getenv("PATH")