From 8e723109de27ad6ad64655f336456786e8f5d899 Mon Sep 17 00:00:00 2001 From: Alex Brainman Date: Wed, 17 Jun 2015 10:22:03 +1000 Subject: [PATCH] cmd/go: vary executable names in tests So the tests don't interfere with each other on windows. Fixes #11217 Change-Id: I4b3936bc64c95c7274298d6f137b24a28876b625 Reviewed-on: https://go-review.googlesource.com/11138 Reviewed-by: Ian Lance Taylor --- src/cmd/go/go_test.go | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/src/cmd/go/go_test.go b/src/cmd/go/go_test.go index c36e59586b..730faeb761 100644 --- a/src/cmd/go/go_test.go +++ b/src/cmd/go/go_test.go @@ -697,10 +697,10 @@ package main tg.wantStale("mycmd", "./testgo list mycmd claims mycmd is NOT stale after removing y.go; should be stale") } -func testLocalRun(tg *testgoData, local, match string) { - out, err := exec.Command("./hello" + exeSuffix).Output() +func testLocalRun(tg *testgoData, exepath, local, match string) { + out, err := exec.Command(exepath).Output() if err != nil { - tg.t.Fatal("error running hello:", err) + tg.t.Fatalf("error running %v: %v", exepath, err) } if !regexp.MustCompile(match).Match(out) { tg.t.Log(string(out)) @@ -709,21 +709,24 @@ func testLocalRun(tg *testgoData, local, match string) { } func testLocalEasy(tg *testgoData, local string) { - tg.creatingTemp("./hello" + exeSuffix) - tg.run("build", "-o", "hello"+exeSuffix, filepath.Join("testdata", local, "easy.go")) - testLocalRun(tg, local, `(?m)^easysub\.Hello`) + exepath := "./easy" + exeSuffix + tg.creatingTemp(exepath) + tg.run("build", "-o", exepath, filepath.Join("testdata", local, "easy.go")) + testLocalRun(tg, exepath, local, `(?m)^easysub\.Hello`) } func testLocalEasySub(tg *testgoData, local string) { - tg.creatingTemp("./hello" + exeSuffix) - tg.run("build", "-o", "hello"+exeSuffix, filepath.Join("testdata", local, "easysub", "main.go")) - testLocalRun(tg, local, `(?m)^easysub\.Hello`) + exepath := "./easysub" + exeSuffix + tg.creatingTemp(exepath) + tg.run("build", "-o", exepath, filepath.Join("testdata", local, "easysub", "main.go")) + testLocalRun(tg, exepath, local, `(?m)^easysub\.Hello`) } func testLocalHard(tg *testgoData, local string) { - tg.creatingTemp("./hello" + exeSuffix) - tg.run("build", "-o", "hello"+exeSuffix, filepath.Join("testdata", local, "hard.go")) - testLocalRun(tg, local, `(?m)^sub\.Hello`) + exepath := "./hard" + exeSuffix + tg.creatingTemp(exepath) + tg.run("build", "-o", exepath, filepath.Join("testdata", local, "hard.go")) + testLocalRun(tg, exepath, local, `(?m)^sub\.Hello`) } func testLocalInstall(tg *testgoData, local string) { -- 2.50.0