module Syskit::Test::Self
Module used in syskit's own test suite
Attributes
robot[R]
A RobotDefinition object that allows to create new device models easily
Public Instance Methods
assert_is_proxy_model_for(models, result)
click to toggle source
# File lib/syskit/test/self.rb, line 96 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.proxy_task_model_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
data_dir()
click to toggle source
# File lib/syskit/test/self.rb, line 18 def data_dir File.join(SYSKIT_ROOT_DIR, "test", "data") end
data_service_type(name, &block)
click to toggle source
# File lib/syskit/test/self.rb, line 127 def data_service_type(name, &block) DataService.new_submodel(:name => name, &block) end
plug_apply_requirement_modifications()
click to toggle source
# File lib/syskit/test/self.rb, line 65 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()
click to toggle source
# File lib/syskit/test/self.rb, line 74 def plug_connection_management @syskit_handler_ids[:connection_management] ||= execution_engine. add_propagation_handler(type: :propagation, late: true, &Runtime::ConnectionManagement.method(:update)) end
setup()
click to toggle source
Calls superclass method
Syskit::Test::NetworkManipulation#setup
# File lib/syskit/test/self.rb, line 22 def setup @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
teardown()
click to toggle source
Calls superclass method
Syskit::Test::NetworkManipulation#teardown
# File lib/syskit/test/self.rb, line 83 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()
click to toggle source
# File lib/syskit/test/self.rb, line 70 def unplug_apply_requirement_modifications execution_engine.remove_propagation_handler(@syskit_handler_ids.delete(:apply_requirement_modifications)) end
unplug_connection_management()
click to toggle source
# File lib/syskit/test/self.rb, line 79 def unplug_connection_management execution_engine.remove_propagation_handler(@syskit_handler_ids.delete(:connection_management)) end