Simplify shim timeout logic.

I don't think this lock is actually needed. If the process exited by the
time we call shim.Process.Kill(), then the test ultimately finished. If
not, wait() will return that the process died by a signal.

Change-Id: I668a86583aba16fd00e0cd05071acc13059a2c42
Reviewed-on: https://boringssl-review.googlesource.com/27325
Reviewed-by: Adam Langley <agl@google.com>
This commit is contained in:
David Benjamin 2018-04-11 19:50:37 -04:00 committed by Adam Langley
parent 48b276db3d
commit 06c28d8e51

View File

@ -1210,21 +1210,11 @@ func runTest(test *testCase, shimPath string, mallocNumToFail int64) 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()
if shimKilled && err == nil {
err = errors.New("timeout waiting for the shim to exit.")
}
shimKilledLock.Unlock()
}
var isValgrindError, mustFail bool