summaryrefslogtreecommitdiff
path: root/test/ruby
diff options
context:
space:
mode:
Diffstat (limited to 'test/ruby')
-rw-r--r--test/ruby/envutil.rb22
-rw-r--r--test/ruby/test_require.rb2
2 files changed, 19 insertions, 5 deletions
diff --git a/test/ruby/envutil.rb b/test/ruby/envutil.rb
index 0aa97e4341..cceadb9495 100644
--- a/test/ruby/envutil.rb
+++ b/test/ruby/envutil.rb
@@ -286,17 +286,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, message = nil)
diff --git a/test/ruby/test_require.rb b/test/ruby/test_require.rb
index ff5a519638..c03876d223 100644
--- a/test/ruby/test_require.rb
+++ b/test/ruby/test_require.rb
@@ -423,7 +423,7 @@ class TestRequire < Test::Unit::TestCase
# in C-level. And redirecting stderr to a pipe seems to change
# some blocking timings and causes a deadlock, so run in a
# separated process for the time being.
- assert_separately(["-w", "-", path, bug5754], <<-'end;')
+ assert_separately(["-w", "-", path, bug5754], <<-'end;', ignore_stderr: true)
path, bug5754 = *ARGV
start = false