diff options
Diffstat (limited to 'src/cmd/compile/internal/test')
-rw-r--r-- | src/cmd/compile/internal/test/clobberdead_test.go | 3 | ||||
-rw-r--r-- | src/cmd/compile/internal/test/dep_test.go | 3 | ||||
-rw-r--r-- | src/cmd/compile/internal/test/fixedbugs_test.go | 3 | ||||
-rw-r--r-- | src/cmd/compile/internal/test/global_test.go | 7 | ||||
-rw-r--r-- | src/cmd/compile/internal/test/inl_test.go | 7 | ||||
-rw-r--r-- | src/cmd/compile/internal/test/inst_test.go | 7 | ||||
-rw-r--r-- | src/cmd/compile/internal/test/lang_test.go | 3 | ||||
-rw-r--r-- | src/cmd/compile/internal/test/pgo_inl_test.go | 3 | ||||
-rw-r--r-- | src/cmd/compile/internal/test/reproduciblebuilds_test.go | 5 | ||||
-rw-r--r-- | src/cmd/compile/internal/test/ssa_test.go | 9 |
10 files changed, 20 insertions, 30 deletions
diff --git a/src/cmd/compile/internal/test/clobberdead_test.go b/src/cmd/compile/internal/test/clobberdead_test.go index e7910b865c..80d9678c08 100644 --- a/src/cmd/compile/internal/test/clobberdead_test.go +++ b/src/cmd/compile/internal/test/clobberdead_test.go @@ -7,7 +7,6 @@ package test import ( "internal/testenv" "os" - "os/exec" "path/filepath" "testing" ) @@ -44,7 +43,7 @@ func runHello(t *testing.T, flag string) { t.Fatalf("write file failed: %v", err) } - cmd := exec.Command(testenv.GoToolPath(t), "run", "-gcflags=all="+flag, src) + cmd := testenv.Command(t, testenv.GoToolPath(t), "run", "-gcflags=all="+flag, src) out, err := cmd.CombinedOutput() if err != nil { t.Fatalf("go run failed: %v\n%s", err, out) diff --git a/src/cmd/compile/internal/test/dep_test.go b/src/cmd/compile/internal/test/dep_test.go index 698a848db6..d141f1074a 100644 --- a/src/cmd/compile/internal/test/dep_test.go +++ b/src/cmd/compile/internal/test/dep_test.go @@ -6,13 +6,12 @@ package test import ( "internal/testenv" - "os/exec" "strings" "testing" ) func TestDeps(t *testing.T) { - out, err := exec.Command(testenv.GoToolPath(t), "list", "-f", "{{.Deps}}", "cmd/compile/internal/gc").Output() + out, err := testenv.Command(t, testenv.GoToolPath(t), "list", "-f", "{{.Deps}}", "cmd/compile/internal/gc").Output() if err != nil { t.Fatal(err) } diff --git a/src/cmd/compile/internal/test/fixedbugs_test.go b/src/cmd/compile/internal/test/fixedbugs_test.go index 5978b44a7d..cf607b7e48 100644 --- a/src/cmd/compile/internal/test/fixedbugs_test.go +++ b/src/cmd/compile/internal/test/fixedbugs_test.go @@ -7,7 +7,6 @@ package test import ( "internal/testenv" "os" - "os/exec" "path/filepath" "strings" "testing" @@ -71,7 +70,7 @@ func TestIssue16214(t *testing.T) { t.Fatalf("could not write file: %v", err) } - cmd := exec.Command(testenv.GoToolPath(t), "tool", "compile", "-p=main", "-S", "-o", filepath.Join(dir, "out.o"), src) + cmd := testenv.Command(t, testenv.GoToolPath(t), "tool", "compile", "-p=main", "-S", "-o", filepath.Join(dir, "out.o"), src) out, err := cmd.CombinedOutput() if err != nil { t.Fatalf("go tool compile: %v\n%s", err, out) diff --git a/src/cmd/compile/internal/test/global_test.go b/src/cmd/compile/internal/test/global_test.go index 4862b90d44..2cf93dc4f7 100644 --- a/src/cmd/compile/internal/test/global_test.go +++ b/src/cmd/compile/internal/test/global_test.go @@ -8,7 +8,6 @@ import ( "bytes" "internal/testenv" "os" - "os/exec" "path/filepath" "strings" "testing" @@ -46,14 +45,14 @@ func main() { dst := filepath.Join(dir, "test") // Compile source. - cmd := exec.Command(testenv.GoToolPath(t), "build", "-o", dst, src) + cmd := testenv.Command(t, testenv.GoToolPath(t), "build", "-o", dst, src) out, err := cmd.CombinedOutput() if err != nil { t.Fatalf("could not build target: %v\n%s", err, out) } // Check destination to see if scanf code was included. - cmd = exec.Command(testenv.GoToolPath(t), "tool", "nm", dst) + cmd = testenv.Command(t, testenv.GoToolPath(t), "tool", "nm", dst) out, err = cmd.CombinedOutput() if err != nil { t.Fatalf("could not read target: %v", err) @@ -91,7 +90,7 @@ func main() { f.Close() // Compile source. - cmd := exec.Command(testenv.GoToolPath(t), "build", "-gcflags", "-S", "-o", filepath.Join(dir, "test"), src) + cmd := testenv.Command(t, testenv.GoToolPath(t), "build", "-gcflags", "-S", "-o", filepath.Join(dir, "test"), src) out, err := cmd.CombinedOutput() if err != nil { t.Fatalf("could not build target: %v\n%s", err, out) diff --git a/src/cmd/compile/internal/test/inl_test.go b/src/cmd/compile/internal/test/inl_test.go index c73f49eeb7..201f5773e9 100644 --- a/src/cmd/compile/internal/test/inl_test.go +++ b/src/cmd/compile/internal/test/inl_test.go @@ -11,7 +11,6 @@ import ( "internal/testenv" "io" "math/bits" - "os/exec" "regexp" "runtime" "strings" @@ -279,7 +278,7 @@ func TestIntendedInlining(t *testing.T) { } args := append([]string{"build", "-gcflags=-m -m", "-tags=math_big_pure_go"}, pkgs...) - cmd := testenv.CleanCmdEnv(exec.Command(testenv.GoToolPath(t), args...)) + cmd := testenv.CleanCmdEnv(testenv.Command(t, testenv.GoToolPath(t), args...)) pr, pw := io.Pipe() cmd.Stdout = pw cmd.Stderr = pw @@ -362,7 +361,7 @@ func TestIssue56044(t *testing.T) { for _, mode := range modes { // Build the Go runtime with "-m", capturing output. args := []string{"build", "-gcflags=runtime=-m", "runtime"} - cmd := exec.Command(testenv.GoToolPath(t), args...) + cmd := testenv.Command(t, testenv.GoToolPath(t), args...) b, err := cmd.CombinedOutput() if err != nil { t.Fatalf("build failed (%v): %s", err, b) @@ -371,7 +370,7 @@ func TestIssue56044(t *testing.T) { // Redo the build with -cover, also with "-m". args = []string{"build", "-gcflags=runtime=-m", mode, "runtime"} - cmd = exec.Command(testenv.GoToolPath(t), args...) + cmd = testenv.Command(t, testenv.GoToolPath(t), args...) b, err = cmd.CombinedOutput() if err != nil { t.Fatalf("build failed (%v): %s", err, b) diff --git a/src/cmd/compile/internal/test/inst_test.go b/src/cmd/compile/internal/test/inst_test.go index 65d3a6c37e..de435de49f 100644 --- a/src/cmd/compile/internal/test/inst_test.go +++ b/src/cmd/compile/internal/test/inst_test.go @@ -7,7 +7,6 @@ package test import ( "internal/testenv" "os" - "os/exec" "path/filepath" "regexp" "testing" @@ -34,14 +33,14 @@ func TestInst(t *testing.T) { outname := "ptrsort.out" gotool := testenv.GoToolPath(t) dest := filepath.Join(tmpdir, exename) - cmd := exec.Command(gotool, "build", "-o", dest, filepath.Join("testdata", filename)) + cmd := testenv.Command(t, gotool, "build", "-o", dest, filepath.Join("testdata", filename)) if output, err = cmd.CombinedOutput(); err != nil { t.Fatalf("Failed: %v:\nOutput: %s\n", err, output) } // Test that there is exactly one shape-based instantiation of Sort in // the executable. - cmd = exec.Command(gotool, "tool", "nm", dest) + cmd = testenv.Command(t, gotool, "tool", "nm", dest) if output, err = cmd.CombinedOutput(); err != nil { t.Fatalf("Failed: %v:\nOut: %s\n", err, output) } @@ -54,7 +53,7 @@ func TestInst(t *testing.T) { } // Actually run the test and make sure output is correct. - cmd = exec.Command(gotool, "run", filepath.Join("testdata", filename)) + cmd = testenv.Command(t, gotool, "run", filepath.Join("testdata", filename)) if output, err = cmd.CombinedOutput(); err != nil { t.Fatalf("Failed: %v:\nOut: %s\n", err, output) } diff --git a/src/cmd/compile/internal/test/lang_test.go b/src/cmd/compile/internal/test/lang_test.go index 5cb4695b68..0b957dc3d8 100644 --- a/src/cmd/compile/internal/test/lang_test.go +++ b/src/cmd/compile/internal/test/lang_test.go @@ -7,7 +7,6 @@ package test import ( "internal/testenv" "os" - "os/exec" "path/filepath" "testing" ) @@ -57,7 +56,7 @@ func TestInvalidLang(t *testing.T) { func testLang(t *testing.T, lang, src, outfile string) error { run := []string{testenv.GoToolPath(t), "tool", "compile", "-p=p", "-lang", lang, "-o", outfile, src} t.Log(run) - out, err := exec.Command(run[0], run[1:]...).CombinedOutput() + out, err := testenv.Command(t, run[0], run[1:]...).CombinedOutput() t.Logf("%s", out) return err } diff --git a/src/cmd/compile/internal/test/pgo_inl_test.go b/src/cmd/compile/internal/test/pgo_inl_test.go index ea2e00ce38..2f6391fded 100644 --- a/src/cmd/compile/internal/test/pgo_inl_test.go +++ b/src/cmd/compile/internal/test/pgo_inl_test.go @@ -10,7 +10,6 @@ import ( "internal/testenv" "io" "os" - "os/exec" "path/filepath" "regexp" "strings" @@ -72,7 +71,7 @@ go 1.19 pprof := filepath.Join(dir, "inline_hot.pprof") gcflag := fmt.Sprintf("-gcflags=-m -m -pgoprofile=%s -d=pgoinlinebudget=160,pgoinlinecdfthreshold=90", pprof) out := filepath.Join(dir, "test.exe") - cmd := testenv.CleanCmdEnv(exec.Command(testenv.GoToolPath(t), "test", "-c", "-o", out, gcflag, ".")) + cmd := testenv.CleanCmdEnv(testenv.Command(t, testenv.GoToolPath(t), "test", "-c", "-o", out, gcflag, ".")) cmd.Dir = dir pr, pw, err := os.Pipe() diff --git a/src/cmd/compile/internal/test/reproduciblebuilds_test.go b/src/cmd/compile/internal/test/reproduciblebuilds_test.go index 7eca7f6c89..a803e741b9 100644 --- a/src/cmd/compile/internal/test/reproduciblebuilds_test.go +++ b/src/cmd/compile/internal/test/reproduciblebuilds_test.go @@ -8,7 +8,6 @@ import ( "bytes" "internal/testenv" "os" - "os/exec" "path/filepath" "testing" ) @@ -40,7 +39,7 @@ func TestReproducibleBuilds(t *testing.T) { for i := 0; i < iters; i++ { // Note: use -c 2 to expose any nondeterminism which is the result // of the runtime scheduler. - out, err := exec.Command(testenv.GoToolPath(t), "tool", "compile", "-p=p", "-c", "2", "-o", tmp.Name(), filepath.Join("testdata", "reproducible", test)).CombinedOutput() + out, err := testenv.Command(t, testenv.GoToolPath(t), "tool", "compile", "-p=p", "-c", "2", "-o", tmp.Name(), filepath.Join("testdata", "reproducible", test)).CombinedOutput() if err != nil { t.Fatalf("failed to compile: %v\n%s", err, out) } @@ -88,7 +87,7 @@ func TestIssue38068(t *testing.T) { s := &scenarios[i] s.libpath = filepath.Join(tmpdir, s.tag+".a") // Note: use of "-p" required in order for DWARF to be generated. - cmd := exec.Command(testenv.GoToolPath(t), "tool", "compile", "-p=issue38068", "-buildid=", s.args, "-o", s.libpath, src) + cmd := testenv.Command(t, testenv.GoToolPath(t), "tool", "compile", "-p=issue38068", "-buildid=", s.args, "-o", s.libpath, src) out, err := cmd.CombinedOutput() if err != nil { t.Fatalf("%v: %v:\n%s", cmd.Args, err, out) diff --git a/src/cmd/compile/internal/test/ssa_test.go b/src/cmd/compile/internal/test/ssa_test.go index 56cd1285ec..0b6a675238 100644 --- a/src/cmd/compile/internal/test/ssa_test.go +++ b/src/cmd/compile/internal/test/ssa_test.go @@ -12,7 +12,6 @@ import ( "go/token" "internal/testenv" "os" - "os/exec" "path/filepath" "runtime" "strings" @@ -27,7 +26,7 @@ func runGenTest(t *testing.T, filename, tmpname string, ev ...string) { testenv.MustHaveGoRun(t) gotool := testenv.GoToolPath(t) var stdout, stderr bytes.Buffer - cmd := exec.Command(gotool, "run", filepath.Join("testdata", filename)) + cmd := testenv.Command(t, gotool, "run", filepath.Join("testdata", filename)) cmd.Stdout = &stdout cmd.Stderr = &stderr if err := cmd.Run(); err != nil { @@ -48,7 +47,7 @@ func runGenTest(t *testing.T, filename, tmpname string, ev ...string) { stdout.Reset() stderr.Reset() - cmd = exec.Command(gotool, "run", "-gcflags=-d=ssa/check/on", rungo) + cmd = testenv.Command(t, gotool, "run", "-gcflags=-d=ssa/check/on", rungo) cmd.Stdout = &stdout cmd.Stderr = &stderr cmd.Env = append(cmd.Env, ev...) @@ -167,7 +166,7 @@ func TestCode(t *testing.T) { for _, flag := range flags { args := []string{"test", "-c", "-gcflags=-d=ssa/check/on" + flag, "-o", filepath.Join(tmpdir, "code.test")} args = append(args, srcs...) - out, err := exec.Command(gotool, args...).CombinedOutput() + out, err := testenv.Command(t, gotool, args...).CombinedOutput() if err != nil || len(out) != 0 { t.Fatalf("Build failed: %v\n%s\n", err, out) } @@ -180,7 +179,7 @@ func TestCode(t *testing.T) { continue } t.Run(fmt.Sprintf("%s%s", test.name[4:], flag), func(t *testing.T) { - out, err := exec.Command(filepath.Join(tmpdir, "code.test"), "-test.run="+test.name).CombinedOutput() + out, err := testenv.Command(t, filepath.Join(tmpdir, "code.test"), "-test.run="+test.name).CombinedOutput() if err != nil || string(out) != "PASS\n" { t.Errorf("Failed:\n%s\n", out) } |