Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: copy plan marks when applying merge group #443

Open
wants to merge 1 commit into
base: transition-to-runkit
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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_task_marks(from: merged_task, to: task)
plan.remove_task(merged_task)
end
register_replacement(merged_task, task)
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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better make that a comment in the PR itself. ... now you have to remove it :P

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