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:
parent
48b276db3d
commit
06c28d8e51
@ -1210,21 +1210,11 @@ func runTest(test *testCase, shimPath string, mallocNumToFail int64) error {
|
|||||||
if *useGDB {
|
if *useGDB {
|
||||||
childErr = <-waitChan
|
childErr = <-waitChan
|
||||||
} else {
|
} else {
|
||||||
var shimKilledLock sync.Mutex
|
|
||||||
var shimKilled bool
|
|
||||||
waitTimeout := time.AfterFunc(*idleTimeout, func() {
|
waitTimeout := time.AfterFunc(*idleTimeout, func() {
|
||||||
shimKilledLock.Lock()
|
|
||||||
shimKilled = true
|
|
||||||
shimKilledLock.Unlock()
|
|
||||||
shim.Process.Kill()
|
shim.Process.Kill()
|
||||||
})
|
})
|
||||||
childErr = <-waitChan
|
childErr = <-waitChan
|
||||||
waitTimeout.Stop()
|
waitTimeout.Stop()
|
||||||
shimKilledLock.Lock()
|
|
||||||
if shimKilled && err == nil {
|
|
||||||
err = errors.New("timeout waiting for the shim to exit.")
|
|
||||||
}
|
|
||||||
shimKilledLock.Unlock()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var isValgrindError, mustFail bool
|
var isValgrindError, mustFail bool
|
||||||
|
Loading…
Reference in New Issue
Block a user