diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-06-19 09:22:01 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-06-19 09:22:01 +0000 |
commit | bdfd26b79506179a09a9cfa50eeba03741dc0d84 (patch) | |
tree | 06c9cff65705f2cc5a290680467215e6190b544f /lib/test/unit | |
parent | ab9560c953c90ede19b9f2f310502d91ff88571b (diff) | |
download | ruby-bdfd26b79506179a09a9cfa50eeba03741dc0d84.tar.gz |
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
Diffstat (limited to 'lib/test/unit')
-rw-r--r-- | lib/test/unit/parallel.rb | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/lib/test/unit/parallel.rb b/lib/test/unit/parallel.rb index 9e44b91187..b3f2eeae05 100644 --- a/lib/test/unit/parallel.rb +++ b/lib/test/unit/parallel.rb @@ -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 |