-
Notifications
You must be signed in to change notification settings - Fork 14
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
cannot read samples during task.stop! in tests #247
Comments
Mmmmmm. Not really sure why not, actually. the These readers aren't event disconnected (which is a bug, but is in the end harmless as the task's process will be terminated after the test). So, you should be able to read. Can you give more info, in the form of "test", "expected behavior", "actual behavior" ? |
Yeah, I got it wrong. After more investigation, I realized that the problem is in the second step of the hook which expects a response from the device (the test code in this case). What seems to be happening is that calling task.stop! with expect_execution disconnects the ports before I have the chance to write the response. Maybe an example will make things clearer (if what I am saying even makes sense): I expected this to call the stop hook, read a sample from the driver, and write a response: expect_execution { task.stop! }
.to { have_one_new_sample task.out_port }
expect_execution { syskit_write task.in_port, make_response }
.to { finish task } I can read the sample ( (1) execution_engine.once { task.stop! }
expect_execution
.join_all_waiting_work(false)
.to { have_one_new_sample task.out_port }
expect_execution { syskit_write task.in_port, make_response }
.to { finish task } (2) t = Thread.new { task.orocos_task.stop }
expect_execution.to { have_one_new_sample task.out_port }
expect_execution { syskit_write task.in_port, make_response }
.to { finish task }
t.join |
Probably a different issue but I also could not find a way to test the emission of an exception event during configuration. The test always fails because the "expected" start event is never emitted |
Could you start a new issue for that ? I have to look it up. The concept of configuration is not mapping very well with Roby's task state handling. Failure to configure maps to a failure to start, not as an event. |
You nailed it with Now, to be honest, I'm not entirely sure it makes that much sense. If you want synchronous behavior, you should be waiting for the end condition in the |
Definitely.
I think that makes sense, provided that I can still catch the exception events that happen in the meantime. I tried disabling
I guessed as much but what I don't get is why I have to use
Yeah, I have the same impression. |
I've done a quick test here, and I don't need the @task = syskit_deploy(
OroGen.iodrivers_base.test.PeriodicTask.deployed_as("task_under_test")
)
setup_iodrivers_base_with_fd
syskit_configure_and_start(@task)
sample = expect_execution { task.stop! }
.join_all_waiting_work(false)
.to { have_one_new_sample task.rx_port }
expect_execution { syskit_write task.tx_port, sample }
.to { emit task.stop_event } |
Also, check this out: rock-core/rock-and-syskit#61 |
Yes, I guess you are right. I probably missed that in between the myriad of stuff I was trying. So the conclusion is that there's nothing wrong with the harness, right? Except for the fact that one may have to disable the |
Also, it's not very clear to me what |
The scheduler is the object that's auto-starting tasks. In the case of Syskit, it also controls whether a component will be auto-configured. Since there's no harness-compatible All very ad-hoc. The harness definitely needs a |
👍 Feel free to close. Thanks for the insights. |
I have a stopHook that writes to an output port. Short of doing
task.orocos_task.stop
in a separate thread, didn't find any other way to get the samples in testsThe text was updated successfully, but these errors were encountered: