From: Ian Lance Taylor Date: Fri, 26 Feb 2016 21:05:35 +0000 (-0800) Subject: cmd/compile: create test binary in temp directory X-Git-Tag: go1.7beta1~1682 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=a131a66e63d805db05bb320146815ee053a1c258;p=gostls13.git cmd/compile: create test binary in temp directory The new TestDashS was leaving a dreg "test" file in cmd/compile/internal/gc. Create it in the temporary directory instead. Also change path.Join to filepath.Join throughout global_test.go. Change-Id: Ib7707fada2b3ab5e8abc2ba74e4c402821c1408b Reviewed-on: https://go-review.googlesource.com/19965 Run-TryBot: Ian Lance Taylor TryBot-Result: Gobot Gobot Reviewed-by: Keith Randall --- diff --git a/src/cmd/compile/internal/gc/global_test.go b/src/cmd/compile/internal/gc/global_test.go index 80781e61a8..bd1391d9ad 100644 --- a/src/cmd/compile/internal/gc/global_test.go +++ b/src/cmd/compile/internal/gc/global_test.go @@ -11,7 +11,7 @@ import ( "log" "os" "os/exec" - "path" + "path/filepath" "strings" "testing" ) @@ -29,7 +29,7 @@ func TestScanfRemoval(t *testing.T) { defer os.RemoveAll(dir) // Create source. - src := path.Join(dir, "test.go") + src := filepath.Join(dir, "test.go") f, err := os.Create(src) if err != nil { log.Fatalf("could not create source file: %v", err) @@ -44,7 +44,7 @@ func main() { f.Close() // Name of destination. - dst := path.Join(dir, "test") + dst := filepath.Join(dir, "test") // Compile source. cmd := exec.Command("go", "build", "-o", dst, src) @@ -76,7 +76,7 @@ func TestDashS(t *testing.T) { defer os.RemoveAll(dir) // Create source. - src := path.Join(dir, "test.go") + src := filepath.Join(dir, "test.go") f, err := os.Create(src) if err != nil { log.Fatalf("could not create source file: %v", err) @@ -91,7 +91,7 @@ func main() { f.Close() // Compile source. - cmd := exec.Command("go", "build", "-gcflags", "-S", src) + cmd := exec.Command("go", "build", "-gcflags", "-S", "-o", filepath.Join(dir, "test"), src) out, err := cmd.CombinedOutput() if err != nil { log.Fatalf("could not build target: %v", err)