* lib/test/unit.rb(Test::Unit::Options#process_args): Fix bug.
Fix process_args didn't return `@option` after r30939. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32526 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
7fd8266516
commit
1d4da24e21
@ -1,3 +1,8 @@
|
|||||||
|
Tue Jul 12 16:58:44 2011 Shota Fukumori <sorah@tubusu.net>
|
||||||
|
|
||||||
|
* lib/test/unit.rb(Test::Unit::Options#process_args): Fix bug.
|
||||||
|
Fix process_args didn't return `@option` after r30939.
|
||||||
|
|
||||||
Tue Jul 12 14:07:46 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
|
Tue Jul 12 14:07:46 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
|
||||||
|
|
||||||
* signal.c (install_sighandler): fixed a race.
|
* signal.c (install_sighandler): fixed a race.
|
||||||
|
@ -52,11 +52,11 @@ module Test
|
|||||||
non_options(args, options)
|
non_options(args, options)
|
||||||
@help = orig_args.map { |s| s =~ /[\s|&<>$()]/ ? s.inspect : s }.join " "
|
@help = orig_args.map { |s| s =~ /[\s|&<>$()]/ ? s.inspect : s }.join " "
|
||||||
@options = options
|
@options = options
|
||||||
@opts = @options = options
|
|
||||||
if @options[:parallel]
|
if @options[:parallel]
|
||||||
@files = args
|
@files = args
|
||||||
@args = orig_args
|
@args = orig_args
|
||||||
end
|
end
|
||||||
|
options
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
@ -319,12 +319,6 @@ module Test
|
|||||||
|
|
||||||
class << self; undef autorun; end
|
class << self; undef autorun; end
|
||||||
|
|
||||||
undef options
|
|
||||||
|
|
||||||
def options
|
|
||||||
@optss ||= (@options||{}).merge(@opts)
|
|
||||||
end
|
|
||||||
|
|
||||||
@@stop_auto_run = false
|
@@stop_auto_run = false
|
||||||
def self.autorun
|
def self.autorun
|
||||||
at_exit {
|
at_exit {
|
||||||
@ -336,7 +330,7 @@ module Test
|
|||||||
end
|
end
|
||||||
|
|
||||||
def after_worker_down(worker, e=nil, c=false)
|
def after_worker_down(worker, e=nil, c=false)
|
||||||
return unless @opts[:parallel]
|
return unless @options[:parallel]
|
||||||
return if @interrupt
|
return if @interrupt
|
||||||
if e
|
if e
|
||||||
b = e.backtrace
|
b = e.backtrace
|
||||||
@ -354,10 +348,10 @@ module Test
|
|||||||
end
|
end
|
||||||
|
|
||||||
def jobs_status
|
def jobs_status
|
||||||
return unless @opts[:job_status]
|
return unless @options[:job_status]
|
||||||
puts "" unless @opts[:verbose]
|
puts "" unless @options[:verbose]
|
||||||
status_line = @workers.map(&:to_s).join(" ")
|
status_line = @workers.map(&:to_s).join(" ")
|
||||||
if @opts[:job_status] == :replace and $stdout.tty?
|
if @options[:job_status] == :replace and $stdout.tty?
|
||||||
@terminal_width ||=
|
@terminal_width ||=
|
||||||
begin
|
begin
|
||||||
require 'io/console'
|
require 'io/console'
|
||||||
@ -377,12 +371,12 @@ module Test
|
|||||||
end
|
end
|
||||||
|
|
||||||
def del_jobs_status
|
def del_jobs_status
|
||||||
return unless @opts[:job_status] == :replace && @jstr_size.nonzero?
|
return unless @options[:job_status] == :replace && @jstr_size.nonzero?
|
||||||
print "\r"+" "*@jstr_size+"\r"
|
print "\r"+" "*@jstr_size+"\r"
|
||||||
end
|
end
|
||||||
|
|
||||||
def after_worker_quit(worker)
|
def after_worker_quit(worker)
|
||||||
return unless @opts[:parallel]
|
return unless @options[:parallel]
|
||||||
return if @interrupt
|
return if @interrupt
|
||||||
@workers.delete(worker)
|
@workers.delete(worker)
|
||||||
@dead_workers << worker
|
@dead_workers << worker
|
||||||
@ -390,7 +384,7 @@ module Test
|
|||||||
end
|
end
|
||||||
|
|
||||||
def _run_parallel suites, type, result
|
def _run_parallel suites, type, result
|
||||||
if @opts[:parallel] < 1
|
if @options[:parallel] < 1
|
||||||
warn "Error: parameter of -j option should be greater than 0."
|
warn "Error: parameter of -j option should be greater than 0."
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
@ -407,8 +401,8 @@ module Test
|
|||||||
rep = [] # FIXME: more good naming
|
rep = [] # FIXME: more good naming
|
||||||
|
|
||||||
# Array of workers.
|
# Array of workers.
|
||||||
@workers = @opts[:parallel].times.map {
|
@workers = @options[:parallel].times.map {
|
||||||
worker = Worker.launch(@opts[:ruby],@args)
|
worker = Worker.launch(@options[:ruby],@args)
|
||||||
worker.hook(:dead) do |w,info|
|
worker.hook(:dead) do |w,info|
|
||||||
after_worker_quit w
|
after_worker_quit w
|
||||||
after_worker_down w, *info unless info.empty?
|
after_worker_down w, *info unless info.empty?
|
||||||
@ -459,7 +453,7 @@ module Test
|
|||||||
when /^p (.+?)$/
|
when /^p (.+?)$/
|
||||||
del_jobs_status
|
del_jobs_status
|
||||||
print $1.unpack("m")[0]
|
print $1.unpack("m")[0]
|
||||||
jobs_status if @opts[:job_status] == :replace
|
jobs_status if @options[:job_status] == :replace
|
||||||
when /^after (.+?)$/
|
when /^after (.+?)$/
|
||||||
@warnings << Marshal.load($1.unpack("m")[0])
|
@warnings << Marshal.load($1.unpack("m")[0])
|
||||||
when /^bye (.+?)$/
|
when /^bye (.+?)$/
|
||||||
@ -521,7 +515,7 @@ module Test
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if @interrupt || @opts[:no_retry] || @need_quit
|
if @interrupt || @options[:no_retry] || @need_quit
|
||||||
rep.each do |r|
|
rep.each do |r|
|
||||||
report.push(*r[:report])
|
report.push(*r[:report])
|
||||||
end
|
end
|
||||||
@ -532,7 +526,6 @@ module Test
|
|||||||
puts ""
|
puts ""
|
||||||
puts "Retrying..."
|
puts "Retrying..."
|
||||||
puts ""
|
puts ""
|
||||||
@options = @opts
|
|
||||||
rep.each do |r|
|
rep.each do |r|
|
||||||
if r[:testcase] && r[:file] && !r[:report].empty?
|
if r[:testcase] && r[:file] && !r[:report].empty?
|
||||||
require r[:file]
|
require r[:file]
|
||||||
@ -564,7 +557,7 @@ module Test
|
|||||||
def _run_suites suites, type
|
def _run_suites suites, type
|
||||||
@interrupt = nil
|
@interrupt = nil
|
||||||
result = []
|
result = []
|
||||||
if @opts[:parallel]
|
if @options[:parallel]
|
||||||
_run_parallel suites, type, result
|
_run_parallel suites, type, result
|
||||||
else
|
else
|
||||||
suites.each {|suite|
|
suites.each {|suite|
|
||||||
@ -576,7 +569,7 @@ module Test
|
|||||||
end
|
end
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
report.reject!{|r| r.start_with? "Skipped:" } if @opts[:hide_skip]
|
report.reject!{|r| r.start_with? "Skipped:" } if @options[:hide_skip]
|
||||||
result
|
result
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user