From 91a254fd08eb7691387c6c253f85145ea0578163 Mon Sep 17 00:00:00 2001 From: nobu Date: Tue, 3 Jul 2012 21:19:52 +0000 Subject: bootstraptest: no stderr output * bootstraptest/runner.rb (assert_check): capture stderr and ensure nothing is output. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36293 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- bootstraptest/runner.rb | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'bootstraptest') diff --git a/bootstraptest/runner.rb b/bootstraptest/runner.rb index eef8a20d19..c885b7e98c 100755 --- a/bootstraptest/runner.rb +++ b/bootstraptest/runner.rb @@ -223,8 +223,9 @@ end def assert_check(testsrc, message = '', opt = '') show_progress(message) { - result = get_result_string(testsrc, opt) + result, errout = with_stderr {get_result_string(testsrc, opt)} check_coredump + error "stderr output is not empty\n", adjust_indent(errout) unless errout.empty? yield(result) } end @@ -396,6 +397,23 @@ def get_result_string(src, opt = '') end end +def with_stderr + out = err = nil + IO.pipe do |r, w| + stderr = $stderr.dup + $stderr.reopen(w) + w.close + reader = Thread.start {r.read} + begin + out = yield + ensure + $stderr.reopen(stderr) + err = reader.value + end + end + return out, err +end + def newtest @location = File.basename(caller(2).first) @count += 1 -- cgit v1.2.3