Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: add per-test timeout to run.go #11598

Open
josharian opened this issue Jul 4, 2015 · 2 comments

Comments

@josharian
Copy link
Contributor

commented Jul 4, 2015

On the SSA branch, after fixing some other issues, the compiler hangs while compiling ken/label.go. This causes run.go to run forever. Let's add a per-test time limit, even if it is high, so we don't ever spin forever.

@ianlancetaylor ianlancetaylor added this to the Go1.6 milestone Jul 10, 2015

@rsc rsc modified the milestones: Unplanned, Go1.6 Nov 5, 2015

@chadwhitacre

This comment has been minimized.

Copy link

commented Oct 25, 2017

Can this be closed with 7f1ff65?

modifications to test/run.go to deal with timeout and killing looping test.

go/test/run.go

Lines 510 to 516 in eb7e845

case "-t": // timeout in seconds
args = args[1:]
var err error
tim, err = strconv.Atoi(args[0])
if err != nil {
t.err = fmt.Errorf("need number of seconds for -t timeout, got %s instead", args[0])
}

go/test/run.go

Lines 559 to 572 in eb7e845

tick := time.NewTimer(time.Duration(tim) * time.Second)
done := make(chan error)
go func() {
done <- cmd.Wait()
}()
select {
case err = <-done:
// ok
case <-tick.C:
cmd.Process.Kill()
err = <-done
// err = errors.New("Test timeout")
}
tick.Stop()

@ianlancetaylor

This comment has been minimized.

Copy link
Contributor

commented Oct 25, 2017

I think @josharian is asking for a default timeout.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.