dev-cmd/tests: Add profile option
This will allow us to more easily measure test performance. The only downside here is that we can't use it with parallel rspec because it will show the n slowest tests for each parallel rspec run which is not what we want.
This commit is contained in:
parent
3821fab241
commit
894b94bfd7
@ -29,6 +29,8 @@ module Homebrew
|
||||
flag "--only=",
|
||||
description: "Run only <test_script>`_spec.rb`. Appending `:`<line_number> will start at a " \
|
||||
"specific line."
|
||||
flag "--profile=",
|
||||
description: "Run the test suite serially to find the <n> slowest tests."
|
||||
flag "--seed=",
|
||||
description: "Randomise tests with the specified <value> instead of a random seed."
|
||||
|
||||
@ -122,6 +124,8 @@ module Homebrew
|
||||
end
|
||||
end
|
||||
|
||||
parallel = false if args.profile
|
||||
|
||||
parallel_rspec_log_name = "parallel_runtime_rspec"
|
||||
parallel_rspec_log_name = "#{parallel_rspec_log_name}.generic" if args.generic?
|
||||
parallel_rspec_log_name = "#{parallel_rspec_log_name}.online" if args.online?
|
||||
@ -157,6 +161,7 @@ module Homebrew
|
||||
--require spec_helper
|
||||
]
|
||||
bundle_args << "--fail-fast" if args.fail_fast?
|
||||
bundle_args << "--profile" << args.profile if args.profile
|
||||
|
||||
# TODO: Refactor and move to extend/os
|
||||
# rubocop:disable Homebrew/MoveToExtendOS
|
||||
|
||||
@ -2214,6 +2214,7 @@ _brew_tests() {
|
||||
--help
|
||||
--online
|
||||
--only
|
||||
--profile
|
||||
--quiet
|
||||
--seed
|
||||
--verbose
|
||||
|
||||
@ -1474,6 +1474,7 @@ __fish_brew_complete_arg 'tests' -l generic -d 'Run only OS-agnostic tests'
|
||||
__fish_brew_complete_arg 'tests' -l help -d 'Show this message'
|
||||
__fish_brew_complete_arg 'tests' -l online -d 'Include tests that use the GitHub API and tests that use any of the taps for official external commands'
|
||||
__fish_brew_complete_arg 'tests' -l only -d 'Run only test_script`_spec.rb`. Appending `:`line_number will start at a specific line'
|
||||
__fish_brew_complete_arg 'tests' -l profile -d 'Run the test suite serially to find the n slowest tests'
|
||||
__fish_brew_complete_arg 'tests' -l quiet -d 'Make some output more quiet'
|
||||
__fish_brew_complete_arg 'tests' -l seed -d 'Randomise tests with the specified value instead of a random seed'
|
||||
__fish_brew_complete_arg 'tests' -l verbose -d 'Make some output more verbose'
|
||||
|
||||
@ -1820,6 +1820,7 @@ _brew_tests() {
|
||||
'--help[Show this message]' \
|
||||
'--online[Include tests that use the GitHub API and tests that use any of the taps for official external commands]' \
|
||||
'(--changed)--only[Run only test_script`_spec.rb`. Appending `:`line_number will start at a specific line]' \
|
||||
'--profile[Run the test suite serially to find the n slowest tests]' \
|
||||
'--quiet[Make some output more quiet]' \
|
||||
'--seed[Randomise tests with the specified value instead of a random seed]' \
|
||||
'--verbose[Make some output more verbose]'
|
||||
|
||||
@ -1591,6 +1591,8 @@ Run Homebrew's unit and integration tests.
|
||||
Exit early on the first failing test.
|
||||
* `--only`:
|
||||
Run only *`test_script`*`_spec.rb`. Appending `:`*`line_number`* will start at a specific line.
|
||||
* `--profile`:
|
||||
Run the test suite serially to find the *`n`* slowest tests.
|
||||
* `--seed`:
|
||||
Randomise tests with the specified *`value`* instead of a random seed.
|
||||
|
||||
|
||||
@ -2275,6 +2275,10 @@ Exit early on the first failing test\.
|
||||
Run only \fItest_script\fR\fB_spec\.rb\fR\. Appending \fB:\fR\fIline_number\fR will start at a specific line\.
|
||||
.
|
||||
.TP
|
||||
\fB\-\-profile\fR
|
||||
Run the test suite serially to find the \fIn\fR slowest tests\.
|
||||
.
|
||||
.TP
|
||||
\fB\-\-seed\fR
|
||||
Randomise tests with the specified \fIvalue\fR instead of a random seed\.
|
||||
.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user