-
Notifications
You must be signed in to change notification settings - Fork 60
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
Add umockdev_testbed_wait_script(), add API to add scripts/evemu as strings #259
Conversation
That was quick. I'm not sure I will have time before Christmas, but I should find some time before this year ends. It will be fun playing with this. |
@mkemlogic No worries, please enjoy your holidays! (As am I..) There is no rush here, we can talk about it in January. |
Script replay happens in the background in a thread. This API waits for a script (or evemu events, which are translated to scripts) to finish, so that tests can synchronize them with other system events. Fixes #247
Start with the emulated device fd, it belongs together with the (purely descriptive) `device` argument.
This will make it possible to hand it scripts which are not in files.
a516910
to
1d403b0
Compare
a516910 went green, but with a retry. Doing a no-change push to re-run the tests, there could be a new flake. |
/* load it */ | ||
success = umockdev_testbed_load_evemu_events(fixture->testbed, "/dev/input/event1", tmppath, &error); | ||
success = umockdev_testbed_load_evemu_events_from_string(fixture->testbed, "/dev/input/event1", test_data, &error); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should I be able to call umockdev_testbed_load_evemu_events_from_string()
more than once?
I'm getting ERROR:../src/umockdev.vala:1086:umockdev_testbed_load_script_from_stream: assertion failed: (!this.dev_script_runner.contains (owned_dev))
I think this error was the motivation for my hack.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, you should be able to do that. I just pushed an update which asserts that this works. However, in between two load calls you have to call umockdev_testbed_wait_script()
to ensure that the previous script is finished. That will flush the script from the this.dev_script_runner
dictionary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
update which asserts that this works
I.e. I added unit tests for that, I didn't change the code. If that doesn't work for you, can you please point me to example code that fails? Thanks!
This makes it more comfortable to deal with lots of small hand-crafted scripts instead of few big records.
This avoids the temporary file.
This makes it more comfortable to deal with lots of small hand-crafted evemu events.
I'm sorry, I simply forgot about the |
@mkemlogic Cool, thank you for testing! This is a nice new feature indeed! I'll do a release in the next days. |
@mkemlogic released: https://github.com/martinpitt/umockdev/releases/tag/0.19.0 packaging for Fedora/Debian/Ubuntu in the next days. |
Fixes #247
This is mostly in a "this train ride ends here" state, but it works, and isn't too horrible. It could still use some fine-tuning, documentation, etc. @mkemlogic you weren't too happy about the names, we can do some bikeshedding 😉
What do you think?