From 861f28a624b68930d30be8edb5392a26c7b483ad Mon Sep 17 00:00:00 2001 From: David Benjamin Date: Fri, 6 Oct 2017 13:10:45 -0400 Subject: [PATCH] Clear one more timeout when using gdb. https://boringssl-review.googlesource.com/18605 got the other ones. Change-Id: If00487a4dd8508496a31a0a565c965559e12879c Reviewed-on: https://boringssl-review.googlesource.com/21264 Commit-Queue: David Benjamin Commit-Queue: Adam Langley Reviewed-by: Adam Langley CQ-Verified: CQ bot account: commit-bot@chromium.org --- ssl/test/runner/runner.go | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/ssl/test/runner/runner.go b/ssl/test/runner/runner.go index 39a37658..5918e6b3 100644 --- a/ssl/test/runner/runner.go +++ b/ssl/test/runner/runner.go @@ -1145,21 +1145,27 @@ func runTest(test *testCase, shimPath string, mallocNumToFail int64) error { listener.Close() listener = nil - var shimKilledLock sync.Mutex - var shimKilled bool - waitTimeout := time.AfterFunc(*idleTimeout, func() { + var childErr error + if *useGDB { + childErr = <-waitChan + } else { + var shimKilledLock sync.Mutex + var shimKilled bool + waitTimeout := time.AfterFunc(*idleTimeout, func() { + shimKilledLock.Lock() + shimKilled = true + shimKilledLock.Unlock() + shim.Process.Kill() + }) + childErr = <-waitChan + waitTimeout.Stop() shimKilledLock.Lock() - shimKilled = true + if shimKilled && err == nil { + err = errors.New("timeout waiting for the shim to exit.") + } shimKilledLock.Unlock() - shim.Process.Kill() - }) - childErr := <-waitChan - waitTimeout.Stop() - shimKilledLock.Lock() - if shimKilled && err == nil { - err = errors.New("timeout waiting for the shim to exit.") } - shimKilledLock.Unlock() + var isValgrindError bool if exitError, ok := childErr.(*exec.ExitError); ok { switch exitError.Sys().(syscall.WaitStatus).ExitStatus() {