mirror of
https://github.com/golang/go
synced 2024-11-25 09:07:58 -07:00
cmd/go: kill test.out after 1 minute
Will have to do better but this is enough to stop the builders from hanging, I hope. R=golang-dev, dsymonds, adg CC=golang-dev https://golang.org/cl/5533066
This commit is contained in:
parent
1250f94f93
commit
0c012af114
@ -463,8 +463,30 @@ func (b *builder) runTest(a *action) error {
|
||||
|
||||
cmd := exec.Command(args[0], args[1:]...)
|
||||
cmd.Dir = a.p.Dir
|
||||
var buf bytes.Buffer
|
||||
cmd.Stdout = &buf
|
||||
cmd.Stderr = &buf
|
||||
|
||||
t0 := time.Now()
|
||||
out, err := cmd.CombinedOutput()
|
||||
err := cmd.Start()
|
||||
const deadline = 1 * time.Minute
|
||||
tick := time.NewTimer(deadline)
|
||||
if err == nil {
|
||||
done := make(chan error)
|
||||
go func() {
|
||||
done <- cmd.Wait()
|
||||
}()
|
||||
select {
|
||||
case err = <-done:
|
||||
// ok
|
||||
case <-tick.C:
|
||||
cmd.Process.Kill()
|
||||
err = <-done
|
||||
fmt.Fprintf(&buf, "*** Test killed: ran too long.\n")
|
||||
}
|
||||
tick.Stop()
|
||||
}
|
||||
out := buf.Bytes()
|
||||
t1 := time.Now()
|
||||
t := fmt.Sprintf("%.3fs", t1.Sub(t0).Seconds())
|
||||
if err == nil {
|
||||
|
Loading…
Reference in New Issue
Block a user