-
Notifications
You must be signed in to change notification settings - Fork 3k
Implement functional Wifi tests #5161
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
Conversation
TESTS/network/wifi/get_interface.cpp
Outdated
#include "mbed.h" | ||
#include "ESP8266Interface.h" | ||
|
||
WiFiInterface *get_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.
Do you think you could use the JSON files introduced in #4795 for this functionality?
The idea is that you have a JSON file describing how to instantiate the interface. That file is mapped to from some keywords. And each target has keywords it supports.
Here is an example of how the test configuration files are used in a test.
If the tests are not target specific or the interface is outside of mbed OS, then you can create a new config file outside of mbed OS and use it in the test command like. mbed test -m [mcu] -t [toolchain] --test-config path/outside/mbed
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 could, these two approaches are doing the same effect.
I can rebase this PR and take your changes once you are in master.
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.
Actually, now after review I noticed that the --test-config
overrides the --app-config
so I cannot use it.
We need app-config to deliver parameters like Wifi passwords, etc, for test cases.
4fd3a56
to
73f2c68
Compare
@SeppoTakalo Who do you think should review these besides @sarahmarshy ? @kjbracey-arm @KariHaapalehto ? |
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.
help text for "wifi-secure-ssid" and "wifi-unsecure-ssid" are same, should they specify the secure/unsecure?
Lot of compile warnings:
06:31:14 Compile [ 5.6%]: get_interface.cpp
06:31:14 [Warning] OdinWiFiInterface.h@54,0: #1300-D: ~OdinWiFiInterface inherits implicit virtual
06:31:14 Compile [ 11.1%]: main.cpp
06:31:14 [Warning] wifi_tests.h@26,0: #1-D: last line of file ends without a newline
06:31:14 Compile [ 16.7%]: wifi-constructor.cpp
06:31:14 [Warning] wifi_tests.h@26,0: #1-D: last line of file ends without a newline
06:31:14 Compile [ 22.2%]: wifi_connect.cpp
06:31:14 [Warning] wifi_tests.h@26,0: #1-D: last line of file ends without a newline
06:31:14 Compile [ 27.8%]: wifi_connect_disconnect_repeat.cpp
06:31:14 [Warning] wifi_tests.h@26,0: #1-D: last line of file ends without a newline
06:31:14 Compile [ 33.3%]: wifi_connect_nocredentials.cpp
06:31:14 [Warning] wifi_tests.h@26,0: #1-D: last line of file ends without a newline
06:31:14 Compile [ 38.9%]: wifi_connect_params_channel.cpp
06:31:14 [Warning] wifi_tests.h@26,0: #1-D: last line of file ends without a newline
06:31:14 Compile [ 44.4%]: wifi_connect_params_channel_fail.cpp
06:31:14 [Warning] wifi_tests.h@26,0: #1-D: last line of file ends without a newline
06:31:14 Compile [ 50.0%]: wifi_connect_params_null.cpp
06:31:14 [Warning] wifi_tests.h@26,0: #1-D: last line of file ends without a newline
06:31:14 Compile [ 55.6%]: wifi_connect_params_valid_secure.cpp
06:31:14 [Warning] wifi_tests.h@26,0: #1-D: last line of file ends without a newline
06:31:14 Compile [ 61.1%]: wifi_connect_params_valid_unsecure.cpp
06:31:14 [Warning] wifi_tests.h@26,0: #1-D: last line of file ends without a newline
06:31:14 Compile [ 66.7%]: wifi_connect_secure.cpp
06:31:14 [Warning] wifi_tests.h@26,0: #1-D: last line of file ends without a newline
06:31:14 Compile [ 72.2%]: wifi_connect_secure_fail.cpp
06:31:14 [Warning] wifi_tests.h@26,0: #1-D: last line of file ends without a newline
06:31:14 Compile [ 77.8%]: wifi_get_rssi.cpp
06:31:14 [Warning] wifi_tests.h@26,0: #1-D: last line of file ends without a newline
06:31:14 Compile [ 83.3%]: wifi_scan.cpp
06:31:14 [Warning] wifi_tests.h@26,0: #1-D: last line of file ends without a newline
06:31:14 Compile [ 88.9%]: wifi_scan_null.cpp
06:31:14 [Warning] wifi_tests.h@26,0: #1-D: last line of file ends without a newline
06:31:14 Compile [ 94.4%]: wifi_set_channel.cpp
06:31:14 [Warning] wifi_tests.h@26,0: #1-D: last line of file ends without a newline
06:31:14 Compile [100.0%]: wifi_set_credential.cpp
06:31:14 [Warning] wifi_tests.h@26,0: #1-D: last line of file ends without a newline
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 the proper app_config file isn't defined, the compiling of the wifi test will fail. Build shouldn't fail, it should be skipped.
@KariHaapalehto Fixed now. Looks like its building OK. |
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.
Looks ok to me
@0xc0170 These are testcases defined in our internal test plan, reviewer should be aware of those. |
TESTS/network/wifi/wifi_tests.h
Outdated
WiFiInterface *get_interface(void); | ||
|
||
/* Test cases */ | ||
void wifi_constructor(void); |
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.
To be aware, we are enabling doxygen generation for tests (#5238). It would be beneficial to have these test cases documented here
@@ -0,0 +1,26 @@ | |||
#ifndef WIFI_TESTS_H |
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 believe every file in the codebase should have license header on the top, even test files.
TESTS/network/wifi/wifi_tests.h
Outdated
void wifi_scan_null(void); | ||
void wifi_scan(void); | ||
|
||
#endif //WIFI_TESTS_H |
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.
does not this produce a warning (no new line at the end of the file) in ARMCC ? It should have or github is not showing it correctly here?
Implement 100% function coverage for WifiInterface as specified in "Wifi test plan"
Wifi connections and scanning takes long time. 2 minutes might not be enough.
Cannot include header file witin a function (without severe side effects)
638dc4d
to
80198f2
Compare
|
What about the license headers in these new files? |
Oops.. Good catch. I updated only Doxygen tags and newline error. |
restarted travis (it failed due to time limit, not certain why so restarted), who else should review @SeppoTakalo ? Ready for CI? |
I think we are good to go if Kari have reviewed. |
/morph test-nightly |
Result: SUCCESSYour command has finished executing! Here's what you wrote!
OutputAll builds and test passed! |
@SeppoTakalo, I was out of town, so I couldn't review. Does it make sense to make a PR to port these tests to use this style - #4795? We now have two ways of accomplishing the same thing. CC @theotherjimmy |
Description
Implement 100% function coverage for WifiInterface as specified
in "Wifi test plan"
Idea is to have full coverage of
WiFiInterface
API callbacks. Does not test any of the socket functionality, those will be provided later, perhaps within #4795Uses idea of separating the code which detects the interface into one singe file
get_interface.c
and its callbackget_interface()
which always gives a new initialised interface and destroys the previous one. Assumption is that destructor should clean up the driver state and constructor should bring it in sane condition. That allows us to write all test cases separately, everyone within their own file for easy maintain.Status
IN DEVELOPMENT
Verified in ESP8266, does not pass without fixing the driver.
Missing the example
mbed_app.json
and some description about the test environment.