Skip to content

Commit

Permalink
Merge pull request #18629 from Homebrew/env-config-test-timeout
Browse files Browse the repository at this point in the history
Add `HOMEBREW_TEST_TIMEOUT_SECS` env var
  • Loading branch information
ZhongRuoyu authored Oct 26, 2024
2 parents 368d086 + d2cdd99 commit 59d56f8
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Library/Homebrew/test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
require "dev-cmd/test"
require "json/add/exception"

TEST_TIMEOUT_SECONDS = 5 * 60
DEFAULT_TEST_TIMEOUT_SECONDS = 5 * 60

begin
ENV.delete("HOMEBREW_FORBID_PACKAGES_FROM_PATHS")
Expand Down Expand Up @@ -49,7 +49,9 @@
if args.debug? # --debug is interactive
run_test.call
else
Timeout.timeout(TEST_TIMEOUT_SECONDS, &run_test)
# HOMEBREW_TEST_TIMEOUT_SECS is private API and subject to change.
timeout = ENV["HOMEBREW_TEST_TIMEOUT_SECS"]&.to_i || DEFAULT_TEST_TIMEOUT_SECONDS
Timeout.timeout(timeout, &run_test)
end
rescue Exception => e # rubocop:disable Lint/RescueException
error_pipe.puts e.to_json
Expand Down

0 comments on commit 59d56f8

Please sign in to comment.