X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=Tools%2FNetTest_Runner%2Ftest_arp.c;h=9c6f04447eb6c32db5f268e035d68a29ef14e720;hb=230612b2efeeb769f1d96193ec01b10bd36d9873;hp=e97e2c3524a7bfd0c2a2f55e2af24bc835b7c71a;hpb=50a98c40481c6d1df267f4631228e9a4d107fe74;p=tpg%2Facess2.git diff --git a/Tools/NetTest_Runner/test_arp.c b/Tools/NetTest_Runner/test_arp.c index e97e2c35..9c6f0444 100644 --- a/Tools/NetTest_Runner/test_arp.c +++ b/Tools/NetTest_Runner/test_arp.c @@ -6,25 +6,26 @@ #include "stack.h" #include "arp.h" +static const int ERX_TIMEOUT = 1000; // Expect RX timeout (timeout=failure) +static const int NRX_TIMEOUT = 250; // Not expect RX timeout (timeout=success) + bool Test_ARP_Basic(void) { - TEST_SETNAME(__func__); - size_t rxlen; - char rxbuf[MTU]; + TEST_HEADER; // Request test machine's IP ARP_SendRequest(0, BLOB(TEST_IP)); - TEST_ASSERT( rxlen = Net_Receive(0, sizeof(rxbuf), rxbuf, 1000) ); + TEST_ASSERT_rx(); TEST_ASSERT( ARP_Pkt_IsResponse(rxlen, rxbuf, BLOB(TEST_IP), BLOB(TEST_MAC)) ); // Request host machine's IP - ARP_SendRequest(0, HOST_IP_STR); - TEST_ASSERT( Net_Receive(0, sizeof(rxbuf), rxbuf, 1000) == 0 ); + ARP_SendRequest(0, BLOB(HOST_IP)); + TEST_ASSERT_no_rx(); #if 0 // Ask test machine to request our IP Stack_SendCommand("arprequest "HOST_IP_STR); - TEST_ASSERT( rxlen = Net_Receive(0, sizeof(rxbuf), rxbuf, 1000) ); + TEST_ASSERT_rx(); TEST_ASSERT( ARP_Pkt_IsRequest(rxlen, rxbuf, HOST_IP) ); // Respond @@ -32,7 +33,7 @@ bool Test_ARP_Basic(void) // Ask test machine to request our IP again (expecting nothing) Stack_SendCommand("arprequest "HOST_IP_STR); - TEST_ASSERT( !Net_Receive(0, sizeof(rxbuf), rxbuf, 1000) ); + TEST_ASSERT_no_rx(); #endif return true;