tests: fix flakiness of of TestIssue414 on windows (#2082)

Recent change #2061:

292f5c69f0c769fd32c2e8b1e7153b56e908efd7
proc: step into unexported runtime funcs when already inside runtime

means that TestIssue414 (which tries to step repeatedly until the
program exits) can now steps through way more runtime code than it ever
did before. This causes this test to occasionally fail. Stepping
blindly through runtime code has never been particularly safe as the
runtime can switch to a different goroutine causing Delve to misbehave.

This change restores the previous behavior of TestIssue414 where Step
behaved like Next inside runtime code.
This commit is contained in:
Alessandro Arzilli 2020-07-21 22:41:13 +02:00 committed by GitHub
parent cd38e5c5e5
commit 9e1b6541c1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1815,7 +1815,15 @@ func TestIssue414(t *testing.T) {
pc := currentPC(p, t)
f, ln := currentLineNumber(p, t)
t.Logf("at %s:%d %#x\n", f, ln, pc)
err := p.Step()
var err error
// Stepping through the runtime is not generally safe so after we are out
// of main.main just use Next.
// See: https://github.com/go-delve/delve/pull/2082
if f == fixture.Source {
err = p.Step()
} else {
err = p.Next()
}
if err != nil {
if _, exited := err.(proc.ErrProcessExited); exited {
break