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 9, 2024
1 parent 513e480 commit 94b4661
Show file tree
Hide file tree
Showing 2 changed files with 27 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 @@ -137,6 +137,7 @@ def apply_merge_group(merged_task_to_task)
plan.replace_subplan(task_replacements, merged_event_to_event)

merged_task_to_task.each do |merged_task, task|
plan.copy_marks(task, merged_task)
unless merged_task.transaction_proxy?
plan.remove_task(merged_task)
end
Expand Down
26 changes: 26 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,32 @@ 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
task1 = Roby::Task.new
task2 = Roby::Task.new

local_plan.add_permanent_task task1
local_plan.add_mission_task task1

refute local_plan.permanent_task? task2
refute local_plan.mission_task? task2

solver.apply_merge_group({ task1 => task2 })

assert local_plan.permanent_task? task2
assert local_plan.mission_task? task2
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 94b4661

Please sign in to comment.