Skip to content

Commit

Permalink
Greentea tests: user-configurable timeouts
Browse files Browse the repository at this point in the history
Now it is enough to add:
    "macros": [
        "MBED_GREENTEA_TEST_XXXSOCKET_TIMEOUT_S=20"
    ],
to mbed_app.json, where XXX is on of {DNS, TLS, UDP, TCP}.
Also network-* tests are now configurable: network-interface, network-wifi, network-emac with a similar macro.
  • Loading branch information
michalpasztamobica committed Feb 15, 2019
1 parent f2abdcb commit ca57bdd
Show file tree
Hide file tree
Showing 8 changed files with 35 additions and 2 deletions.
8 changes: 8 additions & 0 deletions TESTS/netsocket/dns/dns_tests.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,14 @@ void hostbyname_cb(void *data, nsapi_error_t result, SocketAddress *address);
void do_asynchronous_gethostbyname(const char hosts[][DNS_TEST_HOST_LEN], unsigned int op_count, int *exp_ok, int *exp_no_mem, int *exp_dns_failure, int *exp_timeout);
void do_gethostbyname(const char hosts[][DNS_TEST_HOST_LEN], unsigned int op_count, int *exp_ok, int *exp_no_mem, int *exp_dns_failure, int *exp_timeout);

namespace dns_global {
#ifdef MBED_GREENTEA_TEST_DNSSOCKET_TIMEOUT_S
static const int TESTS_TIMEOUT = MBED_GREENTEA_TEST_DNSSOCKET_TIMEOUT_S;
#else
static const int TESTS_TIMEOUT = 10 * 60;
#endif
}

/*
* Test cases
*/
Expand Down
2 changes: 1 addition & 1 deletion TESTS/netsocket/dns/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ static void net_bringdown()
// Test setup
utest::v1::status_t test_setup(const size_t number_of_cases)
{
GREENTEA_SETUP(10 * 60, "default_auto");
GREENTEA_SETUP(dns_global::TESTS_TIMEOUT, "default_auto");
net_bringup();
return verbose_test_setup_handler(number_of_cases);
}
Expand Down
4 changes: 4 additions & 0 deletions TESTS/netsocket/tcp/tcp_tests.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,11 @@ int fetch_stats(void);
int split2half_rmng_tcp_test_time(); // [s]

namespace tcp_global {
#ifdef MBED_GREENTEA_TEST_TCPSOCKET_TIMEOUT_S
static const int TESTS_TIMEOUT = MBED_GREENTEA_TEST_TCPSOCKET_TIMEOUT_S;
#else
static const int TESTS_TIMEOUT = (10 * 60);
#endif
static const int TCP_OS_STACK_SIZE = 2048;

static const int RX_BUFF_SIZE = 1220;
Expand Down
4 changes: 4 additions & 0 deletions TESTS/netsocket/tls/tls_tests.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,11 @@ int fetch_stats(void);
int split2half_rmng_tls_test_time(); // [s]

namespace tls_global {
#ifdef MBED_GREENTEA_TEST_TLSSOCKET_TIMEOUT_S
static const int TESTS_TIMEOUT = MBED_GREENTEA_TEST_TLSSOCKET_TIMEOUT_S;
#else
static const int TESTS_TIMEOUT = (10 * 60);
#endif
static const int TLS_OS_STACK_SIZE = 2048;

static const int RX_BUFF_SIZE = 1220;
Expand Down
4 changes: 4 additions & 0 deletions TESTS/netsocket/udp/udp_tests.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,11 @@ int fetch_stats(void);
int split2half_rmng_udp_test_time(); // [s]

namespace udp_global {
#ifdef MBED_GREENTEA_TEST_UDPSOCKET_TIMEOUT_S
static const int TESTS_TIMEOUT = MBED_GREENTEA_TEST_UDPSOCKET_TIMEOUT_S;
#else
static const int TESTS_TIMEOUT = 480;
#endif
}

/*
Expand Down
7 changes: 6 additions & 1 deletion TESTS/network/emac/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,13 @@ using namespace utest::v1;
utest::v1::status_t test_setup(const size_t number_of_cases)
{
#if !MBED_CONF_APP_ECHO_SERVER
#ifdef MBED_GREENTEA_TEST_EMAC_TIMEOUT_S
GREENTEA_SETUP(MBED_GREENTEA_TEST_EMAC_TIMEOUT_S, "default_auto");
#else
GREENTEA_SETUP(1400, "default_auto");
#endif
#endif // #ifdef MBED_GREENTEA_TEST_EMAC_TIMEOUT_S
#endif // #if !MBED_CONF_APP_ECHO_SERVER

return verbose_test_setup_handler(number_of_cases);
}

Expand Down
4 changes: 4 additions & 0 deletions TESTS/network/interface/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,11 @@ using namespace utest::v1;
// Test setup
utest::v1::status_t test_setup(const size_t number_of_cases)
{
#ifdef MBED_GREENTEA_TEST_INTERFACE_TIMEOUT_S
GREENTEA_SETUP(MBED_GREENTEA_TEST_INTERFACE_TIMEOUT_S, "default_auto");
#else
GREENTEA_SETUP(480, "default_auto");
#endif
return verbose_test_setup_handler(number_of_cases);
}

Expand Down
4 changes: 4 additions & 0 deletions TESTS/network/wifi/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,11 @@ using namespace utest::v1;

utest::v1::status_t test_setup(const size_t number_of_cases)
{
#ifdef MBED_GREENTEA_TEST_WIFI_TIMEOUT_S
GREENTEA_SETUP(MBED_GREENTEA_TEST_WIFI_TIMEOUT_S, "default_auto");
#else
GREENTEA_SETUP(360, "default_auto");
#endif
return verbose_test_setup_handler(number_of_cases);
}

Expand Down

0 comments on commit ca57bdd

Please sign in to comment.