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:
parent
96064d1889
commit
5cb9711323
3 changed files with 49 additions and 0 deletions
|
@ -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>
|
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
|
* win32/setup.mak (BASERUBY): quit with an error when BASERUBY was not
|
||||||
|
|
|
@ -13,6 +13,42 @@ class TestMkmf < Test::Unit::TestCase
|
||||||
class << MKMFLOG
|
class << MKMFLOG
|
||||||
alias to_s call
|
alias to_s call
|
||||||
end
|
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)
|
def mkmflog(msg)
|
||||||
log = proc {MKMFLOG[] << msg}
|
log = proc {MKMFLOG[] << msg}
|
||||||
class << log
|
class << log
|
||||||
|
@ -25,6 +61,7 @@ class TestMkmf < Test::Unit::TestCase
|
||||||
@tmpdir = Dir.mktmpdir
|
@tmpdir = Dir.mktmpdir
|
||||||
@curdir = Dir.pwd
|
@curdir = Dir.pwd
|
||||||
@mkmfobj = Object.new
|
@mkmfobj = Object.new
|
||||||
|
@stdout = Capture.new
|
||||||
Dir.chdir(@tmpdir)
|
Dir.chdir(@tmpdir)
|
||||||
@quiet, Logging.quiet = Logging.quiet, true
|
@quiet, Logging.quiet = Logging.quiet, true
|
||||||
end
|
end
|
||||||
|
@ -37,7 +74,11 @@ class TestMkmf < Test::Unit::TestCase
|
||||||
end
|
end
|
||||||
|
|
||||||
def mkmf(*args, &block)
|
def mkmf(*args, &block)
|
||||||
|
@stdout.clear
|
||||||
|
stdout, $stdout = $stdout, @stdout
|
||||||
@mkmfobj.instance_eval(*args, &block)
|
@mkmfobj.instance_eval(*args, &block)
|
||||||
|
ensure
|
||||||
|
$stdout = stdout
|
||||||
end
|
end
|
||||||
|
|
||||||
def config_value(name)
|
def config_value(name)
|
||||||
|
|
|
@ -8,6 +8,7 @@ class TestMkmf
|
||||||
ENV["PATH"] = @tmpdir
|
ENV["PATH"] = @tmpdir
|
||||||
name = "foobar#{$$}#{rand(1000)}"
|
name = "foobar#{$$}#{rand(1000)}"
|
||||||
exts = mkmf {self.class::CONFIG['EXECUTABLE_EXTS']}.split
|
exts = mkmf {self.class::CONFIG['EXECUTABLE_EXTS']}.split
|
||||||
|
stdout.filter {|s| s.sub(name, "<executable>")}
|
||||||
exts[0] ||= ""
|
exts[0] ||= ""
|
||||||
exts.each do |ext|
|
exts.each do |ext|
|
||||||
full = name+ext
|
full = name+ext
|
||||||
|
|
Loading…
Reference in a new issue