Skip to content

Commit 57167f2

Browse files
tannevaledclaude
andcommitted
vm: blocking-wait tests switch off the death report they do not test
With report_on_exception true by default, three cases of TestBlockingWaitNotInterruptedWhenItShouldNotBe received the report MRI writes to $stderr for a thread that dies with an exception: the harness gives the VM one writer for both streams, so it landed in the compared output on every CI lane. Those cases test that a wait is not ended, not the report, so each sets Thread.report_on_exception = false first, as a Ruby test of the same thing would. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 035713c commit 57167f2

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

‎internal/vm/thread_blocking_test.go‎

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -212,8 +212,11 @@ p t.join(0.05)
212212
t.kill
213213
p t.join(5).equal?(t)`, "nil\ntrue\n"},
214214
// An unhandled exception WITHOUT abort_on_exception does not reach the main
215-
// thread: its sleep runs to completion, as in MRI.
216-
{"no_abort_does_not_interrupt_main", `Thread.new { raise "boom" }
215+
// thread: its sleep runs to completion, as in MRI. (Its death report, which
216+
// MRI writes to $stderr and this harness folds into the output, is
217+
// report_on_exception's business and is switched off here and below.)
218+
{"no_abort_does_not_interrupt_main", `Thread.report_on_exception = false
219+
Thread.new { raise "boom" }
217220
sleep 0.2
218221
puts "main survived"`, "main survived\n"},
219222
// The relock at the end of ConditionVariable#wait / Mutex#sleep is
@@ -310,7 +313,8 @@ end`, "deadlock; recursive locking\n"},
310313
// Until this case existed, that arm of the loop was reached only through the
311314
// uninterruptible relock, whose timing decides whether the waiter is parked
312315
// when the kill lands. A gate that reads coverage on the unlucky run fails.
313-
{"masked_raise_reaches_a_mutex_wait", `m = Mutex.new
316+
{"masked_raise_reaches_a_mutex_wait", `Thread.report_on_exception = false
317+
m = Mutex.new
314318
m.lock
315319
t = Thread.new do
316320
Thread.handle_interrupt(RuntimeError => :never) do
@@ -330,7 +334,8 @@ rescue RuntimeError => e
330334
end`, "lock acquired normally\ndelivered on exit: masked\n"},
331335
// A raise masked by Thread.handle_interrupt(:never) does not end the wait it
332336
// arrives during — the wait goes back to sleep, as do_mutex_lock's loop does.
333-
{"masked_raise_does_not_end_the_wait", `q = Queue.new
337+
{"masked_raise_does_not_end_the_wait", `Thread.report_on_exception = false
338+
q = Queue.new
334339
t = Thread.new do
335340
Thread.handle_interrupt(RuntimeError => :never) do
336341
q.pop

0 commit comments

Comments
 (0)