tests: net: ipv4_fragment: Make test to run faster
Shorten the timeouts so that the tests are run in 6 second instead of 15 seconds. Use only native_sim for the tests so that the tests are run without any extra delays. Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
This commit is contained in:
parent
bdd5001e5b
commit
265828634d
3 changed files with 7 additions and 4 deletions
|
@ -26,3 +26,5 @@ CONFIG_ZTEST_STACK_SIZE=2048
|
||||||
|
|
||||||
CONFIG_INIT_STACKS=y
|
CONFIG_INIT_STACKS=y
|
||||||
CONFIG_NET_STATISTICS=n
|
CONFIG_NET_STATISTICS=n
|
||||||
|
|
||||||
|
CONFIG_NET_IPV4_FRAGMENT_TIMEOUT=1
|
||||||
|
|
|
@ -31,7 +31,7 @@ LOG_MODULE_REGISTER(net_ipv4_test, CONFIG_NET_IPV4_LOG_LEVEL);
|
||||||
#define IPV4_TEST_PACKET_SIZE 2048
|
#define IPV4_TEST_PACKET_SIZE 2048
|
||||||
|
|
||||||
/* Wait times for semaphores and buffers */
|
/* Wait times for semaphores and buffers */
|
||||||
#define WAIT_TIME K_SECONDS(2)
|
#define WAIT_TIME K_MSEC(1100)
|
||||||
#define ALLOC_TIMEOUT K_MSEC(500)
|
#define ALLOC_TIMEOUT K_MSEC(500)
|
||||||
|
|
||||||
/* Dummy network addresses, 192.168.8.1 and 192.168.8.2 */
|
/* Dummy network addresses, 192.168.8.1 and 192.168.8.2 */
|
||||||
|
@ -776,7 +776,7 @@ ZTEST(net_ipv4_fragment, test_fragment_timeout)
|
||||||
zassert_equal(packets, 1, "Expected fragment to be present in buffer");
|
zassert_equal(packets, 1, "Expected fragment to be present in buffer");
|
||||||
|
|
||||||
/* Delay briefly and re-check number of pending reassembly packets */
|
/* Delay briefly and re-check number of pending reassembly packets */
|
||||||
k_sleep(K_SECONDS(6));
|
k_sleep(K_MSEC(1100));
|
||||||
packets = 0;
|
packets = 0;
|
||||||
net_ipv4_frag_foreach(reassembly_foreach_cb, &packets);
|
net_ipv4_frag_foreach(reassembly_foreach_cb, &packets);
|
||||||
zassert_equal(packets, 0, "Expected fragment to be dropped after timeout");
|
zassert_equal(packets, 0, "Expected fragment to be dropped after timeout");
|
||||||
|
@ -790,7 +790,7 @@ ZTEST(net_ipv4_fragment, test_fragment_timeout)
|
||||||
zassert_equal(sem_count, 0, "Expected no complete upper-layer packets");
|
zassert_equal(sem_count, 0, "Expected no complete upper-layer packets");
|
||||||
|
|
||||||
/* Check packet counts are valid */
|
/* Check packet counts are valid */
|
||||||
k_sleep(K_SECONDS(1));
|
k_sleep(K_MSEC(500));
|
||||||
zassert_equal(lower_layer_packet_count, 1, "Expected 1 packet at lower layers");
|
zassert_equal(lower_layer_packet_count, 1, "Expected 1 packet at lower layers");
|
||||||
zassert_equal(upper_layer_packet_count, 0, "Expected no packets at upper layers");
|
zassert_equal(upper_layer_packet_count, 0, "Expected no packets at upper layers");
|
||||||
zassert_equal(last_packet_received, 1, "Expected last packet");
|
zassert_equal(last_packet_received, 1, "Expected last packet");
|
||||||
|
@ -862,7 +862,7 @@ ZTEST(net_ipv4_fragment, test_do_not_fragment)
|
||||||
"Expected timeout waiting for packet to be received");
|
"Expected timeout waiting for packet to be received");
|
||||||
|
|
||||||
/* Check packet counts are valid */
|
/* Check packet counts are valid */
|
||||||
k_sleep(K_SECONDS(1));
|
k_sleep(K_MSEC(100));
|
||||||
zassert_equal(lower_layer_packet_count, 0, "Expected no packets at lower layers");
|
zassert_equal(lower_layer_packet_count, 0, "Expected no packets at lower layers");
|
||||||
zassert_equal(upper_layer_packet_count, 0, "Expected no packets at upper layers");
|
zassert_equal(upper_layer_packet_count, 0, "Expected no packets at upper layers");
|
||||||
zassert_equal(last_packet_received, 0, "Did not expect last packet");
|
zassert_equal(last_packet_received, 0, "Did not expect last packet");
|
||||||
|
|
|
@ -9,6 +9,7 @@ common:
|
||||||
- net
|
- net
|
||||||
- ipv4
|
- ipv4
|
||||||
- fragment
|
- fragment
|
||||||
|
platform_allow: native_sim
|
||||||
tests:
|
tests:
|
||||||
net.ipv4.fragment:
|
net.ipv4.fragment:
|
||||||
extra_configs:
|
extra_configs:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue