summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-07-03 21:19:52 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-07-03 21:19:52 +0000
commit91a254fd08eb7691387c6c253f85145ea0578163 (patch)
tree4186d9a25339257ff4f68ed4ec27379e33a44237
parent1e972da39c58162672b4f0f2811145468303af0f (diff)
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
-rwxr-xr-xbootstraptest/runner.rb20
1 files changed, 19 insertions, 1 deletions
diff --git a/bootstraptest/runner.rb b/bootstraptest/runner.rb
index eef8a20..c885b7e 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