зеркало из https://github.com/github/ruby.git
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
This commit is contained in:
Родитель
1e972da39c
Коммит
91a254fd08
|
@ -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
|
||||
|
|
Загрузка…
Ссылка в новой задаче