-
Notifications
You must be signed in to change notification settings - Fork 45
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
Need tests #4
Comments
@surban we have our emulator which we extensively use for testing our kernel interfaces, for userspace we do have some unit testing but that Im afraid is limited to daemon and C tools internals, on the other hand it might be simpler to build things like D-Bus interface tests on top of rust, so we test both bluer and the daemon, once we do that we can have our CI for the daemon to pull the tests from bluer. @tedd-an might be able to assist you with setting the emulated environment, in theory you can hook up multiple virtual adapters and have then connecting to one another. |
Hi, I am interested in helping with this issue. Can we use a Linux VM with two Bluetooth controllers connected? I have setup a RFCOMM connection between a Broadcom USB controller and a Cambridge Silicon Radio USB controller on an Ubuntu server VM. |
Hi, this should be possible. Note that testing BlueR means that you will be testing BlueZ (userspace + kernel) as well, so it makes sense to build the kernel and userspace BlueZ from source for creation of the VM image. A toolkit like Buildroot might help, since it builds a disk image of a Linux system from source and can easily be tweaked to pick up the latest commits from Git. At the moment I don't have time to help with this issue, but please go ahead. Any help is appreciated. Maybe you should also contact @Vudentz; the BlueZ team already has some automated testing in place, but I am unsure if they are testing with physical adapters or emulated only. |
Thanks for the feedback. I'll first reach out to Vudentz to see if the build environment is a solved problem that I can use. If not the only build system I have any experience with is Yocto, but that was a hobby project for building Raspberry Pi images. Since you mentioned Pis, I'll use those if the BlueZ automated testing isn't a good fit. |
Is there a mailing list or discussion site for Bluer? I'm having difficultly setting up a communication test fixture between the gatt_server_io and gatt_client. When running gatt_server_io I can connect to it with the Bluepixel Technologies BLE phone app acting as a GATT client. I can read/write to gatt_server_io and trigger the notify event. However, I cannot get gatt_client to connect to gatt_server_io, although it can see the advertisements. Where would be the best place to discuss what I might be doing wrong? Thanks! |
Have you tried the troubleshooting section from the README? This is often a BlueZ caching issue. There is a Rust channel in the BlueZ slack at https://join.slack.com/t/bluezorg/shared_invite/zt-opurnyz7-QbHRp5mxxezDcQSQrHFybw |
Thanks, I'll move my troubleshooting issues to Slack. For testing I'm going to focus on the system tests, like you mentioned at the start of the issue. I plan to avoid mocking at least until I have a better understanding of the code. For the system tests I will base them on the Bluer examples. My first test will exercise the functionality of the Advertisement capabilities of module bluer::adv by using code from |
Sounds good. I have developed an RPC and remote channel library that you could use to implement the communication between the test processes. It is called Remoc and fairly stable by now; indeed we are using it in production. It can work over stdout/stdin but also any other communication channel like TCP. Thus, you could start as described and easily switch to processes running on different machines later. Ping me if you need a template to get started. We have doc-examples so far, but I understand that it might be difficult to grasp how it all fits together without a tutorial. Of course this is only a suggestion and not a requirement. |
Thanks, Remoc looks like a good communication choice. I created a repo for testing called BlueR-Test. I'll start adding to it this weekend. |
Added functionality to test advertisements with and without a service UUID. When you get a chance could you add feedback or issues so I can better understand the direction the tests should go? Right now I'm focusing on removing the manual step form the tests and adding more advertisement tests. |
This looks good, but having to coordinate the two test processes manually won't scale. I would suggest implementing a test server that listens to TCP connections (using Remoc) from a test client and performs tasks requested by the test client, such as sending a BLE advertisement. The test client would then connect to the server over TCP, query its Bluetooth address and ask it to start sending advertisements. It then verifies that the correct advertisement is received, etc. I can modify your code to such a structure, if you wish. Also I would not bother encoding the exact failure reason in the exit code. 0 for success and 1 for failure is enough. You can then output a test report (for example in JSON format using Serde or HTML) that contains the result of each test, together with detailed error information. |
Okay that makes sense for scalability, I'll start working on the server/client code communicating with Remoc. |
I split the client/server example on Remoc into separate projects. When I run the client then the server, the server crashes--unless RUST_BACKTRACE=full, then it works. I described the issue here potto216/BlueR-Test#5 and was curious as to your suggestions on what the problem might be? |
I've replied to your issue. |
Thanks for the code. I got it working and am expanding the testing of advertising data types. Should have that done in the next few weeks. |
I added issues for the next round of tests in https://github.com/potto216/BlueR-Test. Comments appreciated. |
# This is the 1st commit message: BLE Passive Scanning # This is the commit message #2: monitor # This is the commit message bluez#3: monitor # This is the commit message bluez#4: monitor # This is the commit message bluez#5: monitor # This is the commit message bluez#6: monitor # This is the commit message bluez#7: monitor # This is the commit message bluez#8: monitor # This is the commit message bluez#9: monitor # This is the commit message bluez#10: monitor # This is the commit message bluez#11: monitor # This is the commit message bluez#12: monitor # This is the commit message bluez#13: monitor # This is the commit message bluez#14: monitor # This is the commit message bluez#15: monitor # This is the commit message bluez#16: monitor # This is the commit message bluez#17: monitor # This is the commit message bluez#18: monitor # This is the commit message bluez#19: monitor # This is the commit message bluez#20: monitor # This is the commit message bluez#21: monitor # This is the commit message bluez#22: monitor # This is the commit message bluez#23: monitor # This is the commit message bluez#24: monitor # This is the commit message bluez#25: monitor # This is the commit message bluez#26: monitor # This is the commit message bluez#27: monitor # This is the commit message bluez#28: monitor # This is the commit message bluez#29: monitor # This is the commit message bluez#30: monitor # This is the commit message bluez#31: monitor # This is the commit message bluez#32: monitor # This is the commit message bluez#33: monitor # This is the commit message bluez#34: monitor # This is the commit message bluez#35: monitor # This is the commit message bluez#36: monitor # This is the commit message bluez#37: monitor # This is the commit message bluez#38: monitor # This is the commit message bluez#39: monitor # This is the commit message bluez#40: monitor # This is the commit message bluez#41: monitor # This is the commit message bluez#42: monitor # This is the commit message bluez#43: monitor # This is the commit message bluez#44: monitor # This is the commit message bluez#45: monitor # This is the commit message bluez#46: monitor # This is the commit message bluez#47: monitor # This is the commit message bluez#48: monitor # This is the commit message bluez#49: monitor # This is the commit message bluez#50: monitor # This is the commit message bluez#51: monitor # This is the commit message bluez#52: monitor # This is the commit message bluez#53: monitor # This is the commit message bluez#54: monitor # This is the commit message bluez#55: monitor # This is the commit message bluez#56: monitor # This is the commit message bluez#57: monitor # This is the commit message bluez#58: monitor # This is the commit message bluez#59: monitor # This is the commit message bluez#60: monitor # This is the commit message bluez#61: monitor # This is the commit message bluez#62: monitor
Currently there are no tests. This is bad!
However, testing is not so easy in our case. At least two systems with Bluetooth adapters are required to exercise the functionality of this crate.
Ideally, we will have a test lab with two machines (Raspberry Pi(e)s would do!) that hook into the CI process and run a test suite after each commit. The machines need to be synchronized, since one must provide a GATT server while the other is the client and vice versa, etc.
We should check if BlueZ already has some testing infrastructure in place that we could use.
The text was updated successfully, but these errors were encountered: