TESTS: rename variable interface to fix broken tests

pull/14697/head
Qinghao Shi 2021-05-24 19:52:51 +00:00
parent 77927d0c7a
commit 8301854be1
2 changed files with 14 additions and 14 deletions

View File

@ -56,15 +56,15 @@ void led_thread()
#endif #endif
#define MAX_RETRIES 3 #define MAX_RETRIES 3
NetworkInterface *interface = NULL; NetworkInterface *netif = NULL;
static control_t setup_network(const size_t call_count) static control_t setup_network(const size_t call_count)
{ {
interface = NetworkInterface::get_default_instance(); netif = NetworkInterface::get_default_instance();
TEST_ASSERT_NOT_NULL_MESSAGE(interface, "failed to initialize network"); TEST_ASSERT_NOT_NULL_MESSAGE(netif, "failed to initialize network");
nsapi_error_t err = -1; nsapi_error_t err = -1;
for (int tries = 0; tries < MAX_RETRIES; tries++) { for (int tries = 0; tries < MAX_RETRIES; tries++) {
err = interface->connect(); err = netif->connect();
if (err == NSAPI_ERROR_OK) { if (err == NSAPI_ERROR_OK) {
break; break;
} else { } else {
@ -78,34 +78,34 @@ static control_t setup_network(const size_t call_count)
static control_t download_128(const size_t call_count) static control_t download_128(const size_t call_count)
{ {
download_test(interface, story, sizeof(story), 128); download_test(netif, story, sizeof(story), 128);
return CaseNext; return CaseNext;
} }
static control_t download_256(const size_t call_count) static control_t download_256(const size_t call_count)
{ {
download_test(interface, story, sizeof(story), 256); download_test(netif, story, sizeof(story), 256);
return CaseNext; return CaseNext;
} }
static control_t download_1k(const size_t call_count) static control_t download_1k(const size_t call_count)
{ {
download_test(interface, story, sizeof(story), 1024); download_test(netif, story, sizeof(story), 1024);
return CaseNext; return CaseNext;
} }
static control_t download_2k(const size_t call_count) static control_t download_2k(const size_t call_count)
{ {
download_test(interface, story, sizeof(story), 2 * 1024); download_test(netif, story, sizeof(story), 2 * 1024);
return CaseNext; return CaseNext;
} }
static control_t download_4k(const size_t call_count) static control_t download_4k(const size_t call_count)
{ {
download_test(interface, story, sizeof(story), 4 * 1024); download_test(netif, story, sizeof(story), 4 * 1024);
return CaseNext; return CaseNext;
} }

View File

@ -61,16 +61,16 @@ void led_thread()
#endif #endif
#define MAX_RETRIES 3 #define MAX_RETRIES 3
NetworkInterface *interface = NULL; NetworkInterface *netif = NULL;
static control_t setup_network(const size_t call_count) static control_t setup_network(const size_t call_count)
{ {
interface = NetworkInterface::get_default_instance(); netif = NetworkInterface::get_default_instance();
TEST_ASSERT_NOT_NULL_MESSAGE(interface, "failed to initialize network"); TEST_ASSERT_NOT_NULL_MESSAGE(netif, "failed to initialize network");
nsapi_error_t err = -1; nsapi_error_t err = -1;
for (int tries = 0; tries < MAX_RETRIES; tries++) { for (int tries = 0; tries < MAX_RETRIES; tries++) {
err = interface->connect(); err = netif->connect();
if (err == NSAPI_ERROR_OK) { if (err == NSAPI_ERROR_OK) {
break; break;
} else { } else {
@ -106,7 +106,7 @@ static uint32_t thread_counter = 0;
void download_fn() void download_fn()
{ {
uint32_t thread_id = core_util_atomic_incr_u32(&thread_counter, 1); uint32_t thread_id = core_util_atomic_incr_u32(&thread_counter, 1);
download_test(interface, story, sizeof(story), 256, thread_id); download_test(netif, story, sizeof(story), 256, thread_id);
} }
void file_fn(size_t buffer) void file_fn(size_t buffer)
{ {