Commit 8e723109 authored by Alex Brainman's avatar Alex Brainman

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/11138Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
parent 99f5f796
...@@ -697,10 +697,10 @@ package main ...@@ -697,10 +697,10 @@ package main
tg.wantStale("mycmd", "./testgo list mycmd claims mycmd is NOT stale after removing y.go; should be stale") 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) { func testLocalRun(tg *testgoData, exepath, local, match string) {
out, err := exec.Command("./hello" + exeSuffix).Output() out, err := exec.Command(exepath).Output()
if err != nil { 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) { if !regexp.MustCompile(match).Match(out) {
tg.t.Log(string(out)) tg.t.Log(string(out))
...@@ -709,21 +709,24 @@ func testLocalRun(tg *testgoData, local, match string) { ...@@ -709,21 +709,24 @@ func testLocalRun(tg *testgoData, local, match string) {
} }
func testLocalEasy(tg *testgoData, local string) { func testLocalEasy(tg *testgoData, local string) {
tg.creatingTemp("./hello" + exeSuffix) exepath := "./easy" + exeSuffix
tg.run("build", "-o", "hello"+exeSuffix, filepath.Join("testdata", local, "easy.go")) tg.creatingTemp(exepath)
testLocalRun(tg, local, `(?m)^easysub\.Hello`) tg.run("build", "-o", exepath, filepath.Join("testdata", local, "easy.go"))
testLocalRun(tg, exepath, local, `(?m)^easysub\.Hello`)
} }
func testLocalEasySub(tg *testgoData, local string) { func testLocalEasySub(tg *testgoData, local string) {
tg.creatingTemp("./hello" + exeSuffix) exepath := "./easysub" + exeSuffix
tg.run("build", "-o", "hello"+exeSuffix, filepath.Join("testdata", local, "easysub", "main.go")) tg.creatingTemp(exepath)
testLocalRun(tg, local, `(?m)^easysub\.Hello`) 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) { func testLocalHard(tg *testgoData, local string) {
tg.creatingTemp("./hello" + exeSuffix) exepath := "./hard" + exeSuffix
tg.run("build", "-o", "hello"+exeSuffix, filepath.Join("testdata", local, "hard.go")) tg.creatingTemp(exepath)
testLocalRun(tg, local, `(?m)^sub\.Hello`) tg.run("build", "-o", exepath, filepath.Join("testdata", local, "hard.go"))
testLocalRun(tg, exepath, local, `(?m)^sub\.Hello`)
} }
func testLocalInstall(tg *testgoData, local string) { func testLocalInstall(tg *testgoData, local string) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment