2015-12-16 08:07:31 +03:00
|
|
|
# frozen_string_literal: false
|
2014-12-26 04:57:32 +03:00
|
|
|
require "envutil"
|
2015-03-08 06:08:37 +03:00
|
|
|
require "shellwords"
|
2014-12-26 04:57:32 +03:00
|
|
|
|
2014-12-25 18:15:18 +03:00
|
|
|
class TestExtLibs < Test::Unit::TestCase
|
2014-12-28 17:04:26 +03:00
|
|
|
@extdir = $".grep(/\/rbconfig\.rb\z/) {break "#$`/ext"}
|
|
|
|
|
2014-12-26 02:20:52 +03:00
|
|
|
def self.check_existence(ext, add_msg = nil)
|
2015-03-08 06:08:37 +03:00
|
|
|
return if @excluded.any? {|i| File.fnmatch?(i, ext, File::FNM_CASEFOLD)}
|
2014-12-25 18:15:18 +03:00
|
|
|
add_msg = ". #{add_msg}" if add_msg
|
2014-12-28 17:04:26 +03:00
|
|
|
log = "#{@extdir}/#{ext}/mkmf.log"
|
2014-12-26 04:57:32 +03:00
|
|
|
define_method("test_existence_of_#{ext}") do
|
|
|
|
assert_separately([], <<-"end;", ignore_stderr: true) # do
|
2014-12-28 17:04:26 +03:00
|
|
|
log = #{log.dump}
|
|
|
|
msg = proc {
|
|
|
|
"extension library `#{ext}' is not found#{add_msg}\n" <<
|
2015-06-12 16:22:55 +03:00
|
|
|
(File.exist?(log) ? File.binread(log) : "\#{log} not found")
|
2014-12-28 17:04:26 +03:00
|
|
|
}
|
|
|
|
assert_nothing_raised(msg) do
|
2014-12-26 04:57:32 +03:00
|
|
|
require "#{ext}"
|
|
|
|
end
|
|
|
|
end;
|
2014-12-25 18:15:18 +03:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def windows?
|
|
|
|
/mswin|mingw/ =~ RUBY_PLATFORM
|
|
|
|
end
|
|
|
|
|
2015-03-08 06:08:37 +03: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-26 02:20:52 +03: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-17 02:59:01 +03:00
|
|
|
check_existence "fiddle"
|
2014-12-26 02:20:52 +03:00
|
|
|
#check_existence "gdbm" # depend on libgdbm
|
|
|
|
check_existence "io/console"
|
|
|
|
check_existence "io/nonblock"
|
|
|
|
check_existence "io/wait"
|
2015-04-12 11:36:37 +03:00
|
|
|
check_existence "json"
|
2014-12-26 02:20:52 +03: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-08 06:08:37 +03:00
|
|
|
check_existence "pty"
|
2014-12-26 02:20:52 +03:00
|
|
|
check_existence "racc/cparse"
|
|
|
|
check_existence "rbconfig/sizeof"
|
|
|
|
#check_existence "readline" # depend on libreadline
|
|
|
|
check_existence "ripper"
|
|
|
|
check_existence "sdbm"
|
|
|
|
check_existence "socket"
|
|
|
|
check_existence "stringio"
|
|
|
|
check_existence "strscan"
|
2015-03-08 06:08:37 +03:00
|
|
|
check_existence "syslog"
|
2014-12-26 02:20:52 +03:00
|
|
|
check_existence "thread"
|
2015-03-08 06:08:37 +03:00
|
|
|
check_existence "Win32API"
|
|
|
|
check_existence "win32ole"
|
2014-12-26 02:20:52 +03:00
|
|
|
check_existence "zlib", "this may be false positive, but should assert because rubygems requires this"
|
2014-12-25 18:15:18 +03:00
|
|
|
end
|