aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/dev-cmd/tests.rb
diff options
context:
space:
mode:
Diffstat (limited to 'Library/Homebrew/dev-cmd/tests.rb')
-rw-r--r--Library/Homebrew/dev-cmd/tests.rb22
1 files changed, 17 insertions, 5 deletions
diff --git a/Library/Homebrew/dev-cmd/tests.rb b/Library/Homebrew/dev-cmd/tests.rb
index aa2a3bff9..9b15f9f3e 100644
--- a/Library/Homebrew/dev-cmd/tests.rb
+++ b/Library/Homebrew/dev-cmd/tests.rb
@@ -6,7 +6,7 @@ require "tap"
module Homebrew
def tests
- (HOMEBREW_LIBRARY/"Homebrew/test").cd do
+ (HOMEBREW_LIBRARY/"Homebrew").cd do
ENV["HOMEBREW_NO_ANALYTICS_THIS_RUN"] = "1"
ENV["HOMEBREW_DEVELOPER"] = "1"
ENV["TESTOPTS"] = "-v" if ARGV.verbose?
@@ -19,9 +19,11 @@ module Homebrew
if ARGV.include? "--coverage"
ENV["HOMEBREW_TESTS_COVERAGE"] = "1"
- FileUtils.rm_f "coverage/.resultset.json"
+ FileUtils.rm_f "test/coverage/.resultset.json"
end
+ ENV["BUNDLE_GEMFILE"] = "#{Dir.pwd}/test/Gemfile"
+
# Override author/committer as global settings might be invalid and thus
# will cause silent failure during the setup of dummy Git repositories.
%w[AUTHOR COMMITTER].each do |role|
@@ -37,16 +39,26 @@ module Homebrew
# Make it easier to reproduce test runs.
ENV["SEED"] = ARGV.next if ARGV.include? "--seed"
+ files = Dir["test/test_*.rb"]
+ files -= Dir["test/test_os_mac_*.rb"] unless OS.mac?
+
+ opts = []
+ opts << "--serialize-stdout" if ENV["CI"]
+
args = []
args << "--trace" if ARGV.include? "--trace"
+
if ARGV.value("only")
ENV["HOMEBREW_TESTS_ONLY"] = "1"
test_name, test_method = ARGV.value("only").split("/", 2)
- args << "TEST=test_#{test_name}.rb"
- args << "TESTOPTS=--name=test_#{test_method}" if test_method
+ files = ["test/test_#{test_name}.rb"]
+ args << "--name=test_#{test_method}" if test_method
end
+
args += ARGV.named.select { |v| v[/^TEST(OPTS)?=/] }
- system "bundle", "exec", "rake", "test", *args
+
+ system "bundle", "exec", "parallel_test", *opts,
+ "--", *args, "--", *files
Homebrew.failed = !$?.success?