method
run
v2_1_10 -
Show latest stable
- Class:
Test::Unit::Worker
run(args = [])public
No documentation available.
# File lib/test/unit/parallel.rb, line 84
def run(args = []) # :nodoc:
process_args args
@@stop_auto_run = true
@opts = @options.dup
@need_exit = false
@old_loadpath = []
begin
begin
@stdout = increment_io(STDOUT)
@stdin = increment_io(STDIN)
rescue
exit 2
end
exit 2 unless @stdout && @stdin
@stdout.sync = true
_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 (.+?) (.+?)$/
_report "okay"
@options = @opts.dup
suites = MiniTest::Unit::TestCase.test_suites
begin
require $1
rescue LoadError
_report "after", Marshal.dump([$1, ProxyError.new($!)])
_report "ready"
next
end
_run_suites MiniTest::Unit::TestCase.test_suites-suites, $2.to_sym
if @need_exit
begin
_report "bye"
rescue Errno::EPIPE; end
exit
else
_report "ready"
end
when /^quit$/
begin
_report "bye"
rescue Errno::EPIPE; end
exit
end
end
rescue Errno::EPIPE
rescue Exception => e
begin
trace = e.backtrace
err = ["#{trace.shift}: #{e.message} (#{e.class})"] + trace.map{|t| t.prepend("\t") }
_report "bye", Marshal.dump(err.join("\n"))
rescue Errno::EPIPE;end
exit
ensure
@stdin.close if @stdin
@stdout.close if @stdout
end
end