From a3fb97465df3a4b6a7f56a1a915c6239a2a303b9 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Fri, 7 Feb 2020 12:44:55 +0900 Subject: Stop auto runner Auto runner should not run in forked processes in separated tests. --- tool/lib/test/unit/core_assertions.rb | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/tool/lib/test/unit/core_assertions.rb b/tool/lib/test/unit/core_assertions.rb index 5b65eb9960..86ed37f078 100644 --- a/tool/lib/test/unit/core_assertions.rb +++ b/tool/lib/test/unit/core_assertions.rb @@ -104,6 +104,14 @@ module Test 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) unless file and line loc, = caller_locations(1,1) @@ -111,25 +119,19 @@ module Test line ||= loc.lineno end capture_stdout = true - if /mswin|mingw/ =~ RUBY_PLATFORM - res_out = "STDOUT" - else + unless /mswin|mingw/ =~ RUBY_PLATFORM capture_stdout = false opt[:out] = MiniTest::Unit.output res_p, res_c = IO.pipe opt[res_c.fileno] = res_c.fileno - res_out = "IO.new(#{res_c.fileno}, 'w')" end src = <