Method: Test::Unit::Worker#run
- Defined in:
- lib/test/unit/parallel.rb
#run(args = []) ⇒ Object
:nodoc:
84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 |
# 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.} (#{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 |