Add HOMEBREW_TEST_TIMEOUT_SECS env var
				
					
				
			Intended mainly for third-party formulae, this allows formula tests to be run with a customised timeout. This is a private, undocumented API and subject to change. Co-authored-by: Carlo Cabrera <github@carlo.cab>
This commit is contained in:
		
							parent
							
								
									bbe5a858d5
								
							
						
					
					
						commit
						d2cdd99591
					
				@ -16,7 +16,7 @@ require "cli/parser"
 | 
			
		||||
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")
 | 
			
		||||
@ -49,7 +49,9 @@ begin
 | 
			
		||||
  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
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user