/usr/lib/ruby/vendor_ruby/rspec/core/bisect/coordinator.rb is in ruby-rspec-core 3.5.0c3e0m0s0-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 | RSpec::Support.require_rspec_core "bisect/server"
RSpec::Support.require_rspec_core "bisect/runner"
RSpec::Support.require_rspec_core "bisect/example_minimizer"
RSpec::Support.require_rspec_core "formatters/bisect_progress_formatter"
module RSpec
module Core
module Bisect
# @private
# The main entry point into the bisect logic. Coordinates among:
# - Bisect::Server: Receives suite results.
# - Bisect::Runner: Runs a set of examples and directs the results
# to the server.
# - Bisect::ExampleMinimizer: Contains the core bisect logic.
# - Formatters::BisectProgressFormatter: provides progress updates
# to the user.
class Coordinator
def self.bisect_with(original_cli_args, configuration, formatter)
new(original_cli_args, configuration, formatter).bisect
end
def initialize(original_cli_args, configuration, formatter)
@original_cli_args = original_cli_args
@configuration = configuration
@formatter = formatter
end
def bisect
@configuration.add_formatter @formatter
reporter.close_after do
repro = Server.run do |server|
runner = Runner.new(server, @original_cli_args)
minimizer = ExampleMinimizer.new(runner, reporter)
gracefully_abort_on_sigint(minimizer)
minimizer.find_minimal_repro
minimizer.repro_command_for_currently_needed_ids
end
reporter.publish(:bisect_repro_command, :repro => repro)
end
true
rescue BisectFailedError => e
reporter.publish(:bisect_failed, :failure_explanation => e.message)
false
end
private
def reporter
@configuration.reporter
end
def gracefully_abort_on_sigint(minimizer)
trap('INT') do
repro = minimizer.repro_command_for_currently_needed_ids
reporter.publish(:bisect_aborted, :repro => repro)
exit(1)
end
end
end
end
end
end
|