Skip to content

Commit 39923c9

Browse files
Seppo Takaloadbridge
authored andcommitted
Remove destruction of WiFi interface in test runs
Most of our IP stacks don't allow removal of interfaces so interface destructor can not reliably clean up. Therefore we cannot rely its behaviours in test case. Instead run interface->disconnect() in case interface was already created.
1 parent b737993 commit 39923c9

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

TESTS/network/wifi/get_interface.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,10 @@ WiFiInterface *get_interface()
5050
{
5151
static WiFiInterface *interface = NULL;
5252

53-
if (interface)
54-
delete interface;
53+
if (interface) {
54+
interface->disconnect();
55+
return interface;
56+
}
5557

5658
#if MBED_CONF_APP_WIFI_DRIVER == INTERNAL
5759
interface = new DRIVER();

TESTS/network/wifi/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ utest::v1::status_t test_setup(const size_t number_of_cases) {
5959
// Test cases
6060
Case cases[] = {
6161
Case("WIFI-CONSTRUCTOR", wifi_constructor),
62+
Case("WIFI-CONNECT-NOCREDENTIALS", wifi_connect_nocredentials),
6263
Case("WIFI-SET-CREDENTIAL", wifi_set_credential),
6364
Case("WIFI-SET-CHANNEL", wifi_set_channel),
6465
#if defined(MBED_CONF_APP_WIFI_UNSECURE_SSID)
@@ -73,7 +74,6 @@ Case cases[] = {
7374
Case("WIFI-CONNECT-PARAMS-CHANNEL", wifi_connect_params_channel),
7475
Case("WIFI-CONNECT-PARAMS-CHANNEL-FAIL", wifi_connect_params_channel_fail),
7576
#endif
76-
Case("WIFI-CONNECT-NOCREDENTIALS", wifi_connect_nocredentials),
7777
#if defined(MBED_CONF_APP_WIFI_UNSECURE_SSID)
7878
Case("WIFI-CONNECT", wifi_connect),
7979
#endif

0 commit comments

Comments
 (0)