diff --git a/TESTS/network/wifi/get_interface.cpp b/TESTS/network/wifi/get_interface.cpp index 9bafab9b58..a2a21a5018 100644 --- a/TESTS/network/wifi/get_interface.cpp +++ b/TESTS/network/wifi/get_interface.cpp @@ -20,7 +20,7 @@ // Pick the correct driver based on mbed_app.json #define INTERNAL 1 #define WIFI_ESP8266 2 -#define X_NUCLEO_IDW01M1 3 +#define X_NUCLEO_IDW0XX1 3 #if MBED_CONF_APP_WIFI_DRIVER == INTERNAL @@ -39,7 +39,7 @@ #include "ESP8266Interface.h" #define DRIVER ESP8266Interface -#elif MBED_CONF_APP_WIFI_DRIVER == X_NUCLEO_IDW01M1 +#elif MBED_CONF_APP_WIFI_DRIVER == X_NUCLEO_IDW0XX1 #include "SpwfSAInterface.h" #define DRIVER SpwfSAInterface #else diff --git a/TESTS/network/wifi/main.cpp b/TESTS/network/wifi/main.cpp index 1245b11e2d..a5a0163533 100644 --- a/TESTS/network/wifi/main.cpp +++ b/TESTS/network/wifi/main.cpp @@ -22,19 +22,31 @@ #include "wifi_tests.h" // Test for parameters +#if defined(MBED_CONF_APP_WIFI_SECURE_SSID) #if !defined(MBED_CONF_APP_AP_MAC_SECURE) || \ - !defined(MBED_CONF_APP_AP_MAC_UNSECURE) || \ !defined(MBED_CONF_APP_MAX_SCAN_SIZE) || \ !defined(MBED_CONF_APP_WIFI_CH_SECURE) || \ - !defined(MBED_CONF_APP_WIFI_CH_UNSECURE) || \ !defined(MBED_CONF_APP_WIFI_DRIVER) || \ !defined(MBED_CONF_APP_WIFI_PASSWORD) || \ !defined(MBED_CONF_APP_WIFI_RX) || \ !defined(MBED_CONF_APP_WIFI_SECURE_SSID) || \ + !defined(MBED_CONF_APP_WIFI_TX) +#error [NOT_SUPPORTED] Requires parameters from mbed_app.json (for secure connections) +#endif +#endif // defined(MBED_CONF_APP_WIFI_SECURE_SSID) + +#if defined(MBED_CONF_APP_WIFI_UNSECURE_SSID) +#if !defined(MBED_CONF_APP_AP_MAC_UNSECURE) || \ + !defined(MBED_CONF_APP_MAX_SCAN_SIZE) || \ + !defined(MBED_CONF_APP_WIFI_CH_UNSECURE) || \ + !defined(MBED_CONF_APP_WIFI_DRIVER) || \ + !defined(MBED_CONF_APP_WIFI_PASSWORD) || \ + !defined(MBED_CONF_APP_WIFI_RX) || \ !defined(MBED_CONF_APP_WIFI_TX) || \ !defined(MBED_CONF_APP_WIFI_UNSECURE_SSID) -#error [NOT_SUPPORTED] Requires parameters from mbed_app.json +#error [NOT_SUPPORTED] Requires parameters from mbed_app.json (for unsecure connections) #endif +#endif // defined(MBED_CONF_APP_WIFI_UNSECURE_SSID) using namespace utest::v1; @@ -48,19 +60,33 @@ Case cases[] = { Case("WIFI-CONSTRUCTOR", wifi_constructor), Case("WIFI-SET-CREDENTIAL", wifi_set_credential), Case("WIFI-SET-CHANNEL", wifi_set_channel), +#if defined(MBED_CONF_APP_WIFI_UNSECURE_SSID) Case("WIFI-GET-RSSI", wifi_get_rssi), +#endif Case("WIFI-CONNECT-PARAMS-NULL", wifi_connect_params_null), +#if defined(MBED_CONF_APP_WIFI_UNSECURE_SSID) Case("WIFI-CONNECT-PARAMS-VALID-UNSECURE", wifi_connect_params_valid_unsecure), +#endif +#if defined(MBED_CONF_APP_WIFI_SECURE_SSID) Case("WIFI-CONNECT-PARAMS-VALID-SECURE", wifi_connect_params_valid_secure), Case("WIFI-CONNECT-PARAMS-CHANNEL", wifi_connect_params_channel), Case("WIFI-CONNECT-PARAMS-CHANNEL-FAIL", wifi_connect_params_channel_fail), +#endif Case("WIFI-CONNECT-NOCREDENTIALS", wifi_connect_nocredentials), +#if defined(MBED_CONF_APP_WIFI_UNSECURE_SSID) Case("WIFI-CONNECT", wifi_connect), +#endif +#if defined(MBED_CONF_APP_WIFI_SECURE_SSID) Case("WIFI-CONNECT-SECURE", wifi_connect_secure), Case("WIFI-CONNECT-SECURE-FAIL", wifi_connect_secure_fail), +#endif +#if defined(MBED_CONF_APP_WIFI_UNSECURE_SSID) Case("WIFI-CONNECT-DISCONNECT-REPEAT", wifi_connect_disconnect_repeat), +#endif Case("WIFI-SCAN-NULL", wifi_scan_null), +#if defined(MBED_CONF_APP_WIFI_SECURE_SSID) && defined(MBED_CONF_APP_WIFI_UNSECURE_SSID) Case("WIFI-SCAN", wifi_scan), +#endif }; Specification specification(test_setup, cases); diff --git a/TESTS/network/wifi/template_mbed_app.txt b/TESTS/network/wifi/template_mbed_app.txt index ddab934545..e77b682683 100644 --- a/TESTS/network/wifi/template_mbed_app.txt +++ b/TESTS/network/wifi/template_mbed_app.txt @@ -21,7 +21,7 @@ "value": 2 }, "wifi-driver": { - "help": "Wifi driver to use, valid values are INTERNAL, WIFI_ESP8266 and X_NUCLEO_IDW01M1", + "help": "Wifi driver to use, valid values are INTERNAL, WIFI_ESP8266 and X_NUCLEO_IDW0XX1", "value": "INTERNAL" }, "wifi-tx": { diff --git a/TESTS/network/wifi/wifi_connect.cpp b/TESTS/network/wifi/wifi_connect.cpp index c244e0247f..6d27988838 100644 --- a/TESTS/network/wifi/wifi_connect.cpp +++ b/TESTS/network/wifi/wifi_connect.cpp @@ -23,6 +23,8 @@ using namespace utest::v1; +#if defined(MBED_CONF_APP_WIFI_UNSECURE_SSID) + void wifi_connect(void) { WiFiInterface *wifi = get_interface(); @@ -31,3 +33,5 @@ void wifi_connect(void) TEST_ASSERT_EQUAL_INT(NSAPI_ERROR_OK, wifi->connect()); } + +#endif // defined(MBED_CONF_APP_WIFI_UNSECURE_SSID) diff --git a/TESTS/network/wifi/wifi_connect_disconnect_repeat.cpp b/TESTS/network/wifi/wifi_connect_disconnect_repeat.cpp index 9ee73fc558..90f4c5994b 100644 --- a/TESTS/network/wifi/wifi_connect_disconnect_repeat.cpp +++ b/TESTS/network/wifi/wifi_connect_disconnect_repeat.cpp @@ -23,6 +23,8 @@ using namespace utest::v1; +#if defined(MBED_CONF_APP_WIFI_UNSECURE_SSID) + void wifi_connect_disconnect_repeat(void) { WiFiInterface *wifi = get_interface(); @@ -38,3 +40,5 @@ void wifi_connect_disconnect_repeat(void) TEST_ASSERT(error == NSAPI_ERROR_OK); } } + +#endif // defined(MBED_CONF_APP_WIFI_UNSECURE_SSID) diff --git a/TESTS/network/wifi/wifi_connect_params_channel.cpp b/TESTS/network/wifi/wifi_connect_params_channel.cpp index 08c34a9c54..4289653976 100644 --- a/TESTS/network/wifi/wifi_connect_params_channel.cpp +++ b/TESTS/network/wifi/wifi_connect_params_channel.cpp @@ -23,6 +23,8 @@ using namespace utest::v1; +#if defined(MBED_CONF_APP_WIFI_SECURE_SSID) + void wifi_connect_params_channel(void) { WiFiInterface *wifi = get_interface(); @@ -36,3 +38,4 @@ void wifi_connect_params_channel(void) TEST_ASSERT_EQUAL(NSAPI_ERROR_OK, error); } +#endif // defined(MBED_CONF_APP_WIFI_SECURE_SSID) diff --git a/TESTS/network/wifi/wifi_connect_params_channel_fail.cpp b/TESTS/network/wifi/wifi_connect_params_channel_fail.cpp index f1d56d2249..15cfa74fa9 100644 --- a/TESTS/network/wifi/wifi_connect_params_channel_fail.cpp +++ b/TESTS/network/wifi/wifi_connect_params_channel_fail.cpp @@ -23,6 +23,8 @@ using namespace utest::v1; +#if defined(MBED_CONF_APP_WIFI_SECURE_SSID) + void wifi_connect_params_channel_fail(void) { WiFiInterface *wifi = get_interface(); @@ -32,7 +34,8 @@ void wifi_connect_params_channel_fail(void) return; } - nsapi_error_t error = wifi->connect(MBED_CONF_APP_WIFI_SECURE_SSID, MBED_CONF_APP_WIFI_PASSWORD, NSAPI_SECURITY_WPA2, MBED_CONF_APP_WIFI_CH_UNSECURE); + nsapi_error_t error = wifi->connect(MBED_CONF_APP_WIFI_SECURE_SSID, MBED_CONF_APP_WIFI_PASSWORD, NSAPI_SECURITY_WPA2, MBED_CONF_APP_WIFI_CH_SECURE); TEST_ASSERT(error==NSAPI_ERROR_CONNECTION_TIMEOUT || error==NSAPI_ERROR_NO_CONNECTION); } +#endif // defined(MBED_CONF_APP_WIFI_SECURE_SSID) diff --git a/TESTS/network/wifi/wifi_connect_params_valid_secure.cpp b/TESTS/network/wifi/wifi_connect_params_valid_secure.cpp index 0da25c6792..6e522648d0 100644 --- a/TESTS/network/wifi/wifi_connect_params_valid_secure.cpp +++ b/TESTS/network/wifi/wifi_connect_params_valid_secure.cpp @@ -23,8 +23,12 @@ using namespace utest::v1; +#if defined(MBED_CONF_APP_WIFI_SECURE_SSID) + void wifi_connect_params_valid_secure(void) { WiFiInterface *wifi = get_interface(); TEST_ASSERT_EQUAL_INT(NSAPI_ERROR_OK, wifi->connect(MBED_CONF_APP_WIFI_SECURE_SSID, MBED_CONF_APP_WIFI_PASSWORD, NSAPI_SECURITY_WPA2)); } + +#endif // defined(MBED_CONF_APP_WIFI_SECURE_SSID) diff --git a/TESTS/network/wifi/wifi_connect_params_valid_unsecure.cpp b/TESTS/network/wifi/wifi_connect_params_valid_unsecure.cpp index e1540b24a8..91d8f144ea 100644 --- a/TESTS/network/wifi/wifi_connect_params_valid_unsecure.cpp +++ b/TESTS/network/wifi/wifi_connect_params_valid_unsecure.cpp @@ -23,9 +23,12 @@ using namespace utest::v1; +#if defined(MBED_CONF_APP_WIFI_UNSECURE_SSID) + void wifi_connect_params_valid_unsecure(void) { WiFiInterface *wifi = get_interface(); TEST_ASSERT_EQUAL_INT(NSAPI_ERROR_OK, wifi->connect(MBED_CONF_APP_WIFI_UNSECURE_SSID, NULL)); } +#endif // defined(MBED_CONF_APP_WIFI_UNSECURE_SSID) diff --git a/TESTS/network/wifi/wifi_connect_secure.cpp b/TESTS/network/wifi/wifi_connect_secure.cpp index dce86f969f..ca12832b9a 100644 --- a/TESTS/network/wifi/wifi_connect_secure.cpp +++ b/TESTS/network/wifi/wifi_connect_secure.cpp @@ -23,6 +23,8 @@ using namespace utest::v1; +#if defined(MBED_CONF_APP_WIFI_SECURE_SSID) + void wifi_connect_secure(void) { WiFiInterface *wifi = get_interface(); @@ -32,3 +34,4 @@ void wifi_connect_secure(void) TEST_ASSERT_EQUAL_INT(NSAPI_ERROR_OK, wifi->connect()); } +#endif // defined(MBED_CONF_APP_WIFI_SECURE_SSID) diff --git a/TESTS/network/wifi/wifi_connect_secure_fail.cpp b/TESTS/network/wifi/wifi_connect_secure_fail.cpp index 7e55a290a8..89ce6735d2 100644 --- a/TESTS/network/wifi/wifi_connect_secure_fail.cpp +++ b/TESTS/network/wifi/wifi_connect_secure_fail.cpp @@ -23,6 +23,8 @@ using namespace utest::v1; +#if defined(MBED_CONF_APP_WIFI_SECURE_SSID) + void wifi_connect_secure_fail(void) { WiFiInterface *wifi = get_interface(); @@ -32,3 +34,4 @@ void wifi_connect_secure_fail(void) TEST_ASSERT_EQUAL_INT(NSAPI_ERROR_AUTH_FAILURE, wifi->connect()); } +#endif // defined(MBED_CONF_APP_WIFI_SECURE_SSID) diff --git a/TESTS/network/wifi/wifi_get_rssi.cpp b/TESTS/network/wifi/wifi_get_rssi.cpp index ac4338ff93..adbc02efdc 100644 --- a/TESTS/network/wifi/wifi_get_rssi.cpp +++ b/TESTS/network/wifi/wifi_get_rssi.cpp @@ -23,6 +23,8 @@ using namespace utest::v1; +#if defined(MBED_CONF_APP_WIFI_UNSECURE_SSID) + void wifi_get_rssi(void) { WiFiInterface *wifi = get_interface(); @@ -36,3 +38,4 @@ void wifi_get_rssi(void) TEST_ASSERT_INT8_WITHIN(-35, -65, wifi->get_rssi()); // -30 ... -100 } +#endif // defined(MBED_CONF_APP_WIFI_UNSECURE_SSID) diff --git a/TESTS/network/wifi/wifi_scan.cpp b/TESTS/network/wifi/wifi_scan.cpp index d4722dd0d0..185b70e813 100644 --- a/TESTS/network/wifi/wifi_scan.cpp +++ b/TESTS/network/wifi/wifi_scan.cpp @@ -24,6 +24,8 @@ using namespace utest::v1; +#if defined(MBED_CONF_APP_WIFI_SECURE_SSID) && defined(MBED_CONF_APP_WIFI_UNSECURE_SSID) + void wifi_scan(void) { WiFiInterface *wifi = get_interface(); @@ -65,3 +67,4 @@ void wifi_scan(void) TEST_ASSERT_TRUE(unsecure_found); } +#endif // defined(MBED_CONF_APP_WIFI_SECURE_SSID) && defined(MBED_CONF_APP_WIFI_UNSECURE_SSID)