1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132
|
# Default RubySpec/CI settings for JRuby.
require 'rbconfig'
require 'java'
require 'jruby'
# Inherit from the default configuration
load "#{__dir__}/ruby/default.mspec"
# Some non-deterministic specs assume a GC will actually fire. For spec
# runs we change our noop version of GC.start to requesting we actually
# perform a GC on the JVM.
module GC
def start(full_mark: true, immediate_sweep: true)
java.lang.System.gc
end
module_function :start
end
IKVM = java.lang.System.get_property('java.vm.name') =~ /IKVM\.NET/
HOST_OS = RbConfig::CONFIG['host_os']
HOST_CPU = RbConfig::CONFIG['host_cpu']
WINDOWS = HOST_OS =~ /mswin/
SPEC_DIR = File.join(File.dirname(__FILE__), 'ruby') unless defined?(SPEC_DIR)
TAGS_DIR = File.join(File.dirname(__FILE__), 'tags') unless defined?(TAGS_DIR)
class MSpecScript
set :prefix, 'spec/ruby'
# enable MRI-like backtraces for specs that expect that output
set :flags, ['-Xbacktrace.style=mri']
jruby = RbConfig::CONFIG['ruby_install_name'] + RbConfig::CONFIG['EXEEXT']
jruby = File.expand_path("../../bin/#{jruby}", __FILE__)
set :target, jruby
slow_specs = [
SPEC_DIR + '/core/process',
SPEC_DIR + '/core/io/popen',
SPEC_DIR + '/core/argf/gets_spec.rb',
SPEC_DIR + '/core/argf/read_spec.rb',
SPEC_DIR + '/core/argf/readline_spec.rb',
SPEC_DIR + '/core/encoding/default_external_spec.rb',
SPEC_DIR + '/core/encoding/default_internal_spec.rb',
SPEC_DIR + '/core/io/pid_spec.rb',
SPEC_DIR + '/core/kernel/at_exit_spec.rb',
SPEC_DIR + '/language/predefined_spec.rb',
SPEC_DIR + '/language/predefined/data_spec.rb',
SPEC_DIR + '/library/net/http',
*get(:command_line),
*get(:security),
]
# Specs that require JRuby's --debug flag, which alters some behaviors
debug_specs = [
SPEC_DIR + '/core/tracepoint'
]
set :fast, [
*get(:language),
*get(:core),
*get(:library),
# These all spawn sub-rubies, making them very slow to run
*slow_specs.map {|name| '^' + name},
*debug_specs.map {|name| '^' + name},
]
set :slow, slow_specs
set :debug, debug_specs
# Filter out ObjectSpace specs if ObjectSpace is disabled
unless JRuby.objectspace
get(:core) << '^' + SPEC_DIR + '/core/objectspace/_id2ref'
get(:core) << '^' + SPEC_DIR + '/core/objectspace/each_object'
end
if IKVM
# ftype_spec freezes for some reason under IKVM
get(:core) << '^' + SPEC_DIR + '/core/file'
# Process.kill spec hangs
get(:core) << '^' + SPEC_DIR + '/core/process'
end
# prepare exclusion tags
set(:xtags, get(:xtags) || [])
set(:ci_xtags, get(:ci_xtags) || [])
get(:xtags) << 'critical'
get(:ci_xtags) << 'critical'
get(:xtags) << 'hangs'
get(:ci_xtags) << 'hangs'
get(:ci_xtags) << "java#{ENV_JAVA['java.specification.version']}" # Java version
unless $stdin.tty?
get(:ci_xtags) << "tty" # Specs that require a tty and may fail in CI environments
end
get(:ci_xtags) << HOST_OS
get(:ci_xtags) << "#{HOST_OS}-#{HOST_CPU}"
instance_config = JRuby.runtime.instance_config
if WINDOWS
# Some specs on Windows will fail in we launch JRuby via
# ruby_exe() in-process (see core/argf/gets_spec.rb)
instance_config.run_ruby_in_process = false
# exclude specs tagged with 'windows' keyword
get(:ci_xtags) << 'windows'
end
# If running specs with jit threshold = 0 or force (AOT) compile, additional tags
if instance_config.compile_mode.to_s == "FORCE" ||
instance_config.jit_threshold == 0
get(:ci_xtags) << 'jit'
end
# This set of files is run by mspec ci
set :ci_files, get(:language) + get(:core) + get(:command_line) + get(:library) + get(:security)
set :tags_patterns, [
[%r(^.*/language/), TAGS_DIR + '/ruby/language/'],
[%r(^.*/core/), TAGS_DIR + '/ruby/core/'],
[%r(^.*/command_line/), TAGS_DIR + '/ruby/command_line/'],
[%r(^.*/library/), TAGS_DIR + '/ruby/library/'],
[%r(^.*/security/), TAGS_DIR + '/ruby/security/'],
[/_spec.rb$/, '_tags.txt']
]
end
|