Skip to content

Commit df788c0

Browse files
committed
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 <[email protected]>
1 parent b9c2e7a commit df788c0

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

tests/net/ipv4_fragment/prj.conf

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,5 @@ CONFIG_ZTEST_STACK_SIZE=2048
2626

2727
CONFIG_INIT_STACKS=y
2828
CONFIG_NET_STATISTICS=n
29+
30+
CONFIG_NET_IPV4_FRAGMENT_TIMEOUT=1

tests/net/ipv4_fragment/src/main.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ LOG_MODULE_REGISTER(net_ipv4_test, CONFIG_NET_IPV4_LOG_LEVEL);
3131
#define IPV4_TEST_PACKET_SIZE 2048
3232

3333
/* Wait times for semaphores and buffers */
34-
#define WAIT_TIME K_SECONDS(2)
34+
#define WAIT_TIME K_MSEC(1100)
3535
#define ALLOC_TIMEOUT K_MSEC(500)
3636

3737
/* Dummy network addresses, 192.168.8.1 and 192.168.8.2 */
@@ -776,7 +776,7 @@ ZTEST(net_ipv4_fragment, test_fragment_timeout)
776776
zassert_equal(packets, 1, "Expected fragment to be present in buffer");
777777

778778
/* Delay briefly and re-check number of pending reassembly packets */
779-
k_sleep(K_SECONDS(6));
779+
k_sleep(K_MSEC(1100));
780780
packets = 0;
781781
net_ipv4_frag_foreach(reassembly_foreach_cb, &packets);
782782
zassert_equal(packets, 0, "Expected fragment to be dropped after timeout");
@@ -790,7 +790,7 @@ ZTEST(net_ipv4_fragment, test_fragment_timeout)
790790
zassert_equal(sem_count, 0, "Expected no complete upper-layer packets");
791791

792792
/* Check packet counts are valid */
793-
k_sleep(K_SECONDS(1));
793+
k_sleep(K_MSEC(500));
794794
zassert_equal(lower_layer_packet_count, 1, "Expected 1 packet at lower layers");
795795
zassert_equal(upper_layer_packet_count, 0, "Expected no packets at upper layers");
796796
zassert_equal(last_packet_received, 1, "Expected last packet");
@@ -862,7 +862,7 @@ ZTEST(net_ipv4_fragment, test_do_not_fragment)
862862
"Expected timeout waiting for packet to be received");
863863

864864
/* Check packet counts are valid */
865-
k_sleep(K_SECONDS(1));
865+
k_sleep(K_MSEC(100));
866866
zassert_equal(lower_layer_packet_count, 0, "Expected no packets at lower layers");
867867
zassert_equal(upper_layer_packet_count, 0, "Expected no packets at upper layers");
868868
zassert_equal(last_packet_received, 0, "Did not expect last packet");

tests/net/ipv4_fragment/testcase.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ common:
99
- net
1010
- ipv4
1111
- fragment
12+
platform_allow: native_sim
1213
tests:
1314
net.ipv4.fragment:
1415
extra_configs:

0 commit comments

Comments
 (0)