1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* test/mkmf/base.rb (TestMkmf::FakeLog): capture output from mkmf.

* test/mkmf/test_find_executable.rb (test_find_executable):
  suppress meaningless diffrences for chkbuild.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30239 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2010-12-17 10:35:20 +00:00
parent 96064d1889
commit 5cb9711323
3 changed files with 49 additions and 0 deletions

View file

@ -1,3 +1,10 @@
Fri Dec 17 19:35:13 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
* test/mkmf/base.rb (TestMkmf::FakeLog): capture output from mkmf.
* test/mkmf/test_find_executable.rb (test_find_executable):
suppress meaningless diffrences for chkbuild.
Fri Dec 17 13:26:54 2010 NAKAMURA Usaku <usa@ruby-lang.org>
* win32/setup.mak (BASERUBY): quit with an error when BASERUBY was not

View file

@ -13,6 +13,42 @@ class TestMkmf < Test::Unit::TestCase
class << MKMFLOG
alias to_s call
end
class Capture
def initialize
@buffer = ""
@filter = nil
@out = true
end
def clear
@buffer.clear
end
def flush
STDOUT.print @filter ? @filter.call(@buffer) : @buffer
clear
end
def reopen(io)
case io
when Capture
initialize_copy(io)
when File
@out = false
when IO
@out = true
else
@out = false
end
end
def filter(&block)
@filter = block
end
def write(s)
@buffer << s if @out
end
end
attr_reader :stdout
def mkmflog(msg)
log = proc {MKMFLOG[] << msg}
class << log
@ -25,6 +61,7 @@ class TestMkmf < Test::Unit::TestCase
@tmpdir = Dir.mktmpdir
@curdir = Dir.pwd
@mkmfobj = Object.new
@stdout = Capture.new
Dir.chdir(@tmpdir)
@quiet, Logging.quiet = Logging.quiet, true
end
@ -37,7 +74,11 @@ class TestMkmf < Test::Unit::TestCase
end
def mkmf(*args, &block)
@stdout.clear
stdout, $stdout = $stdout, @stdout
@mkmfobj.instance_eval(*args, &block)
ensure
$stdout = stdout
end
def config_value(name)

View file

@ -8,6 +8,7 @@ class TestMkmf
ENV["PATH"] = @tmpdir
name = "foobar#{$$}#{rand(1000)}"
exts = mkmf {self.class::CONFIG['EXECUTABLE_EXTS']}.split
stdout.filter {|s| s.sub(name, "<executable>")}
exts[0] ||= ""
exts.each do |ext|
full = name+ext