Skip to content

Commit 77f4a55

Browse files
Veijo Pesonenadbridge
authored andcommitted
Greentea Wifi testcase fixes
ONME-3266 Greentea testcase WIFI-SCAN fails arbitrarily ONME-3278 Greentea testcase WIFI-SET-CREDENTIAL doesn't try WEP with valid credentials ONME-3279 Greentea testcase WIFI-GET-RSSI uses arbitrary RSSI value limits ONME-3280 Greentea testcase WIFI-CONNECT-PARAMS-VALID-SECURE assumes WPA2
1 parent 9cdeab9 commit 77f4a55

File tree

4 files changed

+30
-5
lines changed

4 files changed

+30
-5
lines changed

TESTS/network/wifi/wifi_connect_params_valid_secure.cpp

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,24 @@ using namespace utest::v1;
2828
void wifi_connect_params_valid_secure(void)
2929
{
3030
WiFiInterface *wifi = get_interface();
31-
TEST_ASSERT_EQUAL_INT(NSAPI_ERROR_OK, wifi->connect(MBED_CONF_APP_WIFI_SECURE_SSID, MBED_CONF_APP_WIFI_PASSWORD, NSAPI_SECURITY_WPA2));
31+
32+
if(wifi->connect(MBED_CONF_APP_WIFI_SECURE_SSID, MBED_CONF_APP_WIFI_PASSWORD, NSAPI_SECURITY_WPA2) == NSAPI_ERROR_OK) {
33+
TEST_PASS();
34+
}
35+
36+
if(wifi->connect(MBED_CONF_APP_WIFI_SECURE_SSID, MBED_CONF_APP_WIFI_PASSWORD, NSAPI_SECURITY_WPA_WPA2) == NSAPI_ERROR_OK) {
37+
TEST_PASS();
38+
}
39+
40+
if(wifi->connect(MBED_CONF_APP_WIFI_SECURE_SSID, MBED_CONF_APP_WIFI_PASSWORD, NSAPI_SECURITY_WPA) == NSAPI_ERROR_OK) {
41+
TEST_PASS();
42+
}
43+
44+
if(wifi->connect(MBED_CONF_APP_WIFI_SECURE_SSID, MBED_CONF_APP_WIFI_PASSWORD, NSAPI_SECURITY_WEP) == NSAPI_ERROR_OK) {
45+
TEST_PASS();
46+
}
47+
48+
TEST_FAIL();
3249
}
3350

3451
#endif // defined(MBED_CONF_APP_WIFI_SECURE_SSID)

TESTS/network/wifi/wifi_get_rssi.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ void wifi_get_rssi(void)
3535

3636
TEST_ASSERT_EQUAL_INT(NSAPI_ERROR_OK, wifi->connect());
3737

38-
TEST_ASSERT_INT8_WITHIN(-35, -65, wifi->get_rssi()); // -30 ... -100
38+
TEST_ASSERT_INT8_WITHIN(-10, -100, wifi->get_rssi());
3939
}
4040

4141
#endif // defined(MBED_CONF_APP_WIFI_UNSECURE_SSID)

TESTS/network/wifi/wifi_scan.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,7 @@ void wifi_scan(void)
5050
nsapi_security_t security = ap[i].get_security();
5151
int8_t rssi = ap[i].get_rssi();
5252
uint8_t ch = ap[i].get_channel();
53-
TEST_ASSERT_NOT_EQUAL(0, strlen(ssid));
54-
TEST_ASSERT_INT8_WITHIN(-35, -65, rssi);
53+
TEST_ASSERT_INT8_WITHIN(-10, -100, rssi);
5554
if (strcmp(MBED_CONF_APP_WIFI_SECURE_SSID, ssid) == 0) {
5655
secure_found = true;
5756
TEST_ASSERT_EQUAL_INT(NSAPI_SECURITY_WPA2, security);

TESTS/network/wifi/wifi_set_credential.cpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,12 @@ void wifi_set_credential(void)
4040
error = iface->set_credentials("OK", NULL, NSAPI_SECURITY_WPA_WPA2);
4141
TEST_ASSERT(error == NSAPI_ERROR_PARAMETER);
4242

43+
error = iface->set_credentials("OK", NULL, NSAPI_SECURITY_NONE);
44+
TEST_ASSERT(error == NSAPI_ERROR_OK);
45+
46+
error = iface->set_credentials("OK", "12345678", NSAPI_SECURITY_WEP);
47+
TEST_ASSERT((error == NSAPI_ERROR_OK) || (error == NSAPI_ERROR_UNSUPPORTED));
48+
4349
error = iface->set_credentials("OK", "12345678", NSAPI_SECURITY_WPA);
4450
TEST_ASSERT(error == NSAPI_ERROR_OK);
4551

@@ -49,6 +55,9 @@ void wifi_set_credential(void)
4955
error = iface->set_credentials("OK", "12345678", NSAPI_SECURITY_WPA_WPA2);
5056
TEST_ASSERT(error == NSAPI_ERROR_OK);
5157

52-
error = iface->set_credentials("OK", "kUjd0PHHeAqaDoyfcDDEOvbyiVbYMpUHDukGoR6EJZnO5iLzWsfwiM9JQqOngni82", NSAPI_SECURITY_WPA2);
58+
error = iface->set_credentials("OK", "kUjd0PHHeAqaDoyfcDDEOvbyiVbYMpUHDukGoR6EJZnO5iLzWsfwiM9JQqOngni", NSAPI_SECURITY_WPA2);
59+
TEST_ASSERT(error == NSAPI_ERROR_OK);
60+
61+
error = iface->set_credentials("OK", "kUjd0PHHeAqaDoyfcDDEOvbyiVbYMpUHDukGoR6EJZnO5iLzWsfwiM9JQqOngni8", NSAPI_SECURITY_WPA2);
5362
TEST_ASSERT(error == NSAPI_ERROR_PARAMETER);
5463
}

0 commit comments

Comments
 (0)