Class: Evilution::Runner Private

Inherits:
Object
  • Object
show all
Defined in:
lib/evilution/runner.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Defined Under Namespace

Classes: BaselineRunner, Canary, Diagnostics, IsolationResolver, MutationExecutor, MutationPlanner, ReportPublisher, SubjectPipeline

Constant Summary collapse

INTEGRATIONS =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

{
  rspec: Evilution::Integration::RSpec,
  minitest: Evilution::Integration::Minitest,
  test_unit: Evilution::Integration::TestUnit
}.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config: Evilution::Config.new, on_result: nil, hooks: nil) ⇒ Runner

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Runner.



15
16
17
18
19
20
21
22
# File 'lib/evilution/runner.rb', line 15

def initialize(config: Evilution::Config.new, on_result: nil, hooks: nil)
  @config = config
  @on_result = on_result
  @hooks = hooks
  @parser = Evilution::AST::Parser.new
  @registry = Evilution::Mutator::Registry.for_profile(config.profile)
  @cache = config.incremental? ? Evilution::Cache.new : nil
end

Instance Attribute Details

#configObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



13
14
15
# File 'lib/evilution/runner.rb', line 13

def config
  @config
end

Instance Method Details

#callObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



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
# File 'lib/evilution/runner.rb', line 24

def call
  install_signal_handlers
  configure_child_output
  emit_parallel_db_warning
  start_time = Process.clock_gettime(Process::CLOCK_MONOTONIC)

  subjects = subject_pipeline.call
  log_memory("after parse_subjects", "#{subjects.length} subjects")

  perform_preload
  log_memory("after preload") if rails_root_detected?

  run_canary

  baseline_result = run_baseline(subjects)

  plan = mutation_planner.call(subjects)
  release_subject_nodes(subjects)
  clear_operator_caches
  execution = run_mutations(plan.enabled, baseline_result)
  results = execution.results + equivalent_results(plan.equivalent)
  log_memory("after run_mutations", "#{results.length} results")

  duration = Process.clock_gettime(Process::CLOCK_MONOTONIC) - start_time

  summary = Evilution::Result::Summary.new(results: results, duration: duration, truncated: execution.truncated,
                                           skipped: plan.skipped_count,
                                           disabled_mutations: plan.disabled_mutations)
  output_report(summary)
  save_session(summary)

  summary
end

#parse_and_filter_subjectsObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



58
59
60
# File 'lib/evilution/runner.rb', line 58

def parse_and_filter_subjects
  subject_pipeline.call
end