2016-08-21 07:51:25 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#!/usr/bin/env ruby
							 | 
						
					
						
							
								
									
										
										
										
											2020-07-02 10:22:54 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								# frozen_string_literal: true
							 | 
						
					
						
							
								
									
										
										
										
											2015-07-27 21:50:30 +01:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2017-02-18 14:35:02 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								require "English"
							 | 
						
					
						
							
								
									
										
										
										
											2016-09-25 00:51:09 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-08-18 15:58:46 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								SimpleCov.enable_for_subprocesses true
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2015-07-27 21:50:30 +01:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								SimpleCov.start do
							 | 
						
					
						
							
								
									
										
										
										
											2016-09-21 22:58:35 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  coverage_dir File.expand_path("../test/coverage", File.realpath(__FILE__))
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  root File.expand_path("..", File.realpath(__FILE__))
							 | 
						
					
						
							
								
									
										
										
										
											2023-02-17 13:36:19 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  command_name "brew"
							 | 
						
					
						
							
								
									
										
										
										
											2015-07-27 21:50:30 +01:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2022-02-22 15:27:43 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  # enables branch coverage as well as, the default, line coverage
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  enable_coverage :branch
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2016-08-06 04:24:18 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  # We manage the result cache ourselves and the default of 10 minutes can be
							 | 
						
					
						
							
								
									
										
										
										
											2023-02-17 15:26:18 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  # too low causing results from some integration tests to be dropped. This
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  # causes random fluctuations in test coverage.
							 | 
						
					
						
							
								
									
										
										
										
											2016-08-06 04:24:18 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  merge_timeout 86400
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2023-02-17 14:05:04 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  at_fork do
							 | 
						
					
						
							
								
									
										
										
										
											2020-08-18 15:58:46 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    # be quiet, the parent process will be in charge of output and checking coverage totals
							 | 
						
					
						
							
								
									
										
										
										
											2020-08-31 02:29:54 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    SimpleCov.print_error_status = false
							 | 
						
					
						
							
								
									
										
										
										
											2020-08-18 15:58:46 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  end
							 | 
						
					
						
							
								
									
										
										
										
											2021-04-06 22:53:05 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  excludes = ["test", "vendor"]
							 | 
						
					
						
							
								
									
										
										
										
											2021-04-12 22:43:56 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  subdirs = Dir.chdir(SimpleCov.root) { Pathname.glob("*") }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								               .reject { |p| p.extname == ".rb" || excludes.include?(p.to_s) }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								               .map { |p| "#{p}/**/*.rb" }.join(",")
							 | 
						
					
						
							
								
									
										
										
										
											2021-04-06 22:53:05 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  files = "#{SimpleCov.root}/{#{subdirs},*.rb}"
							 | 
						
					
						
							
								
									
										
										
										
											2020-08-18 15:58:46 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2023-11-11 05:36:40 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  if (integration_test_number = ENV.fetch("HOMEBREW_INTEGRATION_TEST", nil))
							 | 
						
					
						
							
								
									
										
											 
										 
										
											
												simplecov: Set `command_name` shorter than "all of the file paths ever"
- Having `ENV["HOMEBREW_INTEGRATION_TEST"]` as part of the
  `command_name` for SimpleCov made the "generated report" wording
  _really_ long and unintelligible, since `HOMEBREW_INTEGRATION_TEST`
  for some reason is a list of paths, which when we run all of the tests
  in parallel, is a lot.
- Because of the way the tests run, this is still _a bit_
  noisy, but I've assumed we still want the uniqueness (ish) of the
  process IDs. I'll iterate some more to trim this further, if desired.
```
Coverage report generated for Homebrew/brew (), Homebrew/brew (10), Homebrew/brew (11), Homebrew/brew (12), Homebrew/brew (13), Homebrew/brew (14), Homebrew/brew (15), Homebrew/brew (16), Homebrew/brew (2), Homebrew/brew (3), Homebrew/brew (4), Homebrew/brew (5), Homebrew/brew (6), Homebrew/brew (7), Homebrew/brew (8), Homebrew/brew (9), Homebrew/brew integration tests (), Homebrew/brew integration tests (10), Homebrew/brew integration tests (11), Homebrew/brew integration tests (12), Homebrew/brew integration tests (13), Homebrew/brew integration tests (14), Homebrew/brew integration tests (15), Homebrew/brew integration tests (16), Homebrew/brew integration tests (2), Homebrew/brew integration tests (3), Homebrew/brew integration tests (4), Homebrew/brew integration tests (5), Homebrew/brew integration tests (6), Homebrew/brew integration tests (7), Homebrew/brew integration tests (8), Homebrew/brew integration tests (9) to /usr/local/Homebrew/Library/Homebrew/test/coverage. 22236 / 32877 LOC (67.63%) covered.
```
											
										 
										
											2023-02-16 17:45:49 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    # This needs a unique name so it won't be overwritten
							 | 
						
					
						
							
								
									
										
										
										
											2023-11-11 05:36:40 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    command_name "brew_i:#{integration_test_number}"
							 | 
						
					
						
							
								
									
										
										
										
											2017-03-05 18:56:32 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-08-18 15:58:46 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    # be quiet, the parent process will be in charge of output and checking coverage totals
							 | 
						
					
						
							
								
									
										
										
										
											2020-08-31 02:29:54 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    SimpleCov.print_error_status = false
							 | 
						
					
						
							
								
									
										
										
										
											2020-08-18 15:58:46 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-11-29 16:08:10 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    SimpleCov.at_exit do
							 | 
						
					
						
							
								
									
										
										
										
											2016-09-22 17:40:52 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      # Just save result, but don't write formatted output.
							 | 
						
					
						
							
								
									
										
										
										
											2021-04-08 23:03:28 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      coverage_result = Coverage.result.dup
							 | 
						
					
						
							
								
									
										
										
										
											2021-04-06 22:53:05 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      Dir[files].each do |file|
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        absolute_path = File.expand_path(file)
							 | 
						
					
						
							
								
									
										
										
										
											2021-04-08 23:03:28 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        coverage_result[absolute_path] ||= SimpleCov::SimulateCoverage.call(absolute_path)
							 | 
						
					
						
							
								
									
										
										
										
											2021-04-06 22:53:05 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      end
							 | 
						
					
						
							
								
									
										
										
										
											2016-09-22 17:40:52 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      simplecov_result = SimpleCov::Result.new(coverage_result)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      SimpleCov::ResultMerger.store_result(simplecov_result)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-11-29 18:38:11 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      # If an integration test raises a `SystemExit` exception on exit,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      # exit immediately using the same status code to avoid reporting
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      # an error when expecting a non-successful exit status.
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      raise if $ERROR_INFO.is_a?(SystemExit)
							 | 
						
					
						
							
								
									
										
										
										
											2016-06-14 14:54:16 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    end
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  else
							 | 
						
					
						
							
								
									
										
										
										
											2023-11-11 05:36:40 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    command_name "brew:#{ENV.fetch("TEST_ENV_NUMBER", $PROCESS_ID)}"
							 | 
						
					
						
							
								
									
										
										
										
											2017-10-08 00:45:18 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2017-10-08 14:14:15 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    # Not using this during integration tests makes the tests 4x times faster
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    # without changing the coverage.
							 | 
						
					
						
							
								
									
										
										
										
											2021-04-06 22:53:05 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    track_files files
							 | 
						
					
						
							
								
									
										
										
										
											2016-01-27 22:03:17 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  end
							 | 
						
					
						
							
								
									
										
										
										
											2016-02-06 22:45:37 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2023-11-11 05:36:40 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  add_filter %r{^/build\.rb$}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  add_filter %r{^/config\.rb$}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  add_filter %r{^/constants\.rb$}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  add_filter %r{^/postinstall\.rb$}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  add_filter %r{^/test\.rb$}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  add_filter %r{^/dev-cmd/tests\.rb$}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  add_filter %r{^/sorbet/}
							 | 
						
					
						
							
								
									
										
										
										
											2017-10-08 00:45:18 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  add_filter %r{^/test/}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  add_filter %r{^/vendor/}
							 | 
						
					
						
							
								
									
										
										
										
											2023-11-11 05:36:40 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  add_filter %r{^/yard/}
							 | 
						
					
						
							
								
									
										
										
										
											2017-10-08 00:45:18 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2017-12-08 16:44:33 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  require "rbconfig"
							 | 
						
					
						
							
								
									
										
										
										
											2018-06-13 07:17:17 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  host_os = RbConfig::CONFIG["host_os"]
							 | 
						
					
						
							
								
									
										
										
										
											2023-02-06 13:48:18 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  add_filter %r{/os/mac} unless host_os.include?("darwin")
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  add_filter %r{/os/linux} unless host_os.include?("linux")
							 | 
						
					
						
							
								
									
										
										
										
											2017-12-08 16:44:33 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2016-02-06 22:45:37 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  # Add groups and the proper project name to the output.
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  project_name "Homebrew"
							 | 
						
					
						
							
								
									
										
										
										
											2023-11-11 05:36:40 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  add_group "Cask", %r{^/cask(/|\.rb$)}
							 | 
						
					
						
							
								
									
										
										
										
											2017-10-08 00:45:18 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  add_group "Commands", [%r{/cmd/}, %r{^/dev-cmd/}]
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  add_group "Extensions", %r{^/extend/}
							 | 
						
					
						
							
								
									
										
										
										
											2023-11-11 05:36:40 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  add_group "Livecheck", %r{^/livecheck(/|\.rb$)}
							 | 
						
					
						
							
								
									
										
										
										
											2017-10-08 00:45:18 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  add_group "OS", [%r{^/extend/os/}, %r{^/os/}]
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  add_group "Requirements", %r{^/requirements/}
							 | 
						
					
						
							
								
									
										
										
										
											2023-11-11 05:36:40 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  add_group "RuboCops", %r{^/rubocops/}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  add_group "Unpack Strategies", %r{^/unpack_strategy(/|\.rb$)}
							 | 
						
					
						
							
								
									
										
										
										
											2017-10-08 00:45:18 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  add_group "Scripts", [
							 | 
						
					
						
							
								
									
										
										
										
											2023-11-11 05:36:40 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    %r{^/brew\.rb$},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    %r{^/build\.rb$},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    %r{^/postinstall\.rb$},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    %r{^/test\.rb$},
							 | 
						
					
						
							
								
									
										
										
										
											2016-02-06 22:45:37 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  ]
							 | 
						
					
						
							
								
									
										
										
										
											2015-07-27 21:50:30 +01:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								end
							 |