mirror of https://github.com/ARMmbed/mbed-os.git
Greentea netsocket and network tests improvements
Added smarter rounding of times in recv_timeout and increased the delta by one, to allow "off-by-one" errors.
Reverted commit 88eea6a, reducing TESTS_TIMEOUT back to 480.
Introduced a 100ms timeout for waiting on asynchronous DNS resolution.
Improved error handling on disconnects.
pull/8780/head
parent
d643034941
commit
e53ee631f9
|
|
@ -45,7 +45,7 @@ void ASYNCHRONOUS_DNS_NON_ASYNC_AND_ASYNC()
|
|||
TEST_ASSERT(strlen(addr.get_ip_address()) > 1);
|
||||
}
|
||||
|
||||
semaphore.wait();
|
||||
semaphore.wait(100);
|
||||
|
||||
TEST_ASSERT(data.result == NSAPI_ERROR_OK);
|
||||
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ nsapi_error_t tcpsocket_connect_to_discard_srv(TCPSocket &sock);
|
|||
int split2half_rmng_tcp_test_time(); // [s]
|
||||
|
||||
namespace tcp_global {
|
||||
static const int TESTS_TIMEOUT = 960;
|
||||
static const int TESTS_TIMEOUT = 480;
|
||||
static const int TCP_OS_STACK_SIZE = 2048;
|
||||
|
||||
static const int RX_BUFF_SIZE = 1220;
|
||||
|
|
|
|||
|
|
@ -66,8 +66,8 @@ void TCPSOCKET_RECV_TIMEOUT()
|
|||
TEST_FAIL();
|
||||
goto CLEANUP;
|
||||
}
|
||||
printf("MBED: recv() took: %dms\n", timer.read_ms());
|
||||
TEST_ASSERT_INT_WITHIN(50, 150, timer.read_ms());
|
||||
printf("MBED: recv() took: %dus\n", timer.read_us());
|
||||
TEST_ASSERT_INT_WITHIN(51, 150, (timer.read_us() + 500) / 1000);
|
||||
continue;
|
||||
} else if (recvd < 0) {
|
||||
printf("[pkt#%02d] network error %d\n", i, recvd);
|
||||
|
|
|
|||
|
|
@ -89,7 +89,8 @@ void NETWORKINTERFACE_STATUS()
|
|||
}
|
||||
TEST_ASSERT_EQUAL(NSAPI_STATUS_GLOBAL_UP, status);
|
||||
|
||||
net->disconnect();
|
||||
err = net->disconnect();
|
||||
TEST_ASSERT_EQUAL(NSAPI_ERROR_OK, err);
|
||||
|
||||
status = wait_status_callback();
|
||||
TEST_ASSERT_EQUAL(NSAPI_STATUS_DISCONNECTED, status);
|
||||
|
|
@ -123,7 +124,8 @@ void NETWORKINTERFACE_STATUS_NONBLOCK()
|
|||
}
|
||||
TEST_ASSERT_EQUAL(NSAPI_STATUS_GLOBAL_UP, status);
|
||||
|
||||
net->disconnect();
|
||||
err = net->disconnect();
|
||||
TEST_ASSERT_EQUAL(NSAPI_ERROR_OK, err);
|
||||
|
||||
status = wait_status_callback();
|
||||
TEST_ASSERT_EQUAL(NSAPI_STATUS_DISCONNECTED, status);
|
||||
|
|
@ -150,7 +152,8 @@ void NETWORKINTERFACE_STATUS_GET()
|
|||
wait(0.5);
|
||||
}
|
||||
|
||||
net->disconnect();
|
||||
err = net->disconnect();
|
||||
TEST_ASSERT_EQUAL(NSAPI_ERROR_OK, err);
|
||||
|
||||
TEST_ASSERT_EQUAL(NSAPI_STATUS_DISCONNECTED, net->get_connection_status());
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue