mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Stop auto runner
Auto runner should not run in forked processes in separated tests.
This commit is contained in:
parent
3d21a75c72
commit
a3fb97465d
1 changed files with 13 additions and 11 deletions
|
@ -104,6 +104,14 @@ module Test
|
||||||
|
|
||||||
ABORT_SIGNALS = Signal.list.values_at(*%w"ILL ABRT BUS SEGV TERM")
|
ABORT_SIGNALS = Signal.list.values_at(*%w"ILL ABRT BUS SEGV TERM")
|
||||||
|
|
||||||
|
def separated_runner(out = nil)
|
||||||
|
out = out ? IO.new(out, 'w') : STDOUT
|
||||||
|
at_exit {
|
||||||
|
out.puts [Marshal.dump($!)].pack('m'), "assertions=\#{self._assertions}"
|
||||||
|
}
|
||||||
|
Test::Unit::Runner.class_variable_set(:@@stop_auto_run, true)
|
||||||
|
end
|
||||||
|
|
||||||
def assert_separately(args, file = nil, line = nil, src, ignore_stderr: nil, **opt)
|
def assert_separately(args, file = nil, line = nil, src, ignore_stderr: nil, **opt)
|
||||||
unless file and line
|
unless file and line
|
||||||
loc, = caller_locations(1,1)
|
loc, = caller_locations(1,1)
|
||||||
|
@ -111,25 +119,19 @@ module Test
|
||||||
line ||= loc.lineno
|
line ||= loc.lineno
|
||||||
end
|
end
|
||||||
capture_stdout = true
|
capture_stdout = true
|
||||||
if /mswin|mingw/ =~ RUBY_PLATFORM
|
unless /mswin|mingw/ =~ RUBY_PLATFORM
|
||||||
res_out = "STDOUT"
|
|
||||||
else
|
|
||||||
capture_stdout = false
|
capture_stdout = false
|
||||||
opt[:out] = MiniTest::Unit.output
|
opt[:out] = MiniTest::Unit.output
|
||||||
res_p, res_c = IO.pipe
|
res_p, res_c = IO.pipe
|
||||||
opt[res_c.fileno] = res_c.fileno
|
opt[res_c.fileno] = res_c.fileno
|
||||||
res_out = "IO.new(#{res_c.fileno}, 'w')"
|
|
||||||
end
|
end
|
||||||
src = <<eom
|
src = <<eom
|
||||||
# -*- coding: #{line += __LINE__; src.encoding}; -*-
|
# -*- coding: #{line += __LINE__; src.encoding}; -*-
|
||||||
require "test/unit";out=#{res_out};include Test::Unit::Assertions;require #{(__dir__ + "/core_assertions").dump};include Test::Unit::CoreAssertions
|
BEGIN {
|
||||||
END {
|
require "test/unit";include Test::Unit::Assertions;require #{(__dir__ + "/core_assertions").dump};include Test::Unit::CoreAssertions
|
||||||
out.puts [Marshal.dump($!)].pack('m'), "assertions=\#{self._assertions}"
|
separated_runner #{res_c&.fileno}
|
||||||
}
|
}
|
||||||
#{line -= __LINE__; src}
|
#{line -= __LINE__; src}
|
||||||
class Test::Unit::Runner
|
|
||||||
@@stop_auto_run = true
|
|
||||||
end
|
|
||||||
eom
|
eom
|
||||||
args = args.dup
|
args = args.dup
|
||||||
args.insert((Hash === args.first ? 1 : 0), "-w", "--disable=gems", *$:.map {|l| "-I#{l}"})
|
args.insert((Hash === args.first ? 1 : 0), "-w", "--disable=gems", *$:.map {|l| "-I#{l}"})
|
||||||
|
|
Loading…
Reference in a new issue