mirror of
https://github.com/golang/go.git
synced 2025-10-19 19:13:18 +00:00
runtime: remove arbitrary 5-second timeout in TestNeedmDeadlock
The NeedmDeadlock test program currently has a 5-second timeout, which is sort of arbitrary. It is long enough in regular mode (which usually takes 0.0X seconds), but not quite so for configurations like ASAN. Instead of using an arbitrary timeout, just use the test's deadline. The test program is invoked with testenv.Command, which will send it a SIGQUIT before the deadline expires. Fixes #56420 (at least for the asan builder). Change-Id: I0b13651cb07241401837ca2e60eaa1b83275b093 Reviewed-on: https://go-review.googlesource.com/c/go/+/684697 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
This commit is contained in:
parent
f1e6ae2f6f
commit
b51f1cdb87
1 changed files with 2 additions and 8 deletions
|
@ -70,8 +70,6 @@ import "C"
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
|
||||||
"time"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
@ -84,12 +82,8 @@ func GoNeedM() {
|
||||||
|
|
||||||
func NeedmDeadlock() {
|
func NeedmDeadlock() {
|
||||||
// The failure symptom is that the program hangs because of a
|
// The failure symptom is that the program hangs because of a
|
||||||
// deadlock in needm, so set an alarm.
|
// deadlock in needm. Instead of using an arbitrary timeout,
|
||||||
go func() {
|
// we let the test deadline expire if it deadlocks.
|
||||||
time.Sleep(5 * time.Second)
|
|
||||||
fmt.Println("Hung for 5 seconds")
|
|
||||||
os.Exit(1)
|
|
||||||
}()
|
|
||||||
|
|
||||||
C.runNeedmSignalThread()
|
C.runNeedmSignalThread()
|
||||||
fmt.Println("OK")
|
fmt.Println("OK")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue