1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

tool/lib/test/unit/parallel.rb: fail explicitly when failing to get io

`(ulimit -n 30; make test-tool)` fails with unexplicit message:
"undefined method `write' for nil:NilClass" due to lack of stdout.

This change makes it explicit.  [Bug #5577]
This commit is contained in:
Yusuke Endoh 2019-12-03 17:05:07 +09:00
parent e42d9d8df8
commit 409e4ab740
2 changed files with 8 additions and 2 deletions

View file

@ -145,9 +145,13 @@ module Test
rescue Exception => e
begin
trace = e.backtrace || ['unknown method']
err = ["#{trace.shift}: #{e.message} (#{e.class})"] + trace.map{|t| t.prepend("\t") }
err = ["#{trace.shift}: #{e.message} (#{e.class})"] + trace.map{|t| "\t" + t }
_report "bye", Marshal.dump(err.join("\n"))
if @stdout
_report "bye", Marshal.dump(err.join("\n"))
else
raise "failed to report a failure due to lack of @stdout"
end
rescue Errno::EPIPE;end
exit
ensure

View file

@ -98,6 +98,7 @@ module TestParallel
while buf = @worker_out.gets
break if /^p (.+?)$/ =~ buf
end
assert_not_nil($1, "'p' was not found")
assert_match(/TestA#test_nothing_test = \d+\.\d+ s = \.\n/, $1.chomp.unpack("m")[0])
end
end
@ -108,6 +109,7 @@ module TestParallel
while buf = @worker_out.gets
break if /^done (.+?)$/ =~ buf
end
assert_not_nil($1, "'done' was not found")
result = Marshal.load($1.chomp.unpack("m")[0])
assert_equal(5, result[0])