]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/go: vary executable names in tests
authorAlex Brainman <alex.brainman@gmail.com>
Wed, 17 Jun 2015 00:22:03 +0000 (10:22 +1000)
committerAlex Brainman <alex.brainman@gmail.com>
Wed, 17 Jun 2015 01:26:40 +0000 (01:26 +0000)
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 <iant@golang.org>
src/cmd/go/go_test.go

index c36e59586b53c306ae53c9fc152954b784c0f7be..730faeb761167f668be6a8d68f62dbb08983f057 100644 (file)
@@ -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) {