mirror of https://github.com/ARMmbed/mbed-os.git
WiFi test Add support for mbed_app.json
parent
e8b55cac46
commit
e116a66270
|
@ -30,16 +30,15 @@ using namespace utest::v1;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* WiFi tests require following macros to be defined:
|
* WiFi tests require following macros to be defined:
|
||||||
* - WIFI_TEST_SSID - SSID of a network the test will try connecting to
|
* - MBED_CONF_APP_WIFI_SSID - SSID of a network the test will try connecting to
|
||||||
* - WIFI_TEST_PASS - Passphrase that will be used to connecting to the network
|
* - MBED_CONF_APP_WIFI_PASSWORD - Passphrase that will be used to connecting to the network
|
||||||
* - WIFI_TEST_NETWORKS - List of network that presence will be asserted e.g. "net1", "net2", "net3"
|
* - 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)
|
#if !defined(MBED_CONF_APP_WIFI_SSID) || !defined(MBED_CONF_APP_WIFI_PASSWORD) || !defined(MBED_CONF_APP_WIFI_NETWORKS)
|
||||||
#error WIFI_TEST_NETWORKS, WIFI_TEST_PASS and WIFI_TEST_NETWORKS have to be defined for this test.
|
#error MBED_CONF_APP_WIFI_SSID, MBED_CONF_APP_WIFI_PASSWORD and MBED_CONF_APP_WIFI_NETWORKS have to be defined for this test.
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
const char *networks[] = {MBED_CONF_APP_WIFI_NETWORKS, NULL};
|
||||||
const char *networks[] = {WIFI_TEST_NETWORKS, NULL};
|
|
||||||
|
|
||||||
WiFiInterface *wifi;
|
WiFiInterface *wifi;
|
||||||
|
|
||||||
|
@ -101,7 +100,7 @@ void wifi_connect()
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ret = get_wifi()->connect(WIFI_TEST_SSID, WIFI_TEST_PASS, NSAPI_SECURITY_WPA_WPA2);
|
ret = get_wifi()->connect(MBED_CONF_APP_WIFI_SSID, MBED_CONF_APP_WIFI_PASSWORD, NSAPI_SECURITY_WPA_WPA2);
|
||||||
TEST_ASSERT_MESSAGE(ret == 0, "Connect failed");
|
TEST_ASSERT_MESSAGE(ret == 0, "Connect failed");
|
||||||
|
|
||||||
ret = get_wifi()->disconnect();
|
ret = get_wifi()->disconnect();
|
||||||
|
@ -118,7 +117,7 @@ void wifi_connect_scan()
|
||||||
|
|
||||||
memset(net_stat, 0, sizeof(net_stat));
|
memset(net_stat, 0, sizeof(net_stat));
|
||||||
|
|
||||||
ret = get_wifi()->connect(WIFI_TEST_SSID, WIFI_TEST_PASS, NSAPI_SECURITY_WPA_WPA2);
|
ret = get_wifi()->connect(MBED_CONF_APP_WIFI_SSID, MBED_CONF_APP_WIFI_PASSWORD, NSAPI_SECURITY_WPA_WPA2);
|
||||||
TEST_ASSERT_MESSAGE(ret == 0, "Connect failed");
|
TEST_ASSERT_MESSAGE(ret == 0, "Connect failed");
|
||||||
|
|
||||||
count = get_wifi()->scan(NULL, 0);
|
count = get_wifi()->scan(NULL, 0);
|
||||||
|
@ -146,7 +145,7 @@ void wifi_http()
|
||||||
TCPSocket socket;
|
TCPSocket socket;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ret = get_wifi()->connect(WIFI_TEST_SSID, WIFI_TEST_PASS, NSAPI_SECURITY_WPA_WPA2);
|
ret = get_wifi()->connect(MBED_CONF_APP_WIFI_SSID, MBED_CONF_APP_WIFI_PASSWORD, NSAPI_SECURITY_WPA_WPA2);
|
||||||
TEST_ASSERT_MESSAGE(ret == 0, "Connect failed");
|
TEST_ASSERT_MESSAGE(ret == 0, "Connect failed");
|
||||||
|
|
||||||
// Open a socket on the network interface, and create a TCP connection to www.arm.com
|
// Open a socket on the network interface, and create a TCP connection to www.arm.com
|
||||||
|
|
|
@ -0,0 +1,21 @@
|
||||||
|
{
|
||||||
|
"config": {
|
||||||
|
"wifi-ssid": {
|
||||||
|
"help": "WiFi SSID",
|
||||||
|
"value": "\"SSID\""
|
||||||
|
},
|
||||||
|
"wifi-password": {
|
||||||
|
"help": "WiFi Password",
|
||||||
|
"value": "\"PASS\""
|
||||||
|
},
|
||||||
|
"wifi-networks": {
|
||||||
|
"help": "WiFi SSIDs which presence will be asserted in the test",
|
||||||
|
"value": "\"SSID1\",\"SSID2\",\"SSID3\""
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"target_overrides": {
|
||||||
|
"UBLOX_EVK_ODIN_W2": {
|
||||||
|
"target.device_has": ["EMAC"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue