Skip to content

Commit e116a66

Browse files
committed
WiFi test Add support for mbed_app.json
1 parent e8b55ca commit e116a66

File tree

2 files changed

+29
-9
lines changed

2 files changed

+29
-9
lines changed

TESTS/network/wifi/main.cpp

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,16 +30,15 @@ using namespace utest::v1;
3030

3131
/**
3232
* WiFi tests require following macros to be defined:
33-
* - WIFI_TEST_SSID - SSID of a network the test will try connecting to
34-
* - WIFI_TEST_PASS - Passphrase that will be used to connecting to the network
33+
* - MBED_CONF_APP_WIFI_SSID - SSID of a network the test will try connecting to
34+
* - MBED_CONF_APP_WIFI_PASSWORD - Passphrase that will be used to connecting to the network
3535
* - WIFI_TEST_NETWORKS - List of network that presence will be asserted e.g. "net1", "net2", "net3"
3636
*/
37-
#if !defined(WIFI_TEST_SSID) || !defined(WIFI_TEST_PASS) || !defined(WIFI_TEST_NETWORKS)
38-
#error WIFI_TEST_NETWORKS, WIFI_TEST_PASS and WIFI_TEST_NETWORKS have to be defined for this test.
37+
#if !defined(MBED_CONF_APP_WIFI_SSID) || !defined(MBED_CONF_APP_WIFI_PASSWORD) || !defined(MBED_CONF_APP_WIFI_NETWORKS)
38+
#error MBED_CONF_APP_WIFI_SSID, MBED_CONF_APP_WIFI_PASSWORD and MBED_CONF_APP_WIFI_NETWORKS have to be defined for this test.
3939
#endif
4040

41-
42-
const char *networks[] = {WIFI_TEST_NETWORKS, NULL};
41+
const char *networks[] = {MBED_CONF_APP_WIFI_NETWORKS, NULL};
4342

4443
WiFiInterface *wifi;
4544

@@ -101,7 +100,7 @@ void wifi_connect()
101100
{
102101
int ret;
103102

104-
ret = get_wifi()->connect(WIFI_TEST_SSID, WIFI_TEST_PASS, NSAPI_SECURITY_WPA_WPA2);
103+
ret = get_wifi()->connect(MBED_CONF_APP_WIFI_SSID, MBED_CONF_APP_WIFI_PASSWORD, NSAPI_SECURITY_WPA_WPA2);
105104
TEST_ASSERT_MESSAGE(ret == 0, "Connect failed");
106105

107106
ret = get_wifi()->disconnect();
@@ -118,7 +117,7 @@ void wifi_connect_scan()
118117

119118
memset(net_stat, 0, sizeof(net_stat));
120119

121-
ret = get_wifi()->connect(WIFI_TEST_SSID, WIFI_TEST_PASS, NSAPI_SECURITY_WPA_WPA2);
120+
ret = get_wifi()->connect(MBED_CONF_APP_WIFI_SSID, MBED_CONF_APP_WIFI_PASSWORD, NSAPI_SECURITY_WPA_WPA2);
122121
TEST_ASSERT_MESSAGE(ret == 0, "Connect failed");
123122

124123
count = get_wifi()->scan(NULL, 0);
@@ -146,7 +145,7 @@ void wifi_http()
146145
TCPSocket socket;
147146
int ret;
148147

149-
ret = get_wifi()->connect(WIFI_TEST_SSID, WIFI_TEST_PASS, NSAPI_SECURITY_WPA_WPA2);
148+
ret = get_wifi()->connect(MBED_CONF_APP_WIFI_SSID, MBED_CONF_APP_WIFI_PASSWORD, NSAPI_SECURITY_WPA_WPA2);
150149
TEST_ASSERT_MESSAGE(ret == 0, "Connect failed");
151150

152151
// Open a socket on the network interface, and create a TCP connection to www.arm.com

TESTS/network/wifi/mbed_app.json

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"config": {
3+
"wifi-ssid": {
4+
"help": "WiFi SSID",
5+
"value": "\"SSID\""
6+
},
7+
"wifi-password": {
8+
"help": "WiFi Password",
9+
"value": "\"PASS\""
10+
},
11+
"wifi-networks": {
12+
"help": "WiFi SSIDs which presence will be asserted in the test",
13+
"value": "\"SSID1\",\"SSID2\",\"SSID3\""
14+
}
15+
},
16+
"target_overrides": {
17+
"UBLOX_EVK_ODIN_W2": {
18+
"target.device_has": ["EMAC"]
19+
}
20+
}
21+
}

0 commit comments

Comments
 (0)