diff --git a/proctl/proctl_test.go b/proctl/proctl_test.go index 49aa48b16e166813b8a6fca20a460467927d82d3..a5d5f41c55985c30f7572576aabdce775995b2da 100644 --- a/proctl/proctl_test.go +++ b/proctl/proctl_test.go @@ -8,7 +8,6 @@ import ( "path/filepath" "runtime" "testing" - "time" ) func withTestProcess(name string, t *testing.T, fn func(p *DebuggedProcess)) { @@ -91,10 +90,14 @@ func TestExit(t *testing.T) { func TestHalt(t *testing.T) { withTestProcess("../_fixtures/testprog", t, func(p *DebuggedProcess) { go func() { - time.Sleep(10 * time.Millisecond) - err := p.RequestManualStop() - if err != nil { - t.Fatal(err) + for { + if p.Running() { + err := p.RequestManualStop() + if err != nil { + t.Fatal(err) + } + return + } } }() err := p.Continue() @@ -388,7 +391,7 @@ func TestSwitchThread(t *testing.T) { } var nt int ct := p.CurrentThread.Id - for tid, _ := range p.Threads { + for tid := range p.Threads { if tid != ct { nt = tid break