Skip to content

Commit

Permalink
chore: copy plan marks when applying merge group
Browse files Browse the repository at this point in the history
This became a necessity as we pretend to do early deployments at network
generation. In this scenario, when a "free" task context is merged into its
deployed counter part its plan marks is not carried out to the deployment task
instance. Then, this task instance would be garbage collected because it did
not carried the permanent mark from the replace "free" task context
  • Loading branch information
wvmcastro committed Dec 5, 2024
1 parent 513e480 commit 7ef8122
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/syskit/network_generation/merge_solver.rb
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ def apply_merge_group(merged_task_to_task)

merged_task_to_task.each do |merged_task, task|
unless merged_task.transaction_proxy?
plan.copy_marks! from_task: merged_task, to_task: task
plan.remove_task(merged_task)
end
register_replacement(merged_task, task)
Expand Down
25 changes: 25 additions & 0 deletions test/network_generation/test_merge_solver.rb
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,31 @@ def mock_merged_task_with_concrete_input_connections(*connections)
end
end

describe "#apply_merge_group" do
attr_reader :local_plan, :solver
before do
@local_plan = Roby::Plan.new
@solver = Syskit::NetworkGeneration::MergeSolver.new(@local_plan)
end

# I don't like the "destination task" name but couldn't thought in a better one
it "applyes merged task plan marks to the destination task" do
task_1 = Roby::Task.new
task_2 = Roby::Task.new

local_plan.add_permanent_task task_1
local_plan.add_mission_task task_1

refute local_plan.permanent_task? task_2
refute local_plan.mission_task? task_2

solver.apply_merge_group({task_1 => task_2})

assert local_plan.permanent_task? task_2
assert local_plan.mission_task? task_2
end
end

describe "functional tests" do
describe "merging compositions" do
attr_reader :plan, :srv_m, :task_m, :cmp_m
Expand Down

0 comments on commit 7ef8122

Please sign in to comment.