From 4affb4dbc5d3b9259f4d966e6f3beae2dc3c41ab Mon Sep 17 00:00:00 2001 From: Juha Ylinen Date: Thu, 21 Jun 2018 08:55:01 +0300 Subject: [PATCH] Update Greentea netsocket and wifi tests Increase timeout for netsocket TCP and UDP tests. Old timeout (240 seconds) was not enough for slower devices to complete the tests. Accept error codes NSAPI_ERROR_CONNECTION_TIMEOUT and NSAPI_ERROR_NO_CONNECTION when running test wifi_connect_secure_fail --- TESTS/netsocket/tcp/main.cpp | 2 +- TESTS/netsocket/udp/main.cpp | 2 +- TESTS/network/wifi/wifi_connect_secure_fail.cpp | 7 +++++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/TESTS/netsocket/tcp/main.cpp b/TESTS/netsocket/tcp/main.cpp index 45157b87d9..703bf8c1d9 100644 --- a/TESTS/netsocket/tcp/main.cpp +++ b/TESTS/netsocket/tcp/main.cpp @@ -96,7 +96,7 @@ void fill_tx_buffer_ascii(char *buff, size_t len) // Test setup utest::v1::status_t greentea_setup(const size_t number_of_cases) { - GREENTEA_SETUP(240, "default_auto"); + GREENTEA_SETUP(480, "default_auto"); _ifup(); return greentea_test_setup_handler(number_of_cases); } diff --git a/TESTS/netsocket/udp/main.cpp b/TESTS/netsocket/udp/main.cpp index b9f9735161..9e171b8a04 100644 --- a/TESTS/netsocket/udp/main.cpp +++ b/TESTS/netsocket/udp/main.cpp @@ -73,7 +73,7 @@ void fill_tx_buffer_ascii(char *buff, size_t len) // Test setup utest::v1::status_t greentea_setup(const size_t number_of_cases) { - GREENTEA_SETUP(240, "default_auto"); + GREENTEA_SETUP(480, "default_auto"); _ifup(); return greentea_test_setup_handler(number_of_cases); } diff --git a/TESTS/network/wifi/wifi_connect_secure_fail.cpp b/TESTS/network/wifi/wifi_connect_secure_fail.cpp index 2c4a90ba1d..e171e2f678 100644 --- a/TESTS/network/wifi/wifi_connect_secure_fail.cpp +++ b/TESTS/network/wifi/wifi_connect_secure_fail.cpp @@ -30,8 +30,11 @@ void wifi_connect_secure_fail(void) WiFiInterface *wifi = get_interface(); TEST_ASSERT_EQUAL_INT(NSAPI_ERROR_OK, wifi->set_credentials(MBED_CONF_APP_WIFI_SECURE_SSID, "aaaaaaaa", get_security())); - - TEST_ASSERT_EQUAL_INT(NSAPI_ERROR_AUTH_FAILURE, wifi->connect()); + nsapi_error_t error; + error = wifi->connect(); + TEST_ASSERT(error == NSAPI_ERROR_AUTH_FAILURE || + error == NSAPI_ERROR_CONNECTION_TIMEOUT || + error == NSAPI_ERROR_NO_CONNECTION); } #endif // defined(MBED_CONF_APP_WIFI_SECURE_SSID)