tests: allow passing --seed <number>

This parameter is printed by every `brew tests` run and feeding it back
into the test suite allows to get an identical run. Make it easier to
do that by accepting the argument as it is printed during `brew tests`.

This requires a slight adjustment to named-argument passing as the
number that follows `--seed` is also seen as a named argument, but we
usually only want to pass `TEST=<something>` and `TESTOPTS=<something>`.
This commit is contained in:
Martin Afanasjew 2016-01-20 06:39:57 +01:00
parent a12c5816aa
commit 0d1e72f55f

View File

@ -22,9 +22,12 @@ module Homebrew
system "bundle", "install", "--path", "vendor/bundle"
end
# Make it easier to reproduce test runs.
ENV["SEED"] = ARGV.next if ARGV.include? "--seed"
args = []
args << "--trace" if ARGV.include? "--trace"
args += ARGV.named
args += ARGV.named.select { |v| v[/^TEST(OPTS)?=/] }
system "bundle", "exec", "rake", "test", *args
Homebrew.failed = !$?.success?