-
Notifications
You must be signed in to change notification settings - Fork 3k
Add new WiFi tests #3147
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 new WiFi tests #3147
Conversation
*/ | ||
#if TARGET_UBLOX_EVK_ODIN_W2 | ||
#include "OdinWiFiInterface.h" | ||
SingletonPtr<OdinWiFiInterface> wifi; |
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.
This is a bit concerning, SingletonPtr
was intended only for gc-optimizations internally in libraries.
We're you able to track down the exact issue that was caused by declaring this interface globally?
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.
Sort of, the greentea sync timeouts waiting for the sync, I'm guessing we're stuck in the initialization of the Odin and miss it.
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.
Oh, that's an interesting situation. @bridadan, there doesn't happen to be a test-specific configuration for delaying the sync timeout is there?
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.
Target can always sync with Greentea first and then init Odin. Time taken by Odin init can be added to the test case timeout.
WiFiInterface *get_wifi() | ||
{ | ||
#if TARGET_UBLOX_EVK_ODIN_W2 | ||
return wifi.get(); |
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.
If we do need a SingletonPtr
, perhaps we should use it consistently for all interfaces?
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.
As far as i can tell our singleton can't handle constructors with parameters. Required for ESP, sure we could change the code, but not sure it's worth it.
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.
Oh that's very interesting. Perhaps we should dynamically allocate the WiFi interfaces?
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.
Yeah we could. We could just use the ESP-style-logic there without bothering to use Singleton and just allocate odin as well.
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.
Sounds reasonable
SingletonPtr<OdinWiFiInterface> wifi; | ||
#else | ||
#if !TARGET_FF_ARDUINO | ||
#error [NOT_SUPPORTED] Only Arduino form factor devices supported |
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.
Has this become a requirement for ease of use? The esp8266 should work fine on any serial connection.
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.
It's either that or long list of pin names for platforms that are not Arduino FF.
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.
You make a good point, that wouldn't be the greatest. Could we at least have an option to provide pins that would avoid the unsupported error? It would be nice to be able to use this test with esp8266s on boards locally.
If it's too difficult, we can just modify the test directly if we need to test other boards.
A few noted questions, but looks great! excited to have some solid wifi tests. |
On hold due to #3152 |
@bulislaw Yay for more tests! This is awesome. Addressing a few of your points:
You could use an You can use
You can use the
mbed OS tests can't rely on any code that doesn't exist in the mbed-os tree. So this test should be specialized to just platforms that use the EMAC or something. It can't rely on |
/* We use singletons as some of the WiFi modules don't like to be initialized multiple times and using global objects | ||
causes greentea serial to timeout. | ||
*/ | ||
#if TARGET_UBLOX_EVK_ODIN_W2 |
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.
I'm not really crazy about having to do this for each platform that would be added to this test. Is there a more generic method planned for this? Something like WifiInterface *wifi = get_default_wifi_interface()
(syntax not important here, just that the target knows its default wifi/network interface)
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.
Yeah, we could have a 'factory' for built in wifis, but it would be basically just moving the ifdefs somewhere else. And that would only work for built in WiFi as the external modules can be connected to different pins and what not. I'm not sure how useful would that be, we can think about it.
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.
@bulislaw Yes, it'd only be useful for platforms with built-in network interfaces. This is definitely for another discussion and (series of) PRs, but I just wanted to be sure we don't get in the habit of doing this kind of thing in tests. This is the kind of thing in mbed 2 that I think we should avoid in mbed 5: https://github.com/ARMmbed/mbed-os/blob/master/features/unsupported/tests/mbed/digitalinout/main.cpp#L3
I'd rather not have our ssid/password in the github even if it's just a test network, that should be done for each CI location I guess.
I can, it's a good point I'll add it to make the error clearer, but my point is we want to actually test it in the farm, so we need a solution that would set that there for this test. Possibly we can overwrite it in mbed_app.json as well?
That's a pity, would be nice to test ESP2866 as well. |
* - WIFI_TEST_NETWORKS - List of network that presence will be asserted e.g. "net1", "net2", "net3" | ||
*/ | ||
#if !defined(WIFI_TEST_SSID) || !defined(WIFI_TEST_PASS) || !defined(WIFI_TEST_NETWORKS) | ||
#error WIFI_TEST_NETWORKS, WIFI_TEST_PASS and WIFI_TEST_NETWORKS have to be defined for this test. |
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.
I'd recommend using the #error [NOT_SUPPORTED]
macro here as well. That way it doesn't show up as a failure if the WIFI_TEST_*
defines are missing, which is up to the user/CI to provide and not the code base. This way it will just show up as a build skip.
@bulislaw Oh yeah definitely, each CI system would provide a custom
Yes, I think we should be able to use |
The tests try to: * scan for available networks and check whether specified networks are present in the results. * connect to and disconnect from the specified network. * repeats the scan tests while connected to a network. * connect to a network and perform simple HTTP query.
@bridadan @mazimkhan what do you think guys? I also added template mbed_app.json that the CIs would need to provide. |
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.
Just two little things, please see below.
* - WIFI_TEST_NETWORKS - List of network that presence will be asserted e.g. "net1", "net2", "net3" | ||
*/ | ||
#if !defined(MBED_CONF_APP_WIFI_SSID) || !defined(MBED_CONF_APP_WIFI_PASSWORD) || !defined(MBED_CONF_APP_WIFI_NETWORKS) | ||
#error MBED_CONF_APP_WIFI_SSID, MBED_CONF_APP_WIFI_PASSWORD and MBED_CONF_APP_WIFI_NETWORKS have to be defined for this test. |
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.
@bulislaw Could you please change this to a [NOT_SUPPORTED]
macro? This will show up as a build failure for anyone building these tests locally for the UBLOX_EVK_ODIN_W2. If you add the [NOT_SUPPORTED]
it'll just show up as a skip and they can continue with testing.
@@ -0,0 +1,21 @@ | |||
{ |
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.
Would you mind renaming this file to template_mbed_app.txt
? This will prevent the file from being picked up at all by the build system, but I think that having this reference is still extremely useful.
Done. |
/morph test |
Result: FAILUREYour command has finished executing! Here's what you wrote!
Outputmbed Build Number: 1052 Build failed! |
Lots of CI issues today, sorry again. Had to restart the system. Restarting now. /morph test |
Result: SUCCESSYour command has finished executing! Here's what you wrote!
Outputmbed Build Number: 1065 All builds and test passed! |
While I'm still a little uneasy bringing in a test that only works on one target at the moment (not even a feature), it's ok for now considering we don't have any other targets in the tree with this capability. We just need to be EXTREMELY careful that we don't fall into the same behavior of bringing target-specific config into each test case as we did in mbed 2, otherwise we'll end up with this kind of stuff: https://github.com/ARMmbed/mbed-os/blob/master/features/unsupported/tests/mbed/interruptin_2/main.cpp#L7 |
@0xc0170 One last review? |
One thing I was thinking to add to wifi would be a factory for 'built in' wifi modules. So instead of doing |
From above (outdated diff) :)
I definitely agree! And not just for WiFi, any Network interface (Ethernet, BLE, Mesh, etc). @bulislaw Maybe you can start an issue on GitHub about this to start the discussion? |
After a discussion with @sg-, it sounds like we may not want to bring this kind of test in without having the "get default wifi interface" function. Otherwise other WiFi targets coming in will start adding there own |
After another discussion, we will not be able to provide a forward-compatible "get default wifi interface" function for 5.3. These tests are valuable enough that we should probably go ahead and merge as a temporary solution. |
/morph test-nightly |
We were moving some of the CI machines around and the server cable got bumped, so the nightly job got stopped unfortunately. However, there's no need to run a nightly since the test will be skipped until I add the |
ping |
Description
The tests try to:
are present in the results.
Status
HOLD
Deploy notes
There are some issues to be solved for the tests to work in CI:
WIFI_TEST_NETWORKS, WIFI_TEST_PASS and WIFI_TEST_NETWORKS need to be defined. Is there a way of doing that in CIs?
For UBLOX Odin board the
DEVICE_EMAC
macro needs to be defined, but just for this test (it will break Ethernet tests)For other platforms, platform needs to be Arduino FF with ESP2866 connected to D0/D1 pins and the ESP826xx-driver need to be compiled in.
@mazimkhan @bridadan