roby 0.7.3 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/History.txt +7 -5
- data/Manifest.txt +91 -16
- data/README.txt +24 -24
- data/Rakefile +92 -64
- data/app/config/app.yml +42 -43
- data/app/config/init.rb +26 -0
- data/benchmark/alloc_misc.rb +123 -0
- data/benchmark/discovery_latency.rb +67 -0
- data/benchmark/garbage_collection.rb +48 -0
- data/benchmark/genom.rb +31 -0
- data/benchmark/transactions.rb +62 -0
- data/bin/roby +1 -1
- data/bin/roby-log +16 -6
- data/doc/guide/.gitignore +2 -0
- data/doc/guide/config.yaml +34 -0
- data/doc/guide/ext/init.rb +14 -0
- data/doc/guide/ext/previous_next.rb +40 -0
- data/doc/guide/ext/rdoc_links.rb +33 -0
- data/doc/guide/index.rdoc +16 -0
- data/doc/guide/overview.rdoc +62 -0
- data/doc/guide/plan_modifications.rdoc +67 -0
- data/doc/guide/src/abstraction/achieve_with.page +8 -0
- data/doc/guide/src/abstraction/forwarding.page +8 -0
- data/doc/guide/src/abstraction/hierarchy.page +19 -0
- data/doc/guide/src/abstraction/index.page +28 -0
- data/doc/guide/src/abstraction/task_models.page +13 -0
- data/doc/guide/src/basics.template +6 -0
- data/doc/guide/src/basics/app.page +139 -0
- data/doc/guide/src/basics/code_examples.page +33 -0
- data/doc/guide/src/basics/dry.page +69 -0
- data/doc/guide/src/basics/errors.page +443 -0
- data/doc/guide/src/basics/events.page +179 -0
- data/doc/guide/src/basics/hierarchy.page +275 -0
- data/doc/guide/src/basics/index.page +11 -0
- data/doc/guide/src/basics/log_replay/goForward_1.png +0 -0
- data/doc/guide/src/basics/log_replay/goForward_2.png +0 -0
- data/doc/guide/src/basics/log_replay/goForward_3.png +0 -0
- data/doc/guide/src/basics/log_replay/goForward_4.png +0 -0
- data/doc/guide/src/basics/log_replay/goForward_5.png +0 -0
- data/doc/guide/src/basics/log_replay/hierarchy_error_1.png +0 -0
- data/doc/guide/src/basics/log_replay/hierarchy_error_2.png +0 -0
- data/doc/guide/src/basics/log_replay/hierarchy_error_3.png +0 -0
- data/doc/guide/src/basics/log_replay/plan_repair_1.png +0 -0
- data/doc/guide/src/basics/log_replay/plan_repair_2.png +0 -0
- data/doc/guide/src/basics/log_replay/plan_repair_3.png +0 -0
- data/doc/guide/src/basics/log_replay/plan_repair_4.png +0 -0
- data/doc/guide/src/basics/log_replay/roby_log_main_window.png +0 -0
- data/doc/guide/src/basics/log_replay/roby_log_relation_window.png +0 -0
- data/doc/guide/src/basics/log_replay/roby_replay_event_representation.png +0 -0
- data/doc/guide/src/basics/plan_objects.page +71 -0
- data/doc/guide/src/basics/relations_display.page +203 -0
- data/doc/guide/src/basics/roby_cycle_overview.png +0 -0
- data/doc/guide/src/basics/shell.page +102 -0
- data/doc/guide/src/basics/summary.page +32 -0
- data/doc/guide/src/basics/tasks.page +357 -0
- data/doc/guide/src/basics_shell_header.txt +16 -0
- data/doc/guide/src/cycle/cycle-overview.png +0 -0
- data/doc/guide/src/cycle/cycle-overview.svg +208 -0
- data/doc/guide/src/cycle/error_handling.page +168 -0
- data/doc/guide/src/cycle/error_instantaneous_repair.png +0 -0
- data/doc/guide/src/cycle/error_instantaneous_repair.svg +1224 -0
- data/doc/guide/src/cycle/garbage_collection.page +10 -0
- data/doc/guide/src/cycle/index.page +23 -0
- data/doc/guide/src/cycle/propagation.page +154 -0
- data/doc/guide/src/cycle/propagation_diamond.png +0 -0
- data/doc/guide/src/cycle/propagation_diamond.svg +1279 -0
- data/doc/guide/src/default.css +319 -0
- data/doc/guide/src/default.template +74 -0
- data/doc/guide/src/htmldoc.metainfo +20 -0
- data/doc/guide/src/htmldoc.virtual +18 -0
- data/doc/guide/src/images/bodybg.png +0 -0
- data/doc/guide/src/images/contbg.png +0 -0
- data/doc/guide/src/images/footerbg.png +0 -0
- data/doc/guide/src/images/gradient1.png +0 -0
- data/doc/guide/src/images/gradient2.png +0 -0
- data/doc/guide/src/index.page +7 -0
- data/doc/guide/src/introduction/index.page +29 -0
- data/doc/guide/src/introduction/install.page +133 -0
- data/doc/{papers.rdoc → guide/src/introduction/publications.page} +5 -2
- data/doc/{videos.rdoc → guide/src/introduction/videos.page} +4 -2
- data/doc/guide/src/plugins/fault_tolerance.page +44 -0
- data/doc/guide/src/plugins/index.page +11 -0
- data/doc/guide/src/plugins/subsystems.page +45 -0
- data/doc/guide/src/relations/dependency.page +89 -0
- data/doc/guide/src/relations/index.page +12 -0
- data/doc/misc/update_github +24 -0
- data/doc/tutorials/02-GoForward.rdoc +3 -3
- data/ext/graph/graph.cc +46 -0
- data/lib/roby.rb +57 -22
- data/lib/roby/app.rb +132 -112
- data/lib/roby/app/plugins/rake.rb +21 -0
- data/lib/roby/app/rake.rb +0 -7
- data/lib/roby/app/run.rb +1 -1
- data/lib/roby/app/scripts/distributed.rb +1 -2
- data/lib/roby/app/scripts/generate/bookmarks.rb +1 -1
- data/lib/roby/app/scripts/results.rb +2 -1
- data/lib/roby/app/scripts/run.rb +6 -2
- data/lib/roby/app/scripts/shell.rb +11 -11
- data/lib/roby/config.rb +1 -1
- data/lib/roby/decision_control.rb +62 -3
- data/lib/roby/distributed.rb +4 -0
- data/lib/roby/distributed/base.rb +8 -0
- data/lib/roby/distributed/communication.rb +12 -8
- data/lib/roby/distributed/connection_space.rb +61 -44
- data/lib/roby/distributed/distributed_object.rb +1 -1
- data/lib/roby/distributed/notifications.rb +22 -30
- data/lib/roby/distributed/peer.rb +13 -8
- data/lib/roby/distributed/proxy.rb +5 -5
- data/lib/roby/distributed/subscription.rb +4 -4
- data/lib/roby/distributed/transaction.rb +3 -3
- data/lib/roby/event.rb +176 -110
- data/lib/roby/exceptions.rb +12 -4
- data/lib/roby/execution_engine.rb +1604 -0
- data/lib/roby/external_process_task.rb +225 -0
- data/lib/roby/graph.rb +0 -6
- data/lib/roby/interface.rb +221 -137
- data/lib/roby/log/console.rb +5 -3
- data/lib/roby/log/data_stream.rb +94 -16
- data/lib/roby/log/dot.rb +8 -8
- data/lib/roby/log/event_stream.rb +13 -3
- data/lib/roby/log/file.rb +43 -18
- data/lib/roby/log/gui/basic_display_ui.rb +89 -0
- data/lib/roby/log/gui/chronicle_view_ui.rb +90 -0
- data/lib/roby/log/gui/data_displays.rb +4 -5
- data/lib/roby/log/gui/data_displays_ui.rb +146 -0
- data/lib/roby/log/gui/relations.rb +18 -18
- data/lib/roby/log/gui/relations_ui.rb +120 -0
- data/lib/roby/log/gui/relations_view_ui.rb +144 -0
- data/lib/roby/log/gui/replay.rb +41 -13
- data/lib/roby/log/gui/replay_controls.rb +3 -0
- data/lib/roby/log/gui/replay_controls.ui +133 -110
- data/lib/roby/log/gui/replay_controls_ui.rb +249 -0
- data/lib/roby/log/hooks.rb +19 -18
- data/lib/roby/log/logger.rb +7 -6
- data/lib/roby/log/notifications.rb +4 -4
- data/lib/roby/log/plan_rebuilder.rb +20 -22
- data/lib/roby/log/relations.rb +44 -16
- data/lib/roby/log/server.rb +1 -4
- data/lib/roby/log/timings.rb +88 -19
- data/lib/roby/plan-object.rb +135 -11
- data/lib/roby/plan.rb +408 -224
- data/lib/roby/planning/loops.rb +32 -25
- data/lib/roby/planning/model.rb +157 -51
- data/lib/roby/planning/task.rb +47 -20
- data/lib/roby/query.rb +128 -92
- data/lib/roby/relations.rb +254 -136
- data/lib/roby/relations/conflicts.rb +6 -9
- data/lib/roby/relations/dependency.rb +358 -0
- data/lib/roby/relations/ensured.rb +0 -1
- data/lib/roby/relations/error_handling.rb +0 -1
- data/lib/roby/relations/events.rb +0 -2
- data/lib/roby/relations/executed_by.rb +26 -11
- data/lib/roby/relations/planned_by.rb +14 -14
- data/lib/roby/robot.rb +46 -0
- data/lib/roby/schedulers/basic.rb +34 -0
- data/lib/roby/standalone.rb +4 -0
- data/lib/roby/standard_errors.rb +21 -15
- data/lib/roby/state/events.rb +5 -4
- data/lib/roby/support.rb +107 -6
- data/lib/roby/task-operations.rb +23 -19
- data/lib/roby/task.rb +522 -148
- data/lib/roby/task_index.rb +80 -0
- data/lib/roby/test/common.rb +283 -44
- data/lib/roby/test/distributed.rb +53 -37
- data/lib/roby/test/testcase.rb +9 -204
- data/lib/roby/test/tools.rb +3 -3
- data/lib/roby/transactions.rb +154 -111
- data/lib/roby/transactions/proxy.rb +40 -7
- data/manifest.xml +20 -0
- data/plugins/fault_injection/README.txt +0 -3
- data/plugins/fault_injection/Rakefile +2 -8
- data/plugins/fault_injection/app.rb +1 -1
- data/plugins/fault_injection/fault_injection.rb +3 -3
- data/plugins/fault_injection/test/test_fault_injection.rb +19 -25
- data/plugins/subsystems/README.txt +0 -3
- data/plugins/subsystems/Rakefile +2 -7
- data/plugins/subsystems/app.rb +27 -16
- data/plugins/subsystems/test/app/config/init.rb +3 -0
- data/plugins/subsystems/test/app/planners/main.rb +1 -1
- data/plugins/subsystems/test/app/tasks/services.rb +1 -1
- data/plugins/subsystems/test/test_subsystems.rb +23 -16
- data/test/distributed/test_communication.rb +32 -15
- data/test/distributed/test_connection.rb +28 -26
- data/test/distributed/test_execution.rb +59 -54
- data/test/distributed/test_mixed_plan.rb +34 -34
- data/test/distributed/test_plan_notifications.rb +26 -26
- data/test/distributed/test_protocol.rb +57 -48
- data/test/distributed/test_query.rb +11 -7
- data/test/distributed/test_remote_plan.rb +71 -71
- data/test/distributed/test_transaction.rb +50 -47
- data/test/mockups/external_process +28 -0
- data/test/planning/test_loops.rb +163 -119
- data/test/planning/test_model.rb +3 -3
- data/test/planning/test_task.rb +27 -7
- data/test/relations/test_conflicts.rb +3 -3
- data/test/relations/test_dependency.rb +324 -0
- data/test/relations/test_ensured.rb +2 -2
- data/test/relations/test_executed_by.rb +94 -19
- data/test/relations/test_planned_by.rb +11 -9
- data/test/suite_core.rb +6 -3
- data/test/suite_distributed.rb +1 -0
- data/test/suite_planning.rb +1 -0
- data/test/suite_relations.rb +2 -2
- data/test/tasks/test_external_process.rb +126 -0
- data/test/{test_thread_task.rb → tasks/test_thread_task.rb} +17 -20
- data/test/test_bgl.rb +21 -1
- data/test/test_event.rb +229 -155
- data/test/test_exceptions.rb +79 -80
- data/test/test_execution_engine.rb +987 -0
- data/test/test_gui.rb +1 -1
- data/test/test_interface.rb +11 -5
- data/test/test_log.rb +18 -7
- data/test/test_log_server.rb +1 -0
- data/test/test_plan.rb +229 -395
- data/test/test_query.rb +193 -35
- data/test/test_relations.rb +88 -8
- data/test/test_state.rb +55 -37
- data/test/test_support.rb +1 -1
- data/test/test_task.rb +371 -218
- data/test/test_testcase.rb +32 -16
- data/test/test_transactions.rb +211 -170
- data/test/test_transactions_proxy.rb +37 -19
- metadata +169 -71
- data/.gitignore +0 -29
- data/doc/styles/allison.css +0 -314
- data/doc/styles/allison.js +0 -316
- data/doc/styles/allison.rb +0 -276
- data/doc/styles/jamis.rb +0 -593
- data/lib/roby/control.rb +0 -746
- data/lib/roby/executives/simple.rb +0 -30
- data/lib/roby/propagation.rb +0 -562
- data/lib/roby/relations/hierarchy.rb +0 -239
- data/lib/roby/transactions/updates.rb +0 -139
- data/test/relations/test_hierarchy.rb +0 -158
- data/test/test_control.rb +0 -399
- data/test/test_propagation.rb +0 -210
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
$LOAD_PATH.unshift File.expand_path('
|
|
1
|
+
$LOAD_PATH.unshift File.expand_path(File.join('..', '..', 'lib'), File.dirname(__FILE__))
|
|
2
2
|
require 'roby/test/distributed'
|
|
3
3
|
require 'roby/test/tasks/simple_task'
|
|
4
4
|
require 'flexmock'
|
|
@@ -16,7 +16,7 @@ class TC_DistributedQuery < Test::Unit::TestCase
|
|
|
16
16
|
t1 = Class.new(Task).new
|
|
17
17
|
t2 = Class.new(Task).new
|
|
18
18
|
t2.owners << fake_peer
|
|
19
|
-
plan.
|
|
19
|
+
plan.add [t1, t2]
|
|
20
20
|
|
|
21
21
|
assert_equal([t1].to_set, TaskMatcher.owned_by(Distributed).enum_for(:each, plan).to_set)
|
|
22
22
|
assert_equal([t1].to_set, TaskMatcher.self_owned.enum_for(:each, plan).to_set)
|
|
@@ -26,7 +26,7 @@ class TC_DistributedQuery < Test::Unit::TestCase
|
|
|
26
26
|
end
|
|
27
27
|
|
|
28
28
|
def test_marshal_query
|
|
29
|
-
peer2peer
|
|
29
|
+
peer2peer do |remote|
|
|
30
30
|
PeerServer.class_eval do
|
|
31
31
|
def query
|
|
32
32
|
plan.find_tasks
|
|
@@ -40,14 +40,18 @@ class TC_DistributedQuery < Test::Unit::TestCase
|
|
|
40
40
|
assert_kind_of(Query, query)
|
|
41
41
|
end
|
|
42
42
|
|
|
43
|
+
class QueryTaskModel < Roby::Task
|
|
44
|
+
argument :id
|
|
45
|
+
end
|
|
46
|
+
|
|
43
47
|
# Check that we can query the remote plan database
|
|
44
48
|
def test_query
|
|
45
|
-
peer2peer
|
|
49
|
+
peer2peer do |remote|
|
|
46
50
|
local_model = Class.new(SimpleTask)
|
|
47
51
|
|
|
48
|
-
mission, subtask =
|
|
49
|
-
mission.
|
|
50
|
-
remote.plan.
|
|
52
|
+
mission, subtask = QueryTaskModel.new(:id => 1), local_model.new(:id => 2)
|
|
53
|
+
mission.depends_on subtask
|
|
54
|
+
remote.plan.add_mission(mission)
|
|
51
55
|
end
|
|
52
56
|
|
|
53
57
|
# Get the remote missions
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
$LOAD_PATH.unshift File.expand_path('
|
|
1
|
+
$LOAD_PATH.unshift File.expand_path(File.join('..', '..', 'lib'), File.dirname(__FILE__))
|
|
2
2
|
require 'roby/test/distributed'
|
|
3
3
|
require 'roby/test/tasks/simple_task'
|
|
4
4
|
|
|
@@ -66,10 +66,10 @@ class TC_DistributedRemotePlan < Test::Unit::TestCase
|
|
|
66
66
|
end
|
|
67
67
|
|
|
68
68
|
def test_remote_proxy_update
|
|
69
|
-
peer2peer
|
|
70
|
-
remote.plan.
|
|
71
|
-
remote.plan.
|
|
72
|
-
remote.plan.
|
|
69
|
+
peer2peer do |remote|
|
|
70
|
+
remote.plan.add_mission(SimpleTask.new(:id => 'simple_task'))
|
|
71
|
+
remote.plan.add_permanent(SimpleTask.new(:id => 'task'))
|
|
72
|
+
remote.plan.add_permanent(SimpleTask.new(:id => 'other_task'))
|
|
73
73
|
end
|
|
74
74
|
|
|
75
75
|
r_simple_task = remote_task(:id => 'simple_task', :permanent => true)
|
|
@@ -81,28 +81,28 @@ class TC_DistributedRemotePlan < Test::Unit::TestCase
|
|
|
81
81
|
Distributed.update(r_simple_task) do
|
|
82
82
|
assert(r_simple_task.read_write?)
|
|
83
83
|
assert_nothing_raised do
|
|
84
|
-
r_simple_task.
|
|
84
|
+
r_simple_task.depends_on task
|
|
85
85
|
r_simple_task.remove_child task
|
|
86
|
-
task.
|
|
86
|
+
task.depends_on r_simple_task
|
|
87
87
|
task.remove_child r_simple_task
|
|
88
88
|
end
|
|
89
89
|
end
|
|
90
90
|
assert(!r_simple_task.read_write?)
|
|
91
91
|
|
|
92
|
-
assert_raises(OwnershipError) { r_simple_task.
|
|
93
|
-
assert_raises(OwnershipError) { task.
|
|
94
|
-
Distributed.update(r_simple_task) { r_simple_task.
|
|
92
|
+
assert_raises(OwnershipError) { r_simple_task.depends_on task }
|
|
93
|
+
assert_raises(OwnershipError) { task.depends_on r_simple_task }
|
|
94
|
+
Distributed.update(r_simple_task) { r_simple_task.depends_on task }
|
|
95
95
|
assert_nothing_raised { r_simple_task.remove_child task }
|
|
96
|
-
Distributed.update(r_simple_task) { task.
|
|
96
|
+
Distributed.update(r_simple_task) { task.depends_on r_simple_task }
|
|
97
97
|
assert_nothing_raised { task.remove_child r_simple_task }
|
|
98
98
|
|
|
99
|
-
assert_raises(OwnershipError) { r_simple_task.
|
|
100
|
-
assert_raises(OwnershipError) { r_other_task.
|
|
101
|
-
Distributed.update_all([r_simple_task, r_other_task]) { r_simple_task.
|
|
99
|
+
assert_raises(OwnershipError) { r_simple_task.depends_on r_other_task }
|
|
100
|
+
assert_raises(OwnershipError) { r_other_task.depends_on r_simple_task }
|
|
101
|
+
Distributed.update_all([r_simple_task, r_other_task]) { r_simple_task.depends_on r_other_task }
|
|
102
102
|
assert_raises(OwnershipError) { r_simple_task.remove_child r_other_task }
|
|
103
103
|
Distributed.update_all([r_simple_task, r_other_task]) do
|
|
104
104
|
r_simple_task.remove_child r_other_task
|
|
105
|
-
r_other_task.
|
|
105
|
+
r_other_task.depends_on r_simple_task
|
|
106
106
|
end
|
|
107
107
|
assert_raises(OwnershipError) { r_other_task.remove_child r_simple_task }
|
|
108
108
|
|
|
@@ -117,16 +117,16 @@ class TC_DistributedRemotePlan < Test::Unit::TestCase
|
|
|
117
117
|
# Test that the remote plan structure is properly mapped to the local
|
|
118
118
|
# plan database
|
|
119
119
|
def test_discover_neighborhood
|
|
120
|
-
peer2peer
|
|
120
|
+
peer2peer do |remote|
|
|
121
121
|
mission, subtask, next_mission =
|
|
122
122
|
SimpleTask.new(:id => 'mission'),
|
|
123
123
|
SimpleTask.new(:id => 'subtask'),
|
|
124
124
|
SimpleTask.new(:id => 'next_mission')
|
|
125
|
-
mission.
|
|
126
|
-
mission.
|
|
125
|
+
mission.depends_on subtask
|
|
126
|
+
mission.signals(:stop, next_mission, :start)
|
|
127
127
|
|
|
128
|
-
remote.plan.
|
|
129
|
-
remote.plan.
|
|
128
|
+
remote.plan.add_mission(mission)
|
|
129
|
+
remote.plan.add_mission(next_mission)
|
|
130
130
|
end
|
|
131
131
|
|
|
132
132
|
r_mission = remote_task(:id => 'mission', :permanent => true)
|
|
@@ -137,7 +137,7 @@ class TC_DistributedRemotePlan < Test::Unit::TestCase
|
|
|
137
137
|
assert_equal([], r_mission.children.to_a)
|
|
138
138
|
assert_equal([], r_mission.event(:stop).child_objects(EventStructure::Signal).to_a)
|
|
139
139
|
|
|
140
|
-
#
|
|
140
|
+
# add remote relations
|
|
141
141
|
remote_peer.discover_neighborhood(r_mission, 1) do |r_mission|
|
|
142
142
|
proxies = r_mission.children.to_a
|
|
143
143
|
assert_equal(1, proxies.to_a.size)
|
|
@@ -146,16 +146,16 @@ class TC_DistributedRemotePlan < Test::Unit::TestCase
|
|
|
146
146
|
assert_equal(r_next_mission.event(:start), proxies.first)
|
|
147
147
|
end
|
|
148
148
|
|
|
149
|
-
plan.
|
|
150
|
-
plan.
|
|
151
|
-
plan.
|
|
152
|
-
|
|
153
|
-
assert_equal([remote_peer.task], plan.
|
|
149
|
+
plan.unmark_permanent(r_mission)
|
|
150
|
+
plan.unmark_permanent(r_subtask)
|
|
151
|
+
plan.unmark_permanent(r_next_mission)
|
|
152
|
+
engine.wait_one_cycle
|
|
153
|
+
assert_equal([remote_peer.task], plan.permanent_tasks.to_a)
|
|
154
154
|
end
|
|
155
155
|
|
|
156
156
|
def test_subscribing_old_objects
|
|
157
|
-
peer2peer
|
|
158
|
-
plan.
|
|
157
|
+
peer2peer do |remote|
|
|
158
|
+
plan.add_mission(@task = SimpleTask.new(:id => 1))
|
|
159
159
|
end
|
|
160
160
|
|
|
161
161
|
r_task, r_task_id = nil
|
|
@@ -170,20 +170,20 @@ class TC_DistributedRemotePlan < Test::Unit::TestCase
|
|
|
170
170
|
end
|
|
171
171
|
|
|
172
172
|
def test_subscription
|
|
173
|
-
peer2peer
|
|
173
|
+
peer2peer do |remote|
|
|
174
174
|
root, mission, subtask, next_mission =
|
|
175
175
|
SimpleTask.new(:id => 'root'),
|
|
176
176
|
SimpleTask.new(:id => 'mission'),
|
|
177
177
|
SimpleTask.new(:id => 'subtask'),
|
|
178
178
|
SimpleTask.new(:id => 'next_mission')
|
|
179
|
-
root.
|
|
180
|
-
mission.
|
|
181
|
-
mission.
|
|
179
|
+
root.depends_on mission
|
|
180
|
+
mission.depends_on subtask
|
|
181
|
+
mission.signals(:stop, next_mission, :start)
|
|
182
182
|
|
|
183
|
-
remote.plan.
|
|
184
|
-
remote.plan.
|
|
185
|
-
remote.plan.
|
|
186
|
-
remote.plan.
|
|
183
|
+
remote.plan.add_permanent(subtask)
|
|
184
|
+
remote.plan.add_mission(root)
|
|
185
|
+
remote.plan.add_mission(mission)
|
|
186
|
+
remote.plan.add_mission(next_mission)
|
|
187
187
|
|
|
188
188
|
remote.singleton_class.class_eval do
|
|
189
189
|
include Test::Unit::Assertions
|
|
@@ -204,7 +204,7 @@ class TC_DistributedRemotePlan < Test::Unit::TestCase
|
|
|
204
204
|
mission.remove_child subtask
|
|
205
205
|
end
|
|
206
206
|
define_method(:add_mission_subtask) do
|
|
207
|
-
mission.
|
|
207
|
+
mission.depends_on subtask
|
|
208
208
|
end
|
|
209
209
|
end
|
|
210
210
|
end
|
|
@@ -233,11 +233,11 @@ class TC_DistributedRemotePlan < Test::Unit::TestCase
|
|
|
233
233
|
assert(plan.useful_task?(r_mission))
|
|
234
234
|
r_next_mission = remote_task(:id => 'next_mission')
|
|
235
235
|
r_subtask = remote_task(:id => 'subtask')
|
|
236
|
-
Roby
|
|
236
|
+
Roby.synchronize do
|
|
237
237
|
assert(!r_next_mission.plan || !plan.useful_task?(r_next_mission))
|
|
238
238
|
assert(!r_subtask.plan || !plan.useful_task?(r_subtask))
|
|
239
239
|
end
|
|
240
|
-
|
|
240
|
+
engine.wait_one_cycle
|
|
241
241
|
|
|
242
242
|
# Check that the task index has been updated
|
|
243
243
|
assert(!plan.task_index.by_owner[remote_peer].include?(r_subtask))
|
|
@@ -248,7 +248,7 @@ class TC_DistributedRemotePlan < Test::Unit::TestCase
|
|
|
248
248
|
r_subtask = remote_task(:id => 'subtask')
|
|
249
249
|
assert(!plan.unneeded_tasks.include?(r_subtask))
|
|
250
250
|
r_next_mission = remote_task(:id => 'next_mission')
|
|
251
|
-
Roby
|
|
251
|
+
Roby.synchronize do
|
|
252
252
|
assert(!r_next_mission.plan || plan.unneeded_tasks.include?(r_next_mission))
|
|
253
253
|
end
|
|
254
254
|
|
|
@@ -256,13 +256,13 @@ class TC_DistributedRemotePlan < Test::Unit::TestCase
|
|
|
256
256
|
|
|
257
257
|
## Check plan GC after we have unsubscribed from mission
|
|
258
258
|
remote_peer.unsubscribe(r_mission)
|
|
259
|
-
Roby
|
|
259
|
+
Roby.synchronize do
|
|
260
260
|
assert(r_mission.plan)
|
|
261
261
|
assert(!plan.unneeded_tasks.include?(r_mission))
|
|
262
262
|
assert(!remote_peer.subscribed?(r_mission))
|
|
263
263
|
assert(plan.unneeded_tasks.include?(r_subtask))
|
|
264
264
|
end
|
|
265
|
-
|
|
265
|
+
engine.wait_one_cycle
|
|
266
266
|
|
|
267
267
|
# Check that subtask and next_mission are removed from the plan
|
|
268
268
|
assert(!r_subtask.plan)
|
|
@@ -301,23 +301,23 @@ class TC_DistributedRemotePlan < Test::Unit::TestCase
|
|
|
301
301
|
r_mission = remote_peer.subscribe(r_mission)
|
|
302
302
|
r_subtask = remote_task(:id => 'subtask')
|
|
303
303
|
r_next_mission = remote_task(:id => 'next_mission')
|
|
304
|
-
|
|
304
|
+
engine.wait_one_cycle
|
|
305
305
|
|
|
306
306
|
proxies = r_mission.children.to_a
|
|
307
307
|
assert(! proxies.empty?)
|
|
308
308
|
end
|
|
309
309
|
|
|
310
310
|
def test_remove_not_needed
|
|
311
|
-
peer2peer
|
|
311
|
+
peer2peer do |remote|
|
|
312
312
|
left, right, middle =
|
|
313
313
|
SimpleTask.new(:id => 'left'),
|
|
314
314
|
SimpleTask.new(:id => 'right'),
|
|
315
315
|
SimpleTask.new(:id => 'middle')
|
|
316
|
-
remote.plan.
|
|
317
|
-
remote.plan.
|
|
316
|
+
remote.plan.add_mission(left)
|
|
317
|
+
remote.plan.add_mission(right)
|
|
318
318
|
|
|
319
|
-
left.
|
|
320
|
-
right.
|
|
319
|
+
left.depends_on middle
|
|
320
|
+
right.depends_on middle
|
|
321
321
|
|
|
322
322
|
remote.singleton_class.class_eval do
|
|
323
323
|
include Test::Unit::Assertions
|
|
@@ -338,7 +338,7 @@ class TC_DistributedRemotePlan < Test::Unit::TestCase
|
|
|
338
338
|
assert(!plan.unneeded_tasks.include?(right))
|
|
339
339
|
assert(!plan.unneeded_tasks.include?(middle))
|
|
340
340
|
|
|
341
|
-
Roby
|
|
341
|
+
Roby.synchronize do
|
|
342
342
|
remote_peer.unsubscribe(right)
|
|
343
343
|
assert(!right.remotely_useful?)
|
|
344
344
|
assert(!right.subscribed?)
|
|
@@ -357,10 +357,10 @@ class TC_DistributedRemotePlan < Test::Unit::TestCase
|
|
|
357
357
|
end
|
|
358
358
|
|
|
359
359
|
def test_data_update
|
|
360
|
-
peer2peer
|
|
360
|
+
peer2peer do |remote|
|
|
361
361
|
task = SimpleTask.new(:id => 'task')
|
|
362
362
|
task.data = [4, 2]
|
|
363
|
-
remote.plan.
|
|
363
|
+
remote.plan.add_mission(task)
|
|
364
364
|
|
|
365
365
|
remote.singleton_class.class_eval do
|
|
366
366
|
define_method(:change_data) { task.data = 42 }
|
|
@@ -375,20 +375,20 @@ class TC_DistributedRemotePlan < Test::Unit::TestCase
|
|
|
375
375
|
end
|
|
376
376
|
|
|
377
377
|
def test_mission_notifications
|
|
378
|
-
peer2peer
|
|
379
|
-
plan.
|
|
378
|
+
peer2peer do |remote|
|
|
379
|
+
plan.add_mission(mission = SimpleTask.new(:id => 'mission'))
|
|
380
380
|
|
|
381
381
|
remote.class.class_eval do
|
|
382
382
|
define_method(:discard_mission) do
|
|
383
|
-
Roby
|
|
384
|
-
remote.plan.
|
|
385
|
-
remote.plan.
|
|
383
|
+
Roby.synchronize do
|
|
384
|
+
remote.plan.unmark_mission(mission)
|
|
385
|
+
remote.plan.add_permanent(mission)
|
|
386
386
|
end
|
|
387
387
|
end
|
|
388
388
|
define_method(:insert_mission) do
|
|
389
|
-
Roby
|
|
390
|
-
remote.plan.
|
|
391
|
-
remote.plan.
|
|
389
|
+
Roby.synchronize do
|
|
390
|
+
remote.plan.unmark_permanent(mission)
|
|
391
|
+
remote.plan.add_mission(mission)
|
|
392
392
|
end
|
|
393
393
|
end
|
|
394
394
|
end
|
|
@@ -409,25 +409,25 @@ class TC_DistributedRemotePlan < Test::Unit::TestCase
|
|
|
409
409
|
end
|
|
410
410
|
|
|
411
411
|
def test_relation_updates
|
|
412
|
-
peer2peer
|
|
412
|
+
peer2peer do |remote|
|
|
413
413
|
mission, subtask, next_mission =
|
|
414
414
|
SimpleTask.new(:id => 'mission'),
|
|
415
415
|
SimpleTask.new(:id => 'subtask'),
|
|
416
416
|
SimpleTask.new(:id => 'next_mission')
|
|
417
417
|
|
|
418
|
-
remote.plan.
|
|
419
|
-
remote.plan.
|
|
420
|
-
remote.plan.
|
|
418
|
+
remote.plan.add_mission(mission)
|
|
419
|
+
remote.plan.add_mission(next_mission)
|
|
420
|
+
remote.plan.add_permanent(subtask)
|
|
421
421
|
|
|
422
422
|
remote.singleton_class.class_eval do
|
|
423
423
|
define_method(:add_mission_subtask) do
|
|
424
|
-
mission.
|
|
424
|
+
mission.depends_on subtask
|
|
425
425
|
end
|
|
426
426
|
define_method(:remove_mission_subtask) do
|
|
427
427
|
mission.remove_child subtask
|
|
428
428
|
end
|
|
429
429
|
define_method(:add_mission_stop_next_start) do
|
|
430
|
-
mission.
|
|
430
|
+
mission.signals(:stop, next_mission, :start)
|
|
431
431
|
end
|
|
432
432
|
define_method(:remove_mission_stop_next_start) do
|
|
433
433
|
mission.event(:stop).remove_signal(next_mission.event(:start))
|
|
@@ -458,16 +458,16 @@ class TC_DistributedRemotePlan < Test::Unit::TestCase
|
|
|
458
458
|
|
|
459
459
|
# Check that remote events that are unknown locally are properly ignored
|
|
460
460
|
def test_ignored_events
|
|
461
|
-
peer2peer
|
|
461
|
+
peer2peer do |remote|
|
|
462
462
|
model = Class.new(SimpleTask) do
|
|
463
463
|
event :unknown, :command => true
|
|
464
464
|
end
|
|
465
|
-
remote.plan.
|
|
466
|
-
remote.plan.
|
|
467
|
-
remote.plan.
|
|
465
|
+
remote.plan.add_mission(t1 = SimpleTask.new(:id => 1))
|
|
466
|
+
remote.plan.add_mission(t2 = SimpleTask.new(:id => 2))
|
|
467
|
+
remote.plan.add_mission(u = model.new(:id => 0))
|
|
468
468
|
|
|
469
|
-
t1.
|
|
470
|
-
|
|
469
|
+
t1.signals(:start, u, :unknown)
|
|
470
|
+
u.forward_to(:unknown, t2, :start)
|
|
471
471
|
|
|
472
472
|
remote.singleton_class.class_eval do
|
|
473
473
|
define_method(:remove_relations) do
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
$LOAD_PATH.unshift File.expand_path('
|
|
1
|
+
$LOAD_PATH.unshift File.expand_path(File.join('..', '..', 'lib'), File.dirname(__FILE__))
|
|
2
2
|
require 'roby/test/distributed'
|
|
3
3
|
require 'roby/test/tasks/simple_task'
|
|
4
4
|
|
|
@@ -6,7 +6,7 @@ class TC_DistributedTransaction < Test::Unit::TestCase
|
|
|
6
6
|
include Roby::Distributed::Test
|
|
7
7
|
|
|
8
8
|
def test_marshal_transactions
|
|
9
|
-
peer2peer
|
|
9
|
+
peer2peer do |remote|
|
|
10
10
|
PeerServer.class_eval do
|
|
11
11
|
attr_reader :plan
|
|
12
12
|
def transaction
|
|
@@ -30,7 +30,7 @@ class TC_DistributedTransaction < Test::Unit::TestCase
|
|
|
30
30
|
end
|
|
31
31
|
|
|
32
32
|
def test_transaction_create
|
|
33
|
-
peer2peer
|
|
33
|
+
peer2peer do |remote|
|
|
34
34
|
PeerServer.class_eval do
|
|
35
35
|
include Test::Unit::Assertions
|
|
36
36
|
def check_transaction(marshalled_trsc, trsc_drbobject)
|
|
@@ -39,7 +39,6 @@ class TC_DistributedTransaction < Test::Unit::TestCase
|
|
|
39
39
|
assert_equal([peer, Roby::Distributed], trsc.owners)
|
|
40
40
|
assert(!trsc.first_editor?)
|
|
41
41
|
assert(!trsc.editor?)
|
|
42
|
-
assert(trsc.conflict_solver.kind_of?(Roby::SolverIgnoreUpdate))
|
|
43
42
|
|
|
44
43
|
assert(trsc.subscribed?)
|
|
45
44
|
assert(trsc.update_on?(peer))
|
|
@@ -48,7 +47,7 @@ class TC_DistributedTransaction < Test::Unit::TestCase
|
|
|
48
47
|
end
|
|
49
48
|
end
|
|
50
49
|
end
|
|
51
|
-
trsc = Distributed::Transaction.new(plan
|
|
50
|
+
trsc = Distributed::Transaction.new(plan)
|
|
52
51
|
assert(trsc.self_owned?)
|
|
53
52
|
assert(trsc.first_editor?)
|
|
54
53
|
assert(trsc.editor?)
|
|
@@ -65,7 +64,7 @@ class TC_DistributedTransaction < Test::Unit::TestCase
|
|
|
65
64
|
end
|
|
66
65
|
|
|
67
66
|
def test_transaction_proxies
|
|
68
|
-
peer2peer
|
|
67
|
+
peer2peer do |remote|
|
|
69
68
|
PeerServer.class_eval do
|
|
70
69
|
include Test::Unit::Assertions
|
|
71
70
|
def marshalled_transaction_proxy(trsc, task)
|
|
@@ -84,7 +83,7 @@ class TC_DistributedTransaction < Test::Unit::TestCase
|
|
|
84
83
|
|
|
85
84
|
# Check that marshalling the remote view of a local transaction proxy
|
|
86
85
|
# returns the local proxy itself
|
|
87
|
-
plan.
|
|
86
|
+
plan.add_mission(task = Task.new)
|
|
88
87
|
assert(!plan.update_on?(remote_peer))
|
|
89
88
|
assert(trsc.update_on?(remote_peer))
|
|
90
89
|
assert(!task.update_on?(remote_peer))
|
|
@@ -99,20 +98,20 @@ class TC_DistributedTransaction < Test::Unit::TestCase
|
|
|
99
98
|
assert_equal(proxy, remote_peer.local_object(marshalled_remote))
|
|
100
99
|
end
|
|
101
100
|
|
|
102
|
-
# Checks that if we
|
|
101
|
+
# Checks that if we add a set of tasks, then their relations are updated as well
|
|
103
102
|
def test_discover
|
|
104
|
-
peer2peer
|
|
103
|
+
peer2peer do |remote|
|
|
105
104
|
def remote.add_tasks(trsc)
|
|
106
105
|
trsc = local_peer.local_object(trsc)
|
|
107
106
|
|
|
108
107
|
trsc.edit do
|
|
109
108
|
t1 = SimpleTask.new :id => 'root'
|
|
110
|
-
t1.
|
|
111
|
-
t1.
|
|
112
|
-
t2.
|
|
113
|
-
t3.
|
|
109
|
+
t1.depends_on(t2 = SimpleTask.new(:id => 'child'))
|
|
110
|
+
t1.signals(:start, t2, :start)
|
|
111
|
+
t2.depends_on(t3 = SimpleTask.new(:id => 'grandchild'))
|
|
112
|
+
t3.signals(:failed, t2, :failed)
|
|
114
113
|
|
|
115
|
-
trsc.
|
|
114
|
+
trsc.add_mission(t1)
|
|
116
115
|
end
|
|
117
116
|
end
|
|
118
117
|
end
|
|
@@ -133,7 +132,7 @@ class TC_DistributedTransaction < Test::Unit::TestCase
|
|
|
133
132
|
end
|
|
134
133
|
|
|
135
134
|
def test_edition
|
|
136
|
-
peer2peer
|
|
135
|
+
peer2peer do |remote|
|
|
137
136
|
class << remote
|
|
138
137
|
include Test::Unit::Assertions
|
|
139
138
|
def edit_transaction(trsc)
|
|
@@ -175,8 +174,8 @@ class TC_DistributedTransaction < Test::Unit::TestCase
|
|
|
175
174
|
end
|
|
176
175
|
|
|
177
176
|
def test_ownership
|
|
178
|
-
peer2peer
|
|
179
|
-
remote.plan.
|
|
177
|
+
peer2peer do |remote|
|
|
178
|
+
remote.plan.add_mission(Task.new(:id => 1))
|
|
180
179
|
def remote.add_owner_local(trsc)
|
|
181
180
|
trsc = local_peer.local_object(trsc)
|
|
182
181
|
trsc.add_owner local_peer
|
|
@@ -207,34 +206,34 @@ class TC_DistributedTransaction < Test::Unit::TestCase
|
|
|
207
206
|
trsc.self_owned = false
|
|
208
207
|
|
|
209
208
|
task = Task.new
|
|
210
|
-
assert_raises(OwnershipError) { t_task.
|
|
211
|
-
assert_raises(OwnershipError) { task.
|
|
212
|
-
assert_raises(OwnershipError) { task.event(:start).
|
|
209
|
+
assert_raises(OwnershipError) { t_task.depends_on task }
|
|
210
|
+
assert_raises(OwnershipError) { task.depends_on t_task }
|
|
211
|
+
assert_raises(OwnershipError) { task.event(:start).signals t_task.event(:start) }
|
|
213
212
|
assert_raises(OwnershipError) { trsc.discard_transaction }
|
|
214
213
|
assert_raises(OwnershipError) { trsc.commit_transaction }
|
|
215
214
|
assert(! task.plan)
|
|
216
|
-
|
|
215
|
+
t_task.signals(:start, task, :start)
|
|
217
216
|
|
|
218
217
|
remote.add_owner_local(Distributed.format(trsc))
|
|
219
218
|
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
219
|
+
t_task.depends_on task
|
|
220
|
+
t_task.remove_child task
|
|
221
|
+
t_task.event(:start).remove_signal task.event(:start)
|
|
222
|
+
task.depends_on t_task
|
|
223
|
+
task.signals(:start, t_task, :start)
|
|
225
224
|
assert_raises(OwnershipError) { trsc.remove_owner remote_peer }
|
|
226
225
|
assert_raises(OwnershipError) { trsc.self_owned = false }
|
|
227
|
-
|
|
226
|
+
trsc.discard_transaction
|
|
228
227
|
end
|
|
229
228
|
|
|
230
229
|
def test_executed_by
|
|
231
|
-
peer2peer
|
|
230
|
+
peer2peer do |remote|
|
|
232
231
|
task = Task.new(:id => 1)
|
|
233
232
|
exec = Class.new(Task) do
|
|
234
233
|
event :ready, :command => true
|
|
235
234
|
end.new(:id => 'exec')
|
|
236
235
|
task.executed_by exec
|
|
237
|
-
remote.plan.
|
|
236
|
+
remote.plan.add_mission(task)
|
|
238
237
|
|
|
239
238
|
remote.singleton_class.class_eval do
|
|
240
239
|
include Test::Unit::Assertions
|
|
@@ -269,8 +268,8 @@ class TC_DistributedTransaction < Test::Unit::TestCase
|
|
|
269
268
|
end
|
|
270
269
|
|
|
271
270
|
def test_argument_updates
|
|
272
|
-
peer2peer
|
|
273
|
-
remote.plan.
|
|
271
|
+
peer2peer do |remote|
|
|
272
|
+
remote.plan.add_mission(ArgumentUpdateTest.new(:id => 2))
|
|
274
273
|
def remote.set_argument(task)
|
|
275
274
|
task = local_peer.local_object(task)
|
|
276
275
|
task.plan.edit
|
|
@@ -303,7 +302,7 @@ class TC_DistributedTransaction < Test::Unit::TestCase
|
|
|
303
302
|
|
|
304
303
|
# Now, add a task of our own and link the remote and the local
|
|
305
304
|
task = SimpleTask.new :id => 'local'
|
|
306
|
-
trsc.
|
|
305
|
+
trsc.add(task)
|
|
307
306
|
|
|
308
307
|
parent = subscribe_task(:id => 'remote-1')
|
|
309
308
|
child = subscribe_task(:id => 'remote-2')
|
|
@@ -318,10 +317,10 @@ class TC_DistributedTransaction < Test::Unit::TestCase
|
|
|
318
317
|
assert(task.event(:stop).read_write?)
|
|
319
318
|
|
|
320
319
|
# Add relations
|
|
321
|
-
trsc[parent].
|
|
322
|
-
task.
|
|
323
|
-
trsc[parent].event(:start).
|
|
324
|
-
task.event(:stop).
|
|
320
|
+
trsc[parent].depends_on task
|
|
321
|
+
task.depends_on trsc[child]
|
|
322
|
+
trsc[parent].event(:start).signals task.event(:start)
|
|
323
|
+
task.event(:stop).signals trsc[child].event(:stop)
|
|
325
324
|
|
|
326
325
|
[task, parent]
|
|
327
326
|
end
|
|
@@ -350,10 +349,10 @@ class TC_DistributedTransaction < Test::Unit::TestCase
|
|
|
350
349
|
end
|
|
351
350
|
|
|
352
351
|
def test_propose_commit
|
|
353
|
-
peer2peer
|
|
352
|
+
peer2peer do |remote|
|
|
354
353
|
testcase = self
|
|
355
|
-
remote.plan.
|
|
356
|
-
root.
|
|
354
|
+
remote.plan.add_mission(root = SimpleTask.new(:id => 'remote-1'))
|
|
355
|
+
root.depends_on(child = SimpleTask.new(:id => 'remote-2'))
|
|
357
356
|
|
|
358
357
|
PeerServer.class_eval do
|
|
359
358
|
include Test::Unit::Assertions
|
|
@@ -382,10 +381,10 @@ class TC_DistributedTransaction < Test::Unit::TestCase
|
|
|
382
381
|
end
|
|
383
382
|
|
|
384
383
|
def test_synchronization
|
|
385
|
-
peer2peer
|
|
384
|
+
peer2peer do |remote|
|
|
386
385
|
testcase = self
|
|
387
|
-
remote.plan.
|
|
388
|
-
root.
|
|
386
|
+
remote.plan.add_mission(root = SimpleTask.new(:id => 'remote-1'))
|
|
387
|
+
root.depends_on SimpleTask.new(:id => 'remote-2')
|
|
389
388
|
|
|
390
389
|
PeerServer.class_eval do
|
|
391
390
|
define_method(:check_transaction) do |trsc|
|
|
@@ -411,8 +410,12 @@ class TC_DistributedTransaction < Test::Unit::TestCase
|
|
|
411
410
|
check_transaction_commit(trsc)
|
|
412
411
|
end
|
|
413
412
|
|
|
413
|
+
class RemoteTaskModel < SimpleTask
|
|
414
|
+
argument :arg
|
|
415
|
+
end
|
|
416
|
+
|
|
414
417
|
def test_create_remote_tasks
|
|
415
|
-
peer2peer
|
|
418
|
+
peer2peer do |remote|
|
|
416
419
|
def remote.arguments_of(t)
|
|
417
420
|
t = local_peer.local_object(t)
|
|
418
421
|
t.arguments
|
|
@@ -434,12 +437,12 @@ class TC_DistributedTransaction < Test::Unit::TestCase
|
|
|
434
437
|
trsc.propose(remote_peer)
|
|
435
438
|
|
|
436
439
|
local_task = SimpleTask.new(:id => 'local')
|
|
437
|
-
trsc.
|
|
440
|
+
trsc.add_mission(local_task)
|
|
438
441
|
|
|
439
|
-
t =
|
|
442
|
+
t = RemoteTaskModel.new(:arg => 10, :id => 0)
|
|
440
443
|
t.extend DistributedObject
|
|
441
|
-
local_task.
|
|
442
|
-
trsc.
|
|
444
|
+
local_task.depends_on t
|
|
445
|
+
trsc.add_mission(t)
|
|
443
446
|
t.owner = remote_peer
|
|
444
447
|
|
|
445
448
|
assert(trsc.task_index.by_owner[remote_peer].include?(t))
|