Skip to content

Commit

Permalink
cmd/cgo/internal/testcarchive: remove 1-minute timeout
Browse files Browse the repository at this point in the history
The 1-minute test timeout seems a bit arbitrary. Use
internal/testenv.Command, which applies t.Deadline to subcommand.

For #67566.

Change-Id: If84c96e353bdfaf02c9b123758198e031305ae32
Reviewed-on: https://go-review.googlesource.com/c/go/+/599056
LUCI-TryBot-Result: Go LUCI <[email protected]>
Reviewed-by: Dmitri Shuralyov <[email protected]>
Reviewed-by: Dmitri Shuralyov <[email protected]>
  • Loading branch information
cherrymui committed Jul 17, 2024
1 parent fc51e50 commit 8c88f0c
Showing 1 changed file with 2 additions and 18 deletions.
20 changes: 2 additions & 18 deletions src/cmd/cgo/internal/testcarchive/carchive_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1224,22 +1224,14 @@ func TestManyCalls(t *testing.T) {
}

argv := cmdToRun("./testp7")
cmd = exec.Command(argv[0], argv[1:]...)
cmd = testenv.Command(t, argv[0], argv[1:]...)
sb := new(strings.Builder)
cmd.Stdout = sb
cmd.Stderr = sb
if err := cmd.Start(); err != nil {
t.Fatal(err)
}

timer := time.AfterFunc(time.Minute,
func() {
t.Error("test program timed out")
cmd.Process.Kill()
},
)
defer timer.Stop()

err = cmd.Wait()
t.Logf("%v\n%s", cmd.Args, sb)
if err != nil {
Expand Down Expand Up @@ -1284,22 +1276,14 @@ func TestPreemption(t *testing.T) {
}

argv := cmdToRun("./testp8")
cmd = exec.Command(argv[0], argv[1:]...)
cmd = testenv.Command(t, argv[0], argv[1:]...)
sb := new(strings.Builder)
cmd.Stdout = sb
cmd.Stderr = sb
if err := cmd.Start(); err != nil {
t.Fatal(err)
}

timer := time.AfterFunc(time.Minute,
func() {
t.Error("test program timed out")
cmd.Process.Kill()
},
)
defer timer.Stop()

err = cmd.Wait()
t.Logf("%v\n%s", cmd.Args, sb)
if err != nil {
Expand Down

0 comments on commit 8c88f0c

Please sign in to comment.