2015-12-16 00:07:31 -05:00
|
|
|
# frozen_string_literal: false
|
2014-12-25 20:57:32 -05:00
|
|
|
require "envutil"
|
2015-03-07 22:08:37 -05:00
|
|
|
require "shellwords"
|
2014-12-25 20:57:32 -05:00
|
|
|
|
2014-12-25 10:15:18 -05:00
|
|
|
class TestExtLibs < Test::Unit::TestCase
|
2014-12-28 09:04:26 -05:00
|
|
|
@extdir = $".grep(/\/rbconfig\.rb\z/) {break "#$`/ext"}
|
|
|
|
|
2014-12-25 18:20:52 -05:00
|
|
|
def self.check_existence(ext, add_msg = nil)
|
2015-03-07 22:08:37 -05:00
|
|
|
return if @excluded.any? {|i| File.fnmatch?(i, ext, File::FNM_CASEFOLD)}
|
2014-12-25 10:15:18 -05:00
|
|
|
add_msg = ". #{add_msg}" if add_msg
|
2014-12-28 09:04:26 -05:00
|
|
|
log = "#{@extdir}/#{ext}/mkmf.log"
|
2014-12-25 20:57:32 -05:00
|
|
|
define_method("test_existence_of_#{ext}") do
|
|
|
|
assert_separately([], <<-"end;", ignore_stderr: true) # do
|
2014-12-28 09:04:26 -05:00
|
|
|
log = #{log.dump}
|
|
|
|
msg = proc {
|
|
|
|
"extension library `#{ext}' is not found#{add_msg}\n" <<
|
2015-06-12 09:22:55 -04:00
|
|
|
(File.exist?(log) ? File.binread(log) : "\#{log} not found")
|
2014-12-28 09:04:26 -05:00
|
|
|
}
|
|
|
|
assert_nothing_raised(msg) do
|
2014-12-25 20:57:32 -05:00
|
|
|
require "#{ext}"
|
|
|
|
end
|
|
|
|
end;
|
2014-12-25 10:15:18 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def windows?
|
|
|
|
/mswin|mingw/ =~ RUBY_PLATFORM
|
|
|
|
end
|
|
|
|
|
2015-03-07 22:08:37 -05:00
|
|
|
excluded = [RbConfig::CONFIG, ENV].map do |conf|
|
|
|
|
if args = conf['configure_args']
|
|
|
|
args.shellsplit.grep(/\A--without-ext=/) {$'.split(/,/)}
|
|
|
|
end
|
|
|
|
end.flatten.compact
|
|
|
|
excluded << '+' if excluded.empty?
|
|
|
|
if windows?
|
|
|
|
excluded.map! {|i| i == '+' ? ['pty', 'syslog'] : i}
|
|
|
|
excluded.flatten!
|
|
|
|
else
|
|
|
|
excluded.map! {|i| i == '+' ? '*win32*' : i}
|
|
|
|
end
|
|
|
|
@excluded = excluded
|
|
|
|
|
2014-12-25 18:20:52 -05:00
|
|
|
check_existence "bigdecimal"
|
|
|
|
check_existence "continuation"
|
|
|
|
check_existence "coverage"
|
|
|
|
check_existence "date"
|
|
|
|
#check_existence "dbm" # depend on libdbm
|
|
|
|
check_existence "digest"
|
|
|
|
check_existence "digest/bubblebabble"
|
|
|
|
check_existence "digest/md5"
|
|
|
|
check_existence "digest/rmd160"
|
|
|
|
check_existence "digest/sha1"
|
|
|
|
check_existence "digest/sha2"
|
|
|
|
check_existence "etc"
|
|
|
|
check_existence "fcntl"
|
|
|
|
check_existence "fiber"
|
2017-05-16 19:59:01 -04:00
|
|
|
check_existence "fiddle"
|
2014-12-25 18:20:52 -05:00
|
|
|
#check_existence "gdbm" # depend on libgdbm
|
|
|
|
check_existence "io/console"
|
|
|
|
check_existence "io/nonblock"
|
|
|
|
check_existence "io/wait"
|
2015-04-12 04:36:37 -04:00
|
|
|
check_existence "json"
|
2014-12-25 18:20:52 -05:00
|
|
|
check_existence "nkf"
|
|
|
|
check_existence "objspace"
|
|
|
|
check_existence "openssl", "this may be false positive, but should assert because rubygems requires this"
|
|
|
|
check_existence "pathname"
|
|
|
|
check_existence "psych"
|
2015-03-07 22:08:37 -05:00
|
|
|
check_existence "pty"
|
2014-12-25 18:20:52 -05:00
|
|
|
check_existence "racc/cparse"
|
|
|
|
check_existence "rbconfig/sizeof"
|
|
|
|
#check_existence "readline" # depend on libreadline
|
|
|
|
check_existence "ripper"
|
|
|
|
check_existence "socket"
|
|
|
|
check_existence "stringio"
|
|
|
|
check_existence "strscan"
|
2015-03-07 22:08:37 -05:00
|
|
|
check_existence "syslog"
|
2014-12-25 18:20:52 -05:00
|
|
|
check_existence "thread"
|
2015-03-07 22:08:37 -05:00
|
|
|
check_existence "Win32API"
|
|
|
|
check_existence "win32ole"
|
2014-12-25 18:20:52 -05:00
|
|
|
check_existence "zlib", "this may be false positive, but should assert because rubygems requires this"
|
2014-12-25 10:15:18 -05:00
|
|
|
end
|