Skip to content

Commit 8bfe577

Browse files
author
Seppo Takalo
committed
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 9ebefcd commit 8bfe577

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
@@ -58,6 +58,7 @@ utest::v1::status_t test_setup(const size_t number_of_cases) {
5858
// Test cases
5959
Case cases[] = {
6060
Case("WIFI-CONSTRUCTOR", wifi_constructor),
61+
Case("WIFI-CONNECT-NOCREDENTIALS", wifi_connect_nocredentials),
6162
Case("WIFI-SET-CREDENTIAL", wifi_set_credential),
6263
Case("WIFI-SET-CHANNEL", wifi_set_channel),
6364
#if defined(MBED_CONF_APP_WIFI_UNSECURE_SSID)
@@ -72,7 +73,6 @@ Case cases[] = {
7273
Case("WIFI-CONNECT-PARAMS-CHANNEL", wifi_connect_params_channel),
7374
Case("WIFI-CONNECT-PARAMS-CHANNEL-FAIL", wifi_connect_params_channel_fail),
7475
#endif
75-
Case("WIFI-CONNECT-NOCREDENTIALS", wifi_connect_nocredentials),
7676
#if defined(MBED_CONF_APP_WIFI_UNSECURE_SSID)
7777
Case("WIFI-CONNECT", wifi_connect),
7878
#endif

0 commit comments

Comments
 (0)