cmd/roachtest: remove the use of runtime.Goexit#50703
cmd/roachtest: remove the use of runtime.Goexit#50703craig[bot] merged 1 commit intocockroachdb:masterfrom
Conversation
7fca96d to
b2fedf2
Compare
bdarnell
left a comment
There was a problem hiding this comment.
The message in errGoexit is now a little misleading.
Reviewed 3 of 4 files at r1.
Reviewable status:complete! 0 of 0 LGTMs obtained (waiting on @bdarnell, @otan, @petermattis, and @tbg)
pkg/cmd/roachtest/test_runner.go, line 596 at r1 (raw file):
t.end = timeutil.Now() if err := recover(); err != nil && err != errGoexit {
If errGoexit reaches this point (I don't think it should), shouldn't we still treat it as a failed test?
pkg/cmd/roachtest/test_runner.go, line 747 at r1 (raw file):
// This is the call to actually run the test. defer func() { if r := recover(); r != nil && r != errGoexit {
Ditto.
tbg
left a comment
There was a problem hiding this comment.
To be fair, we weren't strictly abusing runtime.Goexit but rather trying to stay true to *testing.T. (There's no question that then suppressing the Goexit in some goroutines is a hack). I wish *testing.T would also stop using Goexit, but that won't ever happen.
| panic(errGoexit) | ||
| return errors.New("unreachable") | ||
| }) | ||
| expectedErr := regexp.QuoteMeta(`Goexit() was called`) |
|
Just for my sanity, can you run a local roachtest that you've changed to |
tbg
left a comment
There was a problem hiding this comment.
Reviewable status:
complete! 0 of 0 LGTMs obtained (waiting on @bdarnell, @otan, and @petermattis)
pkg/cmd/roachtest/test_runner.go, line 596 at r1 (raw file):
Previously, bdarnell (Ben Darnell) wrote…
If
errGoexitreaches this point (I don't think it should), shouldn't we still treat it as a failed test?
If errGoexit reaches this point, t.mu.failed is already true. But I had to look at this as well to figure this out. Worthy of a comment.
bbc5272 to
9625f7d
Compare
petermattis
left a comment
There was a problem hiding this comment.
Reviewable status:
complete! 0 of 0 LGTMs obtained (waiting on @bdarnell, @otan, and @tbg)
pkg/cmd/roachtest/cluster_test.go, line 248 at r1 (raw file):
Previously, tbg (Tobias Grieger) wrote…
This message is now misleading
Heh, that didn't bother me, but since you noticed I renamed errGoexit to errTestFatal and changed the message.
pkg/cmd/roachtest/test_runner.go, line 596 at r1 (raw file):
Previously, tbg (Tobias Grieger) wrote…
If errGoexit reaches this point,
t.mu.failedis already true. But I had to look at this as well to figure this out. Worthy of a comment.
Ditto what @tbg said. I'll add a comment.
pkg/cmd/roachtest/test_runner.go, line 747 at r1 (raw file):
Previously, bdarnell (Ben Darnell) wrote…
Ditto.
Done.
Sure. I added a Taking the same change and running it on master produced identical looking behavior and output. |
We were abusing `runtime.Goexit` to kill a goroutine when `test.Fatal` was called, but then transforming then aborting the resulting panic into a `panic(errGoexit)`. This abuse of `runtime.Goexit` was broken by go1.14 which makes the panic generated by `Goexit` truly unrecoverable (previously it was only documented as so). Now we simply `panic(errTestFatal)` from the get-go. This opens up the possibility that a roachtest may recover from this panic, but no current roachtests call `recover()`. See cockroachdb#48737 Release note: None
9625f7d to
9fc7c73
Compare
|
TFTR! CI finally passed. bors r+ |
Build succeeded |
We were abusing
runtime.Goexitto kill a goroutine whentest.Fatalwas called, but then transforming then aborting the resulting panic into
a
panic(errGoexit). This abuse ofruntime.Goexitwas broken bygo1.14 which makes the panic generated by
Goexittrulyunrecoverable (previously it was only documented as so). Now we simply
panic(errGoexit)from the get-go. This opens up the possibility that aroachtest may recover from this panic, but no current roachtests call
recover().See #48737
Release note: None