Module: Syskit::Test::Self
Overview
Module used in syskit's own test suite
Defined Under Namespace
Modules: ClassExtension
Instance Attribute Summary collapse
-
#robot ⇒ Object
readonly
A RobotDefinition object that allows to create new device models easily.
Instance Method Summary
collapse
#__syskit_root_components, #normalize_instanciation_models, #resolve_orocos_writer, #syskit_configure, #syskit_configure_and_start, #syskit_default_stub_name, #syskit_deploy, #syskit_deploy_and_configure, #syskit_deploy_configure_and_start, #syskit_engine_resolve_handle_plan_export, #syskit_export_to_svg, #syskit_generate_network, #syskit_guard_against_configure, #syskit_guard_against_start_and_configure, #syskit_prepare_configure, #syskit_prepare_start, #syskit_protect_configuration_manager, #syskit_start, #syskit_start_all_execution_agents, #syskit_start_execution_agents, #syskit_stub, #syskit_stub_and_deploy, #syskit_stub_attached_device, #syskit_stub_com_bus, #syskit_stub_component, #syskit_stub_composition_requirements, #syskit_stub_conf, #syskit_stub_configured_deployment, #syskit_stub_deploy_and_configure, #syskit_stub_deploy_configure_and_start, #syskit_stub_deployment, #syskit_stub_deployment_model, #syskit_stub_device, #syskit_stub_driver_model_for, #syskit_stub_model_id, #syskit_stub_network, #syskit_stub_network_abstract_component, #syskit_stub_network_deployment, #syskit_stub_placeholder, #syskit_stub_required_devices, #syskit_stub_requirements, #syskit_stub_resolves_remote_tasks=, #syskit_stub_resolves_remote_tasks?, #syskit_stub_task_context_model, #syskit_stub_task_context_requirements, #syskit_wait_ready, #syskit_write, #use_deployment, #use_ruby_tasks, #use_unmanaged_task
Methods included from Base
#assert_has_no_new_sample, #assert_has_one_new_sample, #plug_requirement_modifications, #stub_type, #unplug_requirement_modifications
Instance Attribute Details
A RobotDefinition object that allows to create new device models easily
16
17
18
|
# File 'lib/syskit/test/self.rb', line 16
def robot
@robot
end
|
Instance Method Details
#assert_is_proxy_model_for(models, result) ⇒ Object
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
|
# File 'lib/syskit/test/self.rb', line 112
def assert_is_proxy_model_for(models, result)
srv = nil
proxied_models = Array(models).map do |m|
if m.kind_of?(Syskit::Models::BoundDataService)
srv = m
m.component_model
else m
end
end
expected = Syskit::Models::Placeholder.for(proxied_models)
if srv
expected = srv.attach(expected)
end
assert_equal expected, result, "#{result} was expected to be a proxy model for #{models} (#{expected})"
end
|
18
19
20
|
# File 'lib/syskit/test/self.rb', line 18
def data_dir
File.join(SYSKIT_ROOT_DIR, "test", "data")
end
|
#data_service_type(name, &block) ⇒ Object
143
144
145
|
# File 'lib/syskit/test/self.rb', line 143
def data_service_type(name, &block)
DataService.new_submodel(:name => name, &block)
end
|
#plug_apply_requirement_modifications ⇒ Object
81
82
83
84
85
|
# File 'lib/syskit/test/self.rb', line 81
def plug_apply_requirement_modifications
@syskit_handler_ids[:apply_requirement_modifications] ||= execution_engine.
add_propagation_handler(type: :propagation, late: true,
&Runtime.method(:apply_requirement_modifications))
end
|
#plug_connection_management ⇒ Object
90
91
92
93
94
|
# File 'lib/syskit/test/self.rb', line 90
def plug_connection_management
@syskit_handler_ids[:connection_management] ||= execution_engine.
add_propagation_handler(type: :propagation, late: true,
&Runtime::ConnectionManagement.method(:update))
end
|
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
|
# File 'lib/syskit/test/self.rb', line 22
def setup
Syskit.conf.define_default_process_managers = false
if ENV['TEST_ENABLE_COVERAGE'] == '1'
null_io = File.open('/dev/null', 'w')
current_formatter = Syskit.logger.formatter
Syskit.warn "running tests with logger in DEBUG mode"
Syskit.logger = Logger.new(null_io)
Syskit.logger.level = Logger::DEBUG
Syskit.logger.formatter = current_formatter
else
Syskit.warn "running tests with logger in FATAL mode"
Syskit.logger.level = Logger::FATAL + 1
end
@old_pkg_config = ENV['PKG_CONFIG_PATH'].dup
Roby.app.app_dir = nil
Roby.app.search_path.clear
Roby.app.filter_backtraces = false
ENV['ROBY_PLUGIN_PATH'] = File.expand_path(File.join(File.dirname(__FILE__), '..', 'roby_app', 'register_plugin.rb'))
Roby.app.using 'syskit', force: true
Syskit.conf.export_types = false
Syskit.conf.disables_local_process_server = true
Syskit.conf.only_load_models = true
self.syskit_stub_resolves_remote_tasks = true
super
if !Orocos.initialized?
Orocos.allow_blocking_calls { Orocos.initialize }
end
execution_engine.scheduler = Roby::Schedulers::Temporal.new(true, true, plan)
execution_engine.scheduler.enabled = false
@robot = Syskit::Robot::RobotDefinition.new
@syskit_handler_ids = Hash.new
@syskit_handler_ids[:deployment_states] = execution_engine.
add_propagation_handler(type: :external_events,
&Runtime.method(:update_deployment_states))
@syskit_handler_ids[:task_states] = execution_engine.
add_propagation_handler(type: :external_events,
&Runtime.method(:update_task_states))
plug_connection_management
unplug_apply_requirement_modifications
if !Syskit.conf.disables_local_process_server?
Syskit::RobyApp::Plugin.connect_to_local_process_server
end
Syskit.conf.register_process_server(
'stubs', Orocos::RubyTasks::ProcessManager.new(
Roby.app.default_loader,
task_context_class: Orocos::RubyTasks::StubTaskContext), "", host_id: 'syskit')
Syskit.conf.logs.create_configuration_log(File.join(app.log_dir, 'properties'))
Orocos.forbid_blocking_calls
end
|
99
100
101
102
103
104
105
106
107
108
109
110
|
# File 'lib/syskit/test/self.rb', line 99
def teardown
Orocos.allow_blocking_calls
plug_connection_management
ENV['PKG_CONFIG_PATH'] = @old_pkg_config
super
ensure
if @syskit_handler_ids && execution_engine
Syskit::RobyApp::Plugin.unplug_engine_from_roby(@syskit_handler_ids.values, execution_engine)
end
end
|
#unplug_apply_requirement_modifications ⇒ Object
86
87
88
|
# File 'lib/syskit/test/self.rb', line 86
def unplug_apply_requirement_modifications
execution_engine.remove_propagation_handler(@syskit_handler_ids.delete(:apply_requirement_modifications))
end
|
#unplug_connection_management ⇒ Object
95
96
97
|
# File 'lib/syskit/test/self.rb', line 95
def unplug_connection_management
execution_engine.remove_propagation_handler(@syskit_handler_ids.delete(:connection_management))
end
|