From ed754434b71327e1f3c267579ebf864a18eaf0ea Mon Sep 17 00:00:00 2001 From: Ari Parkkila Date: Thu, 14 Nov 2019 05:48:56 -0800 Subject: [PATCH] TESTS: Add socket.set_timeout in udpsocket_echotest Some packet loss may be expected/allowed with UDP. Set socket timeout to continue testing if no response is received within a timeout. --- TESTS/netsocket/udp/udpsocket_echotest.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/TESTS/netsocket/udp/udpsocket_echotest.cpp b/TESTS/netsocket/udp/udpsocket_echotest.cpp index 1473e6b48e..cdfb2ff233 100755 --- a/TESTS/netsocket/udp/udpsocket_echotest.cpp +++ b/TESTS/netsocket/udp/udpsocket_echotest.cpp @@ -29,6 +29,7 @@ namespace { static const int SIGNAL_SIGIO_RX = 0x1; static const int SIGNAL_SIGIO_TX = 0x2; static const int SIGIO_TIMEOUT = 5000; //[ms] +static const int SOCKET_TIMEOUT = (10 * 1000); //[ms] static const int RETRIES = 2; static const double EXPECTED_LOSS_RATIO = 0.0; @@ -70,6 +71,7 @@ void UDPSOCKET_ECHOTEST() UDPSocket sock; TEST_ASSERT_EQUAL(NSAPI_ERROR_OK, sock.open(NetworkInterface::get_default_instance())); + sock.set_timeout(SOCKET_TIMEOUT); int recvd; int sent; int packets_sent = 0;