Skip to content

Commit f0371ef

Browse files
committed
Suppress stderr output in TestRubyOptions#assert_segv
It is checked against the given `list`, do not print the same output twice.
1 parent 85e61ea commit f0371ef

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

test/ruby/test_rubyoptions.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -787,6 +787,12 @@ module SEGVTest
787787
unless /mswin|mingw/ =~ RUBY_PLATFORM
788788
opts[:rlimit_core] = 0
789789
end
790+
opts[:failed] = proc do |status, message = "", out = ""|
791+
if (sig = status.termsig) && Signal.list["SEGV"] == sig
792+
out = ""
793+
end
794+
Test::Unit::CoreAssertions::FailDesc[status, message]
795+
end
790796
ExecOptions = opts.freeze
791797

792798
# The regexp list that should match the entire stderr output.

tool/lib/core_assertions.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,11 +97,12 @@ def assert_file
9797
end
9898

9999
def assert_in_out_err(args, test_stdin = "", test_stdout = [], test_stderr = [], message = nil,
100-
success: nil, **opt)
100+
success: nil, failed: nil, **opt)
101101
args = Array(args).dup
102102
args.insert((Hash === args[0] ? 1 : 0), '--disable=gems')
103103
stdout, stderr, status = EnvUtil.invoke_ruby(args, test_stdin, true, true, **opt)
104-
desc = FailDesc[status, message, stderr]
104+
desc = failed[status, message, stderr] if failed
105+
desc ||= FailDesc[status, message, stderr]
105106
if block_given?
106107
raise "test_stdout ignored, use block only or without block" if test_stdout != []
107108
raise "test_stderr ignored, use block only or without block" if test_stderr != []

0 commit comments

Comments
 (0)