mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
lib/test/unit/parallel.rb: new method to report to the parent
* lib/test/unit/parallel.rb (Test::Unit::Worker#_report): extract method to report to the parent process git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36137 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
ab9560c953
commit
bdfd26b795
1 changed files with 15 additions and 10 deletions
|
@ -35,7 +35,7 @@ module Test
|
|||
th = Thread.new do
|
||||
begin
|
||||
while buf = (self.verbose ? i.gets : i.read(5))
|
||||
@stdout.puts "p #{[buf].pack("m0")}"
|
||||
_report "p", buf
|
||||
end
|
||||
rescue IOError
|
||||
rescue Errno::EPIPE
|
||||
|
@ -70,7 +70,7 @@ module Test
|
|||
result << suite.name
|
||||
|
||||
begin
|
||||
@stdout.puts "done #{[Marshal.dump(result)].pack("m0")}"
|
||||
_report "done", Marshal.dump(result)
|
||||
rescue Errno::EPIPE; end
|
||||
return result
|
||||
ensure
|
||||
|
@ -98,14 +98,14 @@ module Test
|
|||
exit 2 unless @stdout && @stdin
|
||||
|
||||
@stdout.sync = true
|
||||
@stdout.puts "ready!"
|
||||
_report "ready!"
|
||||
while buf = @stdin.gets
|
||||
case buf.chomp
|
||||
when /^loadpath (.+?)$/
|
||||
@old_loadpath = $:.dup
|
||||
$:.push(*Marshal.load($1.unpack("m")[0].force_encoding("ASCII-8BIT"))).uniq!
|
||||
when /^run (.+?) (.+?)$/
|
||||
@stdout.puts "okay"
|
||||
_report "okay"
|
||||
|
||||
@options = @opts.dup
|
||||
suites = MiniTest::Unit::TestCase.test_suites
|
||||
|
@ -113,23 +113,23 @@ module Test
|
|||
begin
|
||||
require $1
|
||||
rescue LoadError
|
||||
@stdout.puts "after #{[Marshal.dump([$1, $!])].pack("m0")}"
|
||||
@stdout.puts "ready"
|
||||
_report "after", Marshal.dump([$1, $!])
|
||||
_report "ready"
|
||||
next
|
||||
end
|
||||
_run_suites MiniTest::Unit::TestCase.test_suites-suites, $2.to_sym
|
||||
|
||||
if @need_exit
|
||||
begin
|
||||
@stdout.puts "bye"
|
||||
_report "bye"
|
||||
rescue Errno::EPIPE; end
|
||||
exit
|
||||
else
|
||||
@stdout.puts "ready"
|
||||
_report "ready"
|
||||
end
|
||||
when /^quit$/
|
||||
begin
|
||||
@stdout.puts "bye"
|
||||
_report "bye"
|
||||
rescue Errno::EPIPE; end
|
||||
exit
|
||||
end
|
||||
|
@ -137,7 +137,7 @@ module Test
|
|||
rescue Errno::EPIPE
|
||||
rescue Exception => e
|
||||
begin
|
||||
@stdout.puts "bye #{[Marshal.dump(e)].pack("m0")}" if @stdout
|
||||
_report "bye", Marshal.dump(e)
|
||||
rescue Errno::EPIPE;end
|
||||
exit
|
||||
ensure
|
||||
|
@ -146,6 +146,11 @@ module Test
|
|||
end
|
||||
end
|
||||
|
||||
def _report(res, *args)
|
||||
res = "#{res} #{args.pack("m0")}" unless args.empty?
|
||||
@stdout.puts(res)
|
||||
end
|
||||
|
||||
def puke(klass, meth, e)
|
||||
@partial_report << [klass.name, meth, e]
|
||||
super
|
||||
|
|
Loading…
Reference in a new issue