]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/vet: use testenv.Command instead of exec.Command in tests
authorBryan C. Mills <bcmills@google.com>
Tue, 15 Nov 2022 15:53:41 +0000 (10:53 -0500)
committerGopher Robot <gobot@golang.org>
Tue, 15 Nov 2022 20:25:11 +0000 (20:25 +0000)
testenv.Command sets a default timeout based on the test's deadline
and sends SIGQUIT (where supported) in case of a hang.

Change-Id: I973be280cd0a7f495b491bfb0e04771389562e04
Reviewed-on: https://go-review.googlesource.com/c/go/+/450711
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Bryan Mills <bcmills@google.com>

src/cmd/vet/vet_test.go

index fed88e797833d58797d4d73da755ed1922cc8aa9..280ed8d7ae5fe9a2e04fc55757ff258de5f68378 100644 (file)
@@ -54,7 +54,7 @@ var (
 )
 
 func vetCmd(t *testing.T, arg, pkg string) *exec.Cmd {
-       cmd := exec.Command(testenv.GoToolPath(t), "vet", "-vettool="+vetPath(t), arg, path.Join("cmd/vet/testdata", pkg))
+       cmd := testenv.Command(t, testenv.GoToolPath(t), "vet", "-vettool="+vetPath(t), arg, path.Join("cmd/vet/testdata", pkg))
        cmd.Env = os.Environ()
        return cmd
 }
@@ -125,7 +125,7 @@ func cgoEnabled(t *testing.T) bool {
        // That's fine for the builders, but causes commands like
        // 'GOARCH=386 go test .' to fail.
        // Instead, we ask the go command.
-       cmd := exec.Command(testenv.GoToolPath(t), "list", "-f", "{{context.CgoEnabled}}")
+       cmd := testenv.Command(t, testenv.GoToolPath(t), "list", "-f", "{{context.CgoEnabled}}")
        out, _ := cmd.CombinedOutput()
        return string(out) == "true\n"
 }