Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dev-cmd/tests: Add profile option #16441

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions Library/Homebrew/dev-cmd/tests.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ def tests_args
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."

Expand Down Expand Up @@ -122,6 +124,8 @@ def tests
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?
Expand Down Expand Up @@ -157,6 +161,7 @@ def tests
--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
Expand Down
1 change: 1 addition & 0 deletions completions/bash/brew
Original file line number Diff line number Diff line change
Expand Up @@ -2214,6 +2214,7 @@ _brew_tests() {
--help
--online
--only
--profile
--quiet
--seed
--verbose
Expand Down
1 change: 1 addition & 0 deletions completions/fish/brew.fish
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
1 change: 1 addition & 0 deletions completions/zsh/_brew
Original file line number Diff line number Diff line change
Expand Up @@ -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]'
Expand Down
2 changes: 2 additions & 0 deletions docs/Manpage.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
4 changes: 4 additions & 0 deletions manpages/brew.1
Original file line number Diff line number Diff line change
Expand Up @@ -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\.
.
Expand Down