Skip to content

Commit

Permalink
Unify test:isolated across components and run by default at toplevel
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremy committed Nov 11, 2009
1 parent e02bff2 commit bbb3e5a
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 33 deletions.
4 changes: 2 additions & 2 deletions Rakefile
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ Dir["#{File.dirname(__FILE__)}/*/lib/*/version.rb"].each do |version_path|
end end


desc 'Run all tests by default' desc 'Run all tests by default'
task :default => :test task :default => %w(test test:isolated)


%w(test isolated_test rdoc pgem package release gem gemspec).each do |task_name| %w(test test:isolated rdoc pgem package release gem gemspec).each do |task_name|
desc "Run #{task_name} task for all projects" desc "Run #{task_name} task for all projects"
task task_name do task task_name do
errors = [] errors = []
Expand Down
12 changes: 7 additions & 5 deletions actionmailer/Rakefile
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -27,11 +27,13 @@ Rake::TestTask.new { |t|
t.warning = true t.warning = true
} }


task :isolated_test do namespace :test do
ruby = File.join(*RbConfig::CONFIG.values_at('bindir', 'RUBY_INSTALL_NAME')) task :isolated do
Dir.glob("test/*_test.rb").all? do |file| ruby = File.join(*RbConfig::CONFIG.values_at('bindir', 'RUBY_INSTALL_NAME'))
system(ruby, '-Ilib:test', file) Dir.glob("test/*_test.rb").all? do |file|
end or raise "Failures" system(ruby, '-Ilib:test', file)
end or raise "Failures"
end
end end


# Generate the RDoc documentation # Generate the RDoc documentation
Expand Down
12 changes: 7 additions & 5 deletions activemodel/Rakefile
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -19,11 +19,13 @@ Rake::TestTask.new do |t|
t.warning = true t.warning = true
end end


task :isolated_test do namespace :test do
ruby = File.join(*RbConfig::CONFIG.values_at('bindir', 'RUBY_INSTALL_NAME')) task :isolated do
Dir.glob("#{dir}/test/**/*_test.rb").all? do |file| ruby = File.join(*RbConfig::CONFIG.values_at('bindir', 'RUBY_INSTALL_NAME'))
system(ruby, '-w', "-I#{dir}/lib", "-I#{dir}/test", file) Dir.glob("#{dir}/test/**/*_test.rb").all? do |file|
end or raise "Failures" system(ruby, '-w', "-I#{dir}/lib", "-I#{dir}/test", file)
end or raise "Failures"
end
end end




Expand Down
12 changes: 7 additions & 5 deletions activerecord/Rakefile
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -49,11 +49,13 @@ task :test do
run_without_aborting(*tasks) run_without_aborting(*tasks)
end end


task :isolated_test do namespace :test do
tasks = defined?(JRUBY_VERSION) ? task :isolated do
%w(isolated_test_jdbcmysql isolated_test_jdbcsqlite3 isolated_test_jdbcpostgresql) : tasks = defined?(JRUBY_VERSION) ?
%w(isolated_test_mysql isolated_test_sqlite3 isolated_test_postgresql) %w(isolated_test_jdbcmysql isolated_test_jdbcsqlite3 isolated_test_jdbcpostgresql) :
run_without_aborting(*tasks) %w(isolated_test_mysql isolated_test_sqlite3 isolated_test_postgresql)
run_without_aborting(*tasks)
end
end end


%w( mysql postgresql sqlite3 firebird db2 oracle sybase openbase frontbase jdbcmysql jdbcpostgresql jdbcsqlite3 jdbcderby jdbch2 jdbchsqldb ).each do |adapter| %w( mysql postgresql sqlite3 firebird db2 oracle sybase openbase frontbase jdbcmysql jdbcpostgresql jdbcsqlite3 jdbcderby jdbch2 jdbchsqldb ).each do |adapter|
Expand Down
15 changes: 8 additions & 7 deletions activeresource/Rakefile
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -35,15 +35,16 @@ Rake::TestTask.new { |t|
t.warning = true t.warning = true
} }


task :isolated_test do namespace :test do
ruby = File.join(*RbConfig::CONFIG.values_at('bindir', 'RUBY_INSTALL_NAME')) task :isolated do
activesupport_path = "#{File.dirname(__FILE__)}/../activesupport/lib" ruby = File.join(*RbConfig::CONFIG.values_at('bindir', 'RUBY_INSTALL_NAME'))
Dir.glob("test/**/*_test.rb").all? do |file| activesupport_path = "#{File.dirname(__FILE__)}/../activesupport/lib"
system(ruby, '-w', "-Ilib:test:#{activesupport_path}", file) Dir.glob("test/**/*_test.rb").all? do |file|
end or raise "Failures" system(ruby, '-w', "-Ilib:test:#{activesupport_path}", file)
end or raise "Failures"
end
end end



# Generate the RDoc documentation # Generate the RDoc documentation


Rake::RDocTask.new { |rdoc| Rake::RDocTask.new { |rdoc|
Expand Down
20 changes: 11 additions & 9 deletions railties/Rakefile
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -22,21 +22,23 @@ RUBY_FORGE_USER = "webster132"




task :default => :test task :default => :test
task :test => 'test:isolated'


## This is required until the regular test task ## This is required until the regular test task
## below passes. It's not ideal, but at least ## below passes. It's not ideal, but at least
## we can see the failures ## we can see the failures
task :test do namespace :test do
dir = ENV["TEST_DIR"] || "**" task :isolated do
Dir["test/#{dir}/*_test.rb"].all? do |file| dir = ENV["TEST_DIR"] || "**"
next true if file.include?("fixtures") Dir["test/#{dir}/*_test.rb"].all? do |file|
ruby = File.join(*RbConfig::CONFIG.values_at('bindir', 'RUBY_INSTALL_NAME')) next true if file.include?("fixtures")
system(ruby, '-Itest', "-I#{File.dirname(__FILE__)}/../activesupport/lib", file) ruby = File.join(*RbConfig::CONFIG.values_at('bindir', 'RUBY_INSTALL_NAME'))
end or raise "Failures" system(ruby, '-Itest', "-I#{File.dirname(__FILE__)}/../activesupport/lib", file)
end or raise "Failures"
end
end end
task :isolated_test => :test


Rake::TestTask.new("regular_test") do |t| Rake::TestTask.new('test:regular') do |t|
t.libs << 'test' << "#{File.dirname(__FILE__)}/../activesupport/lib" t.libs << 'test' << "#{File.dirname(__FILE__)}/../activesupport/lib"
t.pattern = 'test/**/*_test.rb' t.pattern = 'test/**/*_test.rb'
t.warning = true t.warning = true
Expand Down

0 comments on commit bbb3e5a

Please sign in to comment.