Skip to content

Commit

Permalink
Merge pull request #1419 from mbj/generalize/warmup
Browse files Browse the repository at this point in the history
Change to process warmup in parallel abstraction
  • Loading branch information
mbj authored Feb 14, 2024
2 parents 7096368 + 1f7ba12 commit c30fb9f
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 15 deletions.
2 changes: 0 additions & 2 deletions lib/mutant/mutation/runner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ def self.call(env)
def self.run_mutation_analysis(env)
reporter = reporter(env)

env.world.process_warmup

env
.record(:analysis) { run_driver(reporter, async_driver(env)) }
.tap { |result| env.record(:report) { reporter.report(result) } }
Expand Down
5 changes: 4 additions & 1 deletion lib/mutant/parallel.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ module Parallel
#
# @return [Driver]
def self.async(world, config)
shared = shared_state(world, config)
shared = shared_state(world, config)

world.process_warmup

workers = workers(world, config, shared)

Driver.new(
Expand Down
2 changes: 1 addition & 1 deletion scripts/devloop.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
while inotifywait lib/**/*.rb meta/**/*.rb spec/**/*.rb Gemfile Gemfile.shared mutant.gemspec; do
bundle exec rspec spec/unit -fd --fail-fast --order default \
bundle exec rspec spec/unit -fd --fail-fast --order defined \
&& bundle exec mutant run --since main --fail-fast --zombie -- 'Mutant*' \
&& bundle exec rubocop
done
10 changes: 0 additions & 10 deletions spec/unit/mutant/mutation/runner_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,6 @@ def apply
selector: :start,
arguments: [env]
},
{
receiver: world,
selector: :process_warmup,
arguments: []
},
{
receiver: env,
selector: :record,
Expand Down Expand Up @@ -154,11 +149,6 @@ def apply
selector: :start,
arguments: [env]
},
{
receiver: world,
selector: :process_warmup,
arguments: []
},
{
receiver: env,
selector: :record,
Expand Down
15 changes: 14 additions & 1 deletion spec/unit/mutant/parallel_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,15 @@ def apply
let(:var_running) { instance_double(Mutant::Variable::MVar, :running) }
let(:var_sink) { instance_double(Mutant::Variable::IVar, :sink) }
let(:var_source) { instance_double(Mutant::Variable::IVar, :source) }
let(:world) { fake_world }

let(:world) do
instance_double(
Mutant::World,
condition_variable: class_double(ConditionVariable),
mutex: class_double(Mutex),
thread: class_double(Thread)
)
end

let(:worker_a) do
instance_double(described_class::Worker, :a, index: 0)
Expand Down Expand Up @@ -109,6 +117,11 @@ def thread(name, thread, worker)
mvar(var_running, value: 2),
ivar(var_sink, value: sink),
ivar(var_source, value: source),
{
receiver: world,
selector: :process_warmup,
arguments: []
},
worker(0, 'parallel-process-0', worker_a),
worker(1, 'parallel-process-1', worker_b),
*thread('parallel-thread-0', thread_a, worker_a),
Expand Down

0 comments on commit c30fb9f

Please sign in to comment.