diff --git a/TESTS/netsocket/udp/udpsocket_echotest.cpp b/TESTS/netsocket/udp/udpsocket_echotest.cpp index d9f3922766..72e6c0669b 100755 --- a/TESTS/netsocket/udp/udpsocket_echotest.cpp +++ b/TESTS/netsocket/udp/udpsocket_echotest.cpp @@ -86,6 +86,7 @@ void UDPSOCKET_ECHOTEST_impl(bool use_sendto) fill_tx_buffer_ascii(tx_buffer, BUFF_SIZE); int packets_sent_prev = packets_sent; + bool is_oversized; for (int retry_cnt = 0; retry_cnt <= 2; retry_cnt++) { memset(rx_buffer, 0, BUFF_SIZE); @@ -94,8 +95,10 @@ void UDPSOCKET_ECHOTEST_impl(bool use_sendto) } else { sent = sock.send(tx_buffer, pkt_s); } - if (check_oversized_packets(sent, pkt_s)) { + is_oversized = check_oversized_packets(sent, pkt_s); + if (is_oversized) { TEST_IGNORE_MESSAGE("This device does not handle oversized packets"); + break; } else if (sent == pkt_s) { packets_sent++; } else { @@ -127,6 +130,9 @@ void UDPSOCKET_ECHOTEST_impl(bool use_sendto) } } + if (is_oversized) { + continue; + } if (use_sendto) { // Verify received address is correct TEST_ASSERT(udp_addr == recv_addr); @@ -188,6 +194,8 @@ void UDPSOCKET_ECHOTEST_NONBLOCK_impl(bool use_sendto) for (unsigned int s_idx = 0; s_idx < sizeof(pkt_sizes) / sizeof(*pkt_sizes); ++s_idx) { int pkt_s = pkt_sizes[s_idx]; int packets_sent_prev = packets_sent; + bool is_oversized; + for (int retry_cnt = 0; retry_cnt <= RETRIES; retry_cnt++) { fill_tx_buffer_ascii(tx_buffer, pkt_s); @@ -197,7 +205,11 @@ void UDPSOCKET_ECHOTEST_NONBLOCK_impl(bool use_sendto) sent = sock->send(tx_buffer, pkt_s); } - if (sent == pkt_s) { + is_oversized = check_oversized_packets(sent, pkt_s); + if (is_oversized) { + TEST_IGNORE_MESSAGE("This device does not handle oversized packets"); + break; + } else if (sent == pkt_s) { packets_sent++; } else if (sent == NSAPI_ERROR_WOULD_BLOCK) { if (tc_exec_time.read() >= time_allotted || @@ -239,6 +251,10 @@ void UDPSOCKET_ECHOTEST_NONBLOCK_impl(bool use_sendto) break; } } + + if (is_oversized) { + continue; + } // Make sure that at least one packet of every size was sent. TEST_ASSERT_TRUE(packets_sent > packets_sent_prev); if (memcmp(tx_buffer, rx_buffer, pkt_s) == 0) {