提交 bbbc634e 编写于 作者: M Matthew Draper

Split railties suite in half

上级 56202d8d
...@@ -41,7 +41,8 @@ env: ...@@ -41,7 +41,8 @@ env:
global: global:
- "JRUBY_OPTS='--dev -J-Xmx1024M'" - "JRUBY_OPTS='--dev -J-Xmx1024M'"
matrix: matrix:
- "GEM=railties" - "GEM=railties:1"
- "GEM=railties:2"
- "GEM=ap,ac" - "GEM=ap,ac"
- "GEM=am,amo,as,av,aj,ast" - "GEM=am,amo,as,av,aj,ast"
- "GEM=as PRESERVE_TIMEZONES=1" - "GEM=as PRESERVE_TIMEZONES=1"
......
...@@ -78,10 +78,15 @@ def tasks ...@@ -78,10 +78,15 @@ def tasks
end end
tasks tasks
else else
["test", ("isolated" if isolated?), ("integration" if integration?), ("ujs" if ujs?)].compact.join(":") ["test", ("isolated" if isolated?), ("integration" if integration?), ("ujs" if ujs?), subset].compact.join(":")
end end
end end
def subset
n = component.split(":").last
n if n =~ /\A\d+\z/
end
def key def key
key = [gem] key = [gem]
key << adapter if activerecord? key << adapter if activerecord?
...@@ -166,7 +171,7 @@ def run_bug_report_templates ...@@ -166,7 +171,7 @@ def run_bug_report_templates
next if gem == "av:ujs" && isolated next if gem == "av:ujs" && isolated
next if gem == "guides" && isolated next if gem == "guides" && isolated
next if gem =~ /:integration/ && isolated next if gem =~ /:integration/ && isolated
next if gem == "railties" && isolated next if gem =~ /railties:/ && isolated
build = Build.new(gem, isolated: isolated) build = Build.new(gem, isolated: isolated)
failures << build.key unless build.run! failures << build.key unless build.run!
......
...@@ -9,8 +9,7 @@ task :package ...@@ -9,8 +9,7 @@ task :package
desc "Run all unit tests" desc "Run all unit tests"
task test: "test:isolated" task test: "test:isolated"
namespace :test do run_isolated_tests = lambda do |files|
task :isolated do
dash_i = [ dash_i = [
"test", "test",
"lib", "lib",
...@@ -28,11 +27,7 @@ namespace :test do ...@@ -28,11 +27,7 @@ namespace :test do
require "bundler/setup" unless defined?(Bundler) require "bundler/setup" unless defined?(Bundler)
require "active_support" require "active_support"
failing_files = [] failing_files = files.reject do |file|
dirs = (ENV["TEST_DIR"] || ENV["TEST_DIRS"] || "**").split(",")
test_files = dirs.map { |dir| "test/#{dir}/*_test.rb" }
Dir[*test_files].each do |file|
next true if file.start_with?("test/fixtures/") next true if file.start_with?("test/fixtures/")
fake_command = Shellwords.join([ fake_command = Shellwords.join([
...@@ -52,9 +47,7 @@ namespace :test do ...@@ -52,9 +47,7 @@ namespace :test do
load file load file
} }
unless $?.success? $?.success?
failing_files << file
end
end end
unless failing_files.empty? unless failing_files.empty?
...@@ -67,6 +60,30 @@ namespace :test do ...@@ -67,6 +60,30 @@ namespace :test do
raise "Failure in isolated test runner" raise "Failure in isolated test runner"
end end
end
_test_files = nil
test_files = lambda do
_test_files ||= Dir[*
(ENV["TEST_DIR"] || ENV["TEST_DIRS"] || "**").
split(",").
map { |dir| "test/#{dir}/*_test.rb" }
]
end
split_filter = lambda { |file| file =~ /test\/application\// }
namespace :test do
task "1" do
run_isolated_tests.call test_files.call.select(&split_filter)
end
task "2" do
run_isolated_tests.call test_files.call.reject(&split_filter)
end
task :isolated do
run_isolated_tests.call test_files.call
end end
end end
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册