Merge pull request #16441 from apainintheneck/add-profile-option-to-tests

dev-cmd/tests: Add profile option
This commit is contained in:
Mike McQuaid 2024-01-08 14:03:25 +00:00 committed by GitHub
commit 9cdfcd353b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 14 additions and 0 deletions

View File

@ -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

View File

@ -2214,6 +2214,7 @@ _brew_tests() {
--help
--online
--only
--profile
--quiet
--seed
--verbose

View File

@ -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'

View File

@ -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]'

View File

@ -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.

View File

@ -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\.
.