Commit a131a66e authored by Ian Lance Taylor's avatar Ian Lance Taylor

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 <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: default avatarKeith Randall <khr@golang.org>
parent b66a8923
......@@ -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)
......
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