mirror of https://github.com/ARMmbed/mbed-os.git
				
				
				
			Test udpsocket_recv_timeout does not check packet reception ratio
							parent
							
								
									71c84e851f
								
							
						
					
					
						commit
						3505923d02
					
				| 
						 | 
				
			
			@ -859,9 +859,6 @@ Within each loop, one `recvfrom()` may return the received packet size
 | 
			
		|||
When `NSAPI_ERROR_WOULD_BLOCK` is received, check that time consumed is
 | 
			
		||||
more that 100 milliseconds but less than 200 milliseconds.
 | 
			
		||||
 | 
			
		||||
After repeating for 10 times, at least 5 packets must have been
 | 
			
		||||
received.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
### UDPSOCKET_SENDTO_TIMEOUT
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -27,6 +27,7 @@ using namespace utest::v1;
 | 
			
		|||
namespace {
 | 
			
		||||
static const int SIGNAL_SIGIO = 0x1;
 | 
			
		||||
static const int SIGIO_TIMEOUT = 5000; //[ms]
 | 
			
		||||
static const int PKT_NUM = 2;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void _sigio_handler(osThreadId id)
 | 
			
		||||
| 
						 | 
				
			
			@ -52,7 +53,7 @@ void UDPSOCKET_RECV_TIMEOUT()
 | 
			
		|||
    Timer timer;
 | 
			
		||||
    SocketAddress temp_addr;
 | 
			
		||||
    int pkt_success = 0;
 | 
			
		||||
    for (int i = 0; i < 10; i++) {
 | 
			
		||||
    for (int i = 0; i < PKT_NUM; i++) {
 | 
			
		||||
        TEST_ASSERT_EQUAL(DATA_LEN, sock.sendto(udp_addr, buff, DATA_LEN));
 | 
			
		||||
        timer.reset();
 | 
			
		||||
        timer.start();
 | 
			
		||||
| 
						 | 
				
			
			@ -75,6 +76,6 @@ void UDPSOCKET_RECV_TIMEOUT()
 | 
			
		|||
        pkt_success++;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    TEST_ASSERT(pkt_success >= 5);
 | 
			
		||||
    printf("MBED: %d out of %d packets were received.\n", pkt_success, PKT_NUM);
 | 
			
		||||
    TEST_ASSERT_EQUAL(NSAPI_ERROR_OK, sock.close());
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue