From a26d663b70af61824bbb722d22d13d068e19cccd Mon Sep 17 00:00:00 2001 From: naruse Date: Tue, 2 Apr 2013 06:28:15 +0000 Subject: * test/ruby/envutil.rb (assert_separately): stop_auto_run of Test::Unit::Runner to prevent auto runner use ARGV. * test/ruby/envutil.rb (assert_separately): add $: to separate process. * test/ruby/envutil.rb (assert_separately): fail if stderr is not empty and ignore_stderr is false. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40059 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/envutil.rb | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) (limited to 'test/ruby/envutil.rb') diff --git a/test/ruby/envutil.rb b/test/ruby/envutil.rb index c7ffc41598..0ae5119ff6 100644 --- a/test/ruby/envutil.rb +++ b/test/ruby/envutil.rb @@ -287,17 +287,31 @@ module Test ensure puts [Marshal.dump($!)].pack('m'), "assertions=\#{self._assertions}" end + class Test::Unit::Runner + @@stop_auto_run = true + end eom + args = args.dup + $:.each{|l| args.unshift "-I#{l}" } + ignore_stderr = opt.delete(:ignore_stderr) stdout, stderr, status = EnvUtil.invoke_ruby(args, src, true, true, opt) abort = status.coredump? || (status.signaled? && ABORT_SIGNALS.include?(status.termsig)) assert(!abort, FailDesc[status, stderr]) self._assertions += stdout[/^assertions=(\d+)/, 1].to_i res = Marshal.load(stdout.unpack("m")[0]) - return unless res - res.backtrace.each do |l| - l.sub!(/\A-:(\d+)/){"#{file}:#{line + $1.to_i}"} + if res + res.backtrace.each do |l| + l.sub!(/\A-:(\d+)/){"#{file}:#{line + $1.to_i}"} + end + raise res + end + + # really is it succeed? + unless ignore_stderr + # the body of assert_separately must not output anything to detect errror + assert_equal("", stderr, "assert_separately failed with error message") end - raise res + assert_equal(0, status, "assert_separately failed: '#{stderr}'") end def assert_warning(pat, msg = nil) -- cgit v1.2.3