From 0d1e72f55fbe34194c66da1edd6d6c37fc4adca6 Mon Sep 17 00:00:00 2001 From: Martin Afanasjew Date: Wed, 20 Jan 2016 06:39:57 +0100 Subject: [PATCH] tests: allow passing --seed 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=` and `TESTOPTS=`. --- Library/Homebrew/cmd/tests.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Library/Homebrew/cmd/tests.rb b/Library/Homebrew/cmd/tests.rb index a796e2f38d..27be1cd2f8 100644 --- a/Library/Homebrew/cmd/tests.rb +++ b/Library/Homebrew/cmd/tests.rb @@ -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?