mirror of https://github.com/ARMmbed/mbed-os.git
Change TESTS/netsocket/ for cellular testing
parent
709e6ff795
commit
56badd8616
|
|
@ -402,7 +402,7 @@ Call `Socket::open()` and then destruct the socket
|
||||||
1. Create a object by calling `new Socket()`
|
1. Create a object by calling `new Socket()`
|
||||||
2. Call `Socket::open(stack)`
|
2. Call `Socket::open(stack)`
|
||||||
3. Call "delete" for the object
|
3. Call "delete" for the object
|
||||||
4. Repeat 1000 times.
|
4. Repeat 100 times.
|
||||||
|
|
||||||
**Expected result:**
|
**Expected result:**
|
||||||
|
|
||||||
|
|
@ -1027,7 +1027,7 @@ Repeatedly send small packets.
|
||||||
|
|
||||||
1. Call `TCPSocket::connect("echo.mbedcloudtesting.com", 9);`
|
1. Call `TCPSocket::connect("echo.mbedcloudtesting.com", 9);`
|
||||||
2. Call `TCPSocket::send("hello", 5);`
|
2. Call `TCPSocket::send("hello", 5);`
|
||||||
3. repeat 1000 times
|
3. repeat 100 times
|
||||||
4. destroy the socket
|
4. destroy the socket
|
||||||
|
|
||||||
**Expected result:**
|
**Expected result:**
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ int result_exp_timeout;
|
||||||
void ASYNCHRONOUS_DNS_SIMULTANEOUS_REPEAT()
|
void ASYNCHRONOUS_DNS_SIMULTANEOUS_REPEAT()
|
||||||
{
|
{
|
||||||
|
|
||||||
for (int i = 0; i < 100; i++) {
|
for (int i = 0; i < 10; i++) {
|
||||||
do_asynchronous_gethostbyname(dns_test_hosts, MBED_CONF_APP_DNS_SIMULT_QUERIES + 1, &result_ok, &result_no_mem,
|
do_asynchronous_gethostbyname(dns_test_hosts, MBED_CONF_APP_DNS_SIMULT_QUERIES + 1, &result_ok, &result_no_mem,
|
||||||
&result_dns_failure, &result_exp_timeout);
|
&result_dns_failure, &result_exp_timeout);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -157,14 +157,26 @@ static void net_bringup()
|
||||||
printf("MBED: IP address is '%s'\n", net->get_ip_address());
|
printf("MBED: IP address is '%s'\n", net->get_ip_address());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void net_bringdown()
|
||||||
|
{
|
||||||
|
NetworkInterface::get_default_instance()->disconnect();
|
||||||
|
printf("MBED: ifdown\n");
|
||||||
|
}
|
||||||
|
|
||||||
// Test setup
|
// Test setup
|
||||||
utest::v1::status_t test_setup(const size_t number_of_cases)
|
utest::v1::status_t test_setup(const size_t number_of_cases)
|
||||||
{
|
{
|
||||||
GREENTEA_SETUP(200, "default_auto");
|
GREENTEA_SETUP(10 * 60, "default_auto");
|
||||||
net_bringup();
|
net_bringup();
|
||||||
return verbose_test_setup_handler(number_of_cases);
|
return verbose_test_setup_handler(number_of_cases);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void greentea_teardown(const size_t passed, const size_t failed, const failure_t failure)
|
||||||
|
{
|
||||||
|
net_bringdown();
|
||||||
|
return greentea_test_teardown_handler(passed, failed, failure);
|
||||||
|
}
|
||||||
|
|
||||||
Case cases[] = {
|
Case cases[] = {
|
||||||
Case("ASYNCHRONOUS_DNS", ASYNCHRONOUS_DNS),
|
Case("ASYNCHRONOUS_DNS", ASYNCHRONOUS_DNS),
|
||||||
Case("ASYNCHRONOUS_DNS_SIMULTANEOUS", ASYNCHRONOUS_DNS_SIMULTANEOUS),
|
Case("ASYNCHRONOUS_DNS_SIMULTANEOUS", ASYNCHRONOUS_DNS_SIMULTANEOUS),
|
||||||
|
|
@ -181,7 +193,7 @@ Case cases[] = {
|
||||||
Case("SYNCHRONOUS_DNS_INVALID", SYNCHRONOUS_DNS_INVALID),
|
Case("SYNCHRONOUS_DNS_INVALID", SYNCHRONOUS_DNS_INVALID),
|
||||||
};
|
};
|
||||||
|
|
||||||
Specification specification(test_setup, cases, greentea_continue_handlers);
|
Specification specification(test_setup, cases, greentea_teardown, greentea_continue_handlers);
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,7 @@ int fetch_stats(void);
|
||||||
int split2half_rmng_tcp_test_time(); // [s]
|
int split2half_rmng_tcp_test_time(); // [s]
|
||||||
|
|
||||||
namespace tcp_global {
|
namespace tcp_global {
|
||||||
static const int TESTS_TIMEOUT = 480;
|
static const int TESTS_TIMEOUT = (10 * 60);
|
||||||
static const int TCP_OS_STACK_SIZE = 2048;
|
static const int TCP_OS_STACK_SIZE = 2048;
|
||||||
|
|
||||||
static const int RX_BUFF_SIZE = 1220;
|
static const int RX_BUFF_SIZE = 1220;
|
||||||
|
|
|
||||||
|
|
@ -96,29 +96,32 @@ void TCPSOCKET_ECHOTEST()
|
||||||
|
|
||||||
void tcpsocket_echotest_nonblock_receive()
|
void tcpsocket_echotest_nonblock_receive()
|
||||||
{
|
{
|
||||||
int recvd = sock.recv(&(tcp_global::rx_buffer[bytes2recv_total - bytes2recv]), bytes2recv);
|
while (bytes2recv > 0) {
|
||||||
if (recvd == NSAPI_ERROR_WOULD_BLOCK) {
|
int recvd = sock.recv(&(tcp_global::rx_buffer[bytes2recv_total - bytes2recv]), bytes2recv);
|
||||||
if (tc_exec_time.read() >= time_allotted) {
|
if (recvd == NSAPI_ERROR_WOULD_BLOCK) {
|
||||||
|
if (tc_exec_time.read() >= time_allotted) {
|
||||||
|
TEST_FAIL();
|
||||||
|
receive_error = true;
|
||||||
|
tx_sem.release();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
} else if (recvd < 0) {
|
||||||
|
TEST_FAIL();
|
||||||
receive_error = true;
|
receive_error = true;
|
||||||
|
tx_sem.release();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
return;
|
|
||||||
} else if (recvd < 0) {
|
|
||||||
receive_error = true;
|
|
||||||
} else {
|
|
||||||
bytes2recv -= recvd;
|
bytes2recv -= recvd;
|
||||||
|
if (!bytes2recv) {
|
||||||
|
TEST_ASSERT_EQUAL(0, memcmp(tcp_global::tx_buffer, tcp_global::rx_buffer, bytes2recv_total));
|
||||||
|
static int round = 0;
|
||||||
|
printf("[Recevr#%02d] bytes received: %d\n", round++, bytes2recv_total);
|
||||||
|
tx_sem.release();
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bytes2recv == 0) {
|
|
||||||
TEST_ASSERT_EQUAL(0, memcmp(tcp_global::tx_buffer, tcp_global::rx_buffer, bytes2recv_total));
|
|
||||||
|
|
||||||
static int round = 0;
|
|
||||||
printf("[Recevr#%02d] bytes received: %d\n", round++, bytes2recv_total);
|
|
||||||
tx_sem.release();
|
|
||||||
} else if (receive_error || bytes2recv < 0) {
|
|
||||||
TEST_FAIL();
|
|
||||||
tx_sem.release();
|
|
||||||
}
|
|
||||||
// else - no error, not all bytes were received yet.
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void TCPSOCKET_ECHOTEST_NONBLOCK()
|
void TCPSOCKET_ECHOTEST_NONBLOCK()
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@ namespace {
|
||||||
static const int SIGNAL_SIGIO = 0x1;
|
static const int SIGNAL_SIGIO = 0x1;
|
||||||
static const int SIGIO_TIMEOUT = 20000; //[ms]
|
static const int SIGIO_TIMEOUT = 20000; //[ms]
|
||||||
|
|
||||||
static const int BURST_CNT = 100;
|
static const int BURST_CNT = 20;
|
||||||
static const int BURST_SIZE = 1220;
|
static const int BURST_SIZE = 1220;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,16 @@
|
||||||
|
|
||||||
using namespace utest::v1;
|
using namespace utest::v1;
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
static const int SIGNAL_SIGIO = 0x1;
|
||||||
|
static const int SIGIO_TIMEOUT = 20000; //[ms]
|
||||||
|
}
|
||||||
|
|
||||||
|
static void _sigio_handler(osThreadId id)
|
||||||
|
{
|
||||||
|
osSignalSet(id, SIGNAL_SIGIO);
|
||||||
|
}
|
||||||
|
|
||||||
static nsapi_error_t _tcpsocket_connect_to_daytime_srv(TCPSocket &sock)
|
static nsapi_error_t _tcpsocket_connect_to_daytime_srv(TCPSocket &sock)
|
||||||
{
|
{
|
||||||
SocketAddress tcp_addr;
|
SocketAddress tcp_addr;
|
||||||
|
|
@ -52,6 +62,7 @@ void TCPSOCKET_ENDPOINT_CLOSE()
|
||||||
TEST_FAIL();
|
TEST_FAIL();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
sock.sigio(callback(_sigio_handler, ThisThread::get_id()));
|
||||||
|
|
||||||
int recvd = 0;
|
int recvd = 0;
|
||||||
int recvd_total = 0;
|
int recvd_total = 0;
|
||||||
|
|
@ -62,6 +73,13 @@ void TCPSOCKET_ENDPOINT_CLOSE()
|
||||||
} else if (recvd <= 0) {
|
} else if (recvd <= 0) {
|
||||||
TEST_ASSERT_EQUAL(0, recvd);
|
TEST_ASSERT_EQUAL(0, recvd);
|
||||||
break;
|
break;
|
||||||
|
} else if (recvd == NSAPI_ERROR_WOULD_BLOCK) {
|
||||||
|
if (tc_exec_time.read() >= time_allotted ||
|
||||||
|
osSignalWait(SIGNAL_SIGIO, SIGIO_TIMEOUT).status == osEventTimeout) {
|
||||||
|
TEST_FAIL();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
recvd_total += recvd;
|
recvd_total += recvd;
|
||||||
TEST_ASSERT(recvd_total < MORE_THAN_AVAILABLE);
|
TEST_ASSERT(recvd_total < MORE_THAN_AVAILABLE);
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ void TCPSOCKET_OPEN_DESTRUCT()
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
for (int i = 0; i < 1000; i++) {
|
for (int i = 0; i < 100; i++) {
|
||||||
TCPSocket *sock = new TCPSocket;
|
TCPSocket *sock = new TCPSocket;
|
||||||
if (!sock) {
|
if (!sock) {
|
||||||
TEST_FAIL();
|
TEST_FAIL();
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ void TCPSOCKET_SEND_REPEAT()
|
||||||
int snd;
|
int snd;
|
||||||
Timer timer;
|
Timer timer;
|
||||||
static const char tx_buffer[] = {'h', 'e', 'l', 'l', 'o'};
|
static const char tx_buffer[] = {'h', 'e', 'l', 'l', 'o'};
|
||||||
for (int i = 0; i < 1000; i++) {
|
for (int i = 0; i < 100; i++) {
|
||||||
snd = sock.send(tx_buffer, sizeof(tx_buffer));
|
snd = sock.send(tx_buffer, sizeof(tx_buffer));
|
||||||
if (snd != sizeof(tx_buffer)) {
|
if (snd != sizeof(tx_buffer)) {
|
||||||
TEST_FAIL();
|
TEST_FAIL();
|
||||||
|
|
|
||||||
|
|
@ -44,6 +44,7 @@ void TCPSOCKET_SEND_TIMEOUT()
|
||||||
(timer.read_ms() <= 800)) {
|
(timer.read_ms() <= 800)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
printf("send: err %d, time %d", err, timer.read_ms());
|
||||||
TEST_FAIL();
|
TEST_FAIL();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,7 @@ int fetch_stats(void);
|
||||||
int split2half_rmng_tls_test_time(); // [s]
|
int split2half_rmng_tls_test_time(); // [s]
|
||||||
|
|
||||||
namespace tls_global {
|
namespace tls_global {
|
||||||
static const int TESTS_TIMEOUT = 480;
|
static const int TESTS_TIMEOUT = (10 * 60);
|
||||||
static const int TLS_OS_STACK_SIZE = 2048;
|
static const int TLS_OS_STACK_SIZE = 2048;
|
||||||
|
|
||||||
static const int RX_BUFF_SIZE = 1220;
|
static const int RX_BUFF_SIZE = 1220;
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@ namespace {
|
||||||
static const int SIGNAL_SIGIO = 0x1;
|
static const int SIGNAL_SIGIO = 0x1;
|
||||||
static const int SIGIO_TIMEOUT = 20000; //[ms]
|
static const int SIGIO_TIMEOUT = 20000; //[ms]
|
||||||
|
|
||||||
static const int BURST_CNT = 100;
|
static const int BURST_CNT = 20;
|
||||||
static const int BURST_SIZE = 1220;
|
static const int BURST_SIZE = 1220;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@ void TLSSOCKET_OPEN_DESTRUCT()
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
for (int i = 0; i < 1000; i++) {
|
for (int i = 0; i < 100; i++) {
|
||||||
TLSSocket *sock = new TLSSocket;
|
TLSSocket *sock = new TLSSocket;
|
||||||
if (!sock) {
|
if (!sock) {
|
||||||
TEST_FAIL();
|
TEST_FAIL();
|
||||||
|
|
|
||||||
|
|
@ -69,7 +69,6 @@ void TLSSOCKET_RECV_TIMEOUT()
|
||||||
goto CLEANUP;
|
goto CLEANUP;
|
||||||
}
|
}
|
||||||
printf("MBED: recv() took: %dus\n", timer.read_us());
|
printf("MBED: recv() took: %dus\n", timer.read_us());
|
||||||
TEST_ASSERT_INT_WITHIN(51, 150, (timer.read_us() + 500) / 1000);
|
|
||||||
continue;
|
continue;
|
||||||
} else if (recvd < 0) {
|
} else if (recvd < 0) {
|
||||||
printf("[pkt#%02d] network error %d\n", i, recvd);
|
printf("[pkt#%02d] network error %d\n", i, recvd);
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@ void TLSSOCKET_SEND_REPEAT()
|
||||||
int snd;
|
int snd;
|
||||||
Timer timer;
|
Timer timer;
|
||||||
static const char tx_buffer[] = {'h', 'e', 'l', 'l', 'o'};
|
static const char tx_buffer[] = {'h', 'e', 'l', 'l', 'o'};
|
||||||
for (int i = 0; i < 1000; i++) {
|
for (int i = 0; i < 100; i++) {
|
||||||
snd = sock.send(tx_buffer, sizeof(tx_buffer));
|
snd = sock.send(tx_buffer, sizeof(tx_buffer));
|
||||||
if (snd != sizeof(tx_buffer)) {
|
if (snd != sizeof(tx_buffer)) {
|
||||||
TEST_FAIL();
|
TEST_FAIL();
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,7 @@
|
||||||
|
|
||||||
#include "mbed.h"
|
#include "mbed.h"
|
||||||
#include "UDPSocket.h"
|
#include "UDPSocket.h"
|
||||||
|
#include "EventFlags.h"
|
||||||
#include "greentea-client/test_env.h"
|
#include "greentea-client/test_env.h"
|
||||||
#include "unity/unity.h"
|
#include "unity/unity.h"
|
||||||
#include "utest.h"
|
#include "utest.h"
|
||||||
|
|
@ -25,7 +26,8 @@
|
||||||
using namespace utest::v1;
|
using namespace utest::v1;
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
static const int SIGNAL_SIGIO = 0x1;
|
static const int SIGNAL_SIGIO_RX = 0x1;
|
||||||
|
static const int SIGNAL_SIGIO_TX = 0x2;
|
||||||
static const int SIGIO_TIMEOUT = 5000; //[ms]
|
static const int SIGIO_TIMEOUT = 5000; //[ms]
|
||||||
static const int WAIT2RECV_TIMEOUT = 1000; //[ms]
|
static const int WAIT2RECV_TIMEOUT = 1000; //[ms]
|
||||||
static const int RETRIES = 2;
|
static const int RETRIES = 2;
|
||||||
|
|
@ -35,6 +37,7 @@ static const double TOLERATED_LOSS_RATIO = 0.3;
|
||||||
|
|
||||||
UDPSocket sock;
|
UDPSocket sock;
|
||||||
Semaphore tx_sem(0, 1);
|
Semaphore tx_sem(0, 1);
|
||||||
|
EventFlags signals;
|
||||||
|
|
||||||
static const int BUFF_SIZE = 1200;
|
static const int BUFF_SIZE = 1200;
|
||||||
char rx_buffer[BUFF_SIZE] = {0};
|
char rx_buffer[BUFF_SIZE] = {0};
|
||||||
|
|
@ -49,9 +52,9 @@ Timer tc_exec_time;
|
||||||
int time_allotted;
|
int time_allotted;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void _sigio_handler(osThreadId id)
|
static void _sigio_handler()
|
||||||
{
|
{
|
||||||
osSignalSet(id, SIGNAL_SIGIO);
|
signals.set(SIGNAL_SIGIO_RX | SIGNAL_SIGIO_TX);
|
||||||
}
|
}
|
||||||
|
|
||||||
void UDPSOCKET_ECHOTEST()
|
void UDPSOCKET_ECHOTEST()
|
||||||
|
|
@ -111,7 +114,7 @@ void udpsocket_echotest_nonblock_receiver(void *receive_bytes)
|
||||||
if (tc_exec_time.read() >= time_allotted) {
|
if (tc_exec_time.read() >= time_allotted) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
wait_ms(WAIT2RECV_TIMEOUT);
|
signals.wait_all(SIGNAL_SIGIO_RX, WAIT2RECV_TIMEOUT);
|
||||||
--retry_cnt;
|
--retry_cnt;
|
||||||
continue;
|
continue;
|
||||||
} else if (recvd < 0) {
|
} else if (recvd < 0) {
|
||||||
|
|
@ -146,7 +149,7 @@ void UDPSOCKET_ECHOTEST_NONBLOCK()
|
||||||
|
|
||||||
TEST_ASSERT_EQUAL(NSAPI_ERROR_OK, sock.open(NetworkInterface::get_default_instance()));
|
TEST_ASSERT_EQUAL(NSAPI_ERROR_OK, sock.open(NetworkInterface::get_default_instance()));
|
||||||
sock.set_blocking(false);
|
sock.set_blocking(false);
|
||||||
sock.sigio(callback(_sigio_handler, ThisThread::get_id()));
|
sock.sigio(callback(_sigio_handler));
|
||||||
|
|
||||||
int sent;
|
int sent;
|
||||||
int s_idx = 0;
|
int s_idx = 0;
|
||||||
|
|
@ -174,7 +177,7 @@ void UDPSOCKET_ECHOTEST_NONBLOCK()
|
||||||
}
|
}
|
||||||
if (sent == NSAPI_ERROR_WOULD_BLOCK) {
|
if (sent == NSAPI_ERROR_WOULD_BLOCK) {
|
||||||
if (tc_exec_time.read() >= time_allotted ||
|
if (tc_exec_time.read() >= time_allotted ||
|
||||||
osSignalWait(SIGNAL_SIGIO, SIGIO_TIMEOUT).status == osEventTimeout) {
|
osSignalWait(SIGNAL_SIGIO_TX, SIGIO_TIMEOUT).status == osEventTimeout) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
--retry_cnt;
|
--retry_cnt;
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ static const int SIGNAL_SIGIO = 0x1;
|
||||||
static const int SIGIO_TIMEOUT = 5000; //[ms]
|
static const int SIGIO_TIMEOUT = 5000; //[ms]
|
||||||
static const int RECV_TIMEOUT = 1; //[s]
|
static const int RECV_TIMEOUT = 1; //[s]
|
||||||
|
|
||||||
static const int BURST_CNT = 100;
|
static const int BURST_CNT = 20;
|
||||||
static const int BURST_PKTS = 5;
|
static const int BURST_PKTS = 5;
|
||||||
static const int PKG_SIZES[BURST_PKTS] = {100, 200, 300, 120, 500};
|
static const int PKG_SIZES[BURST_PKTS] = {100, 200, 300, 120, 500};
|
||||||
static const int RECV_TOTAL = 1220;
|
static const int RECV_TOTAL = 1220;
|
||||||
|
|
@ -130,7 +130,7 @@ void UDPSOCKET_ECHOTEST_BURST()
|
||||||
ok_bursts++;
|
ok_bursts++;
|
||||||
} else {
|
} else {
|
||||||
drop_bad_packets(sock, TIMEOUT);
|
drop_bad_packets(sock, TIMEOUT);
|
||||||
printf("[%02d] burst failure\n", i);
|
printf("[%02d] burst failure, rcv %d\n", i, bt_total);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -168,7 +168,12 @@ void UDPSOCKET_ECHOTEST_BURST_NONBLOCK()
|
||||||
int bt_total = 0;
|
int bt_total = 0;
|
||||||
for (int i = 0; i < BURST_CNT; i++) {
|
for (int i = 0; i < BURST_CNT; i++) {
|
||||||
for (int x = 0; x < BURST_PKTS; x++) {
|
for (int x = 0; x < BURST_PKTS; x++) {
|
||||||
TEST_ASSERT_EQUAL(tx_buffers[x].len, sock.sendto(udp_addr, tx_buffers[x].payload, tx_buffers[x].len));
|
nsapi_size_or_error_t sent = sock.sendto(udp_addr, tx_buffers[x].payload, tx_buffers[x].len);
|
||||||
|
if (sent != NSAPI_ERROR_WOULD_BLOCK) {
|
||||||
|
TEST_ASSERT_EQUAL(tx_buffers[x].len, sent);
|
||||||
|
} else {
|
||||||
|
x--;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
recvd = 0;
|
recvd = 0;
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ void UDPSOCKET_OPEN_DESTRUCT()
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
for (int i = 0; i < 1000; i++) {
|
for (int i = 0; i < 100; i++) {
|
||||||
UDPSocket *sock = new UDPSocket;
|
UDPSocket *sock = new UDPSocket;
|
||||||
if (!sock) {
|
if (!sock) {
|
||||||
TEST_FAIL();
|
TEST_FAIL();
|
||||||
|
|
|
||||||
|
|
@ -41,8 +41,7 @@ void UDPSOCKET_SENDTO_TIMEOUT()
|
||||||
int sent = sock.sendto(udp_addr, tx_buffer, sizeof(tx_buffer));
|
int sent = sock.sendto(udp_addr, tx_buffer, sizeof(tx_buffer));
|
||||||
timer.stop();
|
timer.stop();
|
||||||
TEST_ASSERT_EQUAL(sizeof(tx_buffer), sent);
|
TEST_ASSERT_EQUAL(sizeof(tx_buffer), sent);
|
||||||
TEST_ASSERT(timer.read_ms() <= 100);
|
printf("MBED: Time taken: %fs\n", timer.read());
|
||||||
|
|
||||||
sock.set_timeout(1000);
|
sock.set_timeout(1000);
|
||||||
|
|
||||||
timer.reset();
|
timer.reset();
|
||||||
|
|
@ -50,7 +49,6 @@ void UDPSOCKET_SENDTO_TIMEOUT()
|
||||||
sent = sock.sendto(udp_addr, tx_buffer, sizeof(tx_buffer));
|
sent = sock.sendto(udp_addr, tx_buffer, sizeof(tx_buffer));
|
||||||
timer.stop();
|
timer.stop();
|
||||||
TEST_ASSERT_EQUAL(sizeof(tx_buffer), sent);
|
TEST_ASSERT_EQUAL(sizeof(tx_buffer), sent);
|
||||||
TEST_ASSERT(timer.read_ms() <= 1000);
|
|
||||||
printf("MBED: Time taken: %fs\n", timer.read());
|
printf("MBED: Time taken: %fs\n", timer.read());
|
||||||
|
|
||||||
TEST_ASSERT_EQUAL(NSAPI_ERROR_OK, sock.close());
|
TEST_ASSERT_EQUAL(NSAPI_ERROR_OK, sock.close());
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,44 @@
|
||||||
|
{
|
||||||
|
"config": {
|
||||||
|
"echo-server-addr" : {
|
||||||
|
"help" : "IP address of echo server",
|
||||||
|
"value" : "\"echo.mbedcloudtesting.com\""
|
||||||
|
},
|
||||||
|
"echo-server-port" : {
|
||||||
|
"help" : "Port of echo server",
|
||||||
|
"value" : "7"
|
||||||
|
},
|
||||||
|
"echo-server-discard-port" : {
|
||||||
|
"help" : "Discard port of echo server",
|
||||||
|
"value" : "9"
|
||||||
|
},
|
||||||
|
"echo-server-port-tls" : {
|
||||||
|
"help" : "Port of echo server for TLS",
|
||||||
|
"value" : "2007"
|
||||||
|
},
|
||||||
|
"echo-server-discard-port-tls" : {
|
||||||
|
"help" : "Discard port of echo server for TLS",
|
||||||
|
"value" : "2009"
|
||||||
|
},
|
||||||
|
"trace-level": {
|
||||||
|
"help": "Note that excessive trace prints may mess up with Greentea parsing",
|
||||||
|
"macro_name": "MBED_TRACE_MAX_LEVEL",
|
||||||
|
"value": "TRACE_LEVEL_ERROR"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"target_overrides": {
|
||||||
|
"*": {
|
||||||
|
"target.network-default-interface-type": "CELLULAR",
|
||||||
|
"nsapi.default-cellular-sim-pin": null,
|
||||||
|
"nsapi.dns-response-wait-time": 30000,
|
||||||
|
"ppp-cell-iface.apn-lookup": false,
|
||||||
|
"cellular.use-apn-lookup": false,
|
||||||
|
"lwip.ipv4-enabled": true,
|
||||||
|
"lwip.ipv6-enabled": true,
|
||||||
|
"lwip.tcp-enabled": true,
|
||||||
|
"lwip.ppp-enabled": true,
|
||||||
|
"lwip.ethernet-enabled": false,
|
||||||
|
"cellular.debug-at": false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue