Unset RUBY_CRASH_REPORT in tests that crash on purpose

This commit is contained in:
Alan Wu 2025-09-15 17:15:23 -04:00
parent 3fa1eb7115
commit 7ed1b24bf3
4 changed files with 7 additions and 5 deletions

View File

@ -23,7 +23,7 @@ class TestBugReporter < Test::Unit::TestCase
# We want the printed description to match this process's RUBY_DESCRIPTION
args.push("--yjit") if JITSupport.yjit_enabled?
args.push("--zjit") if JITSupport.zjit_enabled?
args.unshift({"RUBY_ON_BUG" => nil})
args.unshift({"RUBY_ON_BUG" => nil, "RUBY_CRASH_REPORT" => nil})
stdin = "#{no_core}register_sample_bug_reporter(12345); Process.kill :SEGV, $$"
assert_in_out_err(args, stdin, [], expected_stderr, encoding: "ASCII-8BIT")
ensure

View File

@ -855,6 +855,7 @@ class TestRubyOptions < Test::Unit::TestCase
args.unshift("--yjit") if JITSupport.yjit_enabled?
args.unshift("--zjit") if JITSupport.zjit_enabled?
env.update({'RUBY_ON_BUG' => nil})
env['RUBY_CRASH_REPORT'] ||= nil # default to not passing down parent setting
# ASAN registers a segv handler which prints out "AddressSanitizer: DEADLYSIGNAL" when
# catching sigsegv; we don't expect that output, so suppress it.
env.update({'ASAN_OPTIONS' => 'handle_segv=0'})

View File

@ -5,6 +5,7 @@ return unless /darwin/ =~ RUBY_PLATFORM
class TestVMDump < Test::Unit::TestCase
def assert_darwin_vm_dump_works(args, timeout=nil)
args.unshift({"RUBY_ON_BUG" => nil, "RUBY_CRASH_REPORT" => nil})
assert_in_out_err(args, "", [], /^\[IMPORTANT\]/, timeout: timeout || 300)
end
@ -13,7 +14,7 @@ class TestVMDump < Test::Unit::TestCase
end
def test_darwin_segv_in_syscall
assert_darwin_vm_dump_works('-e1.times{Process.kill :SEGV,$$}')
assert_darwin_vm_dump_works(['-e1.times{Process.kill :SEGV,$$}'])
end
def test_darwin_invalid_access

View File

@ -151,9 +151,9 @@ module TestParallel
end
class TestParallel < Test::Unit::TestCase
def spawn_runner(*opt_args, jobs: "t1")
def spawn_runner(*opt_args, jobs: "t1", env: {})
@test_out, o = IO.pipe
@test_pid = spawn(*@__runner_options__[:ruby], TESTS+"/runner.rb",
@test_pid = spawn(env, *@__runner_options__[:ruby], TESTS+"/runner.rb",
"--ruby", @__runner_options__[:ruby].join(" "),
"-j", jobs, *opt_args, out: o, err: o)
o.close
@ -214,7 +214,7 @@ module TestParallel
end
def test_hungup
spawn_runner "--worker-timeout=1", "--retry", "test4test_hungup.rb"
spawn_runner("--worker-timeout=1", "--retry", "test4test_hungup.rb", env: {"RUBY_CRASH_REPORT"=>nil})
buf = ::TestParallel.timeout(TIMEOUT) {@test_out.read}
assert_match(/^Retrying hung up testcases\.+$/, buf)
assert_match(/^2 tests,.* 0 failures,/, buf)