Skip to contentSkip to conversation

selftests: pmtu: use -oneline for ip route list cache

PATCH In review Thadeu Lima de Souza Cascardo 3 participants 3 messages Nov 28, 2019 – Nov 29, 2019

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 selftests: pmtu: use -oneline for ip route list cache

Some versions of iproute2 will output more than one line per entry, which will cause the test to fail, like:

TEST: ipv6: list and flush cached exceptions [FAIL]
can't list cached exceptions

That happens, for example, with iproute2 4.15.0. When using the -oneline option, this will work just fine:

TEST: ipv6: list and flush cached exceptions [ OK ]

This also works just fine with a more recent version of iproute2, like 5.4.0.

For some reason, two lines are printed for the IPv4 test no matter what version of iproute2 is used. Use the same -oneline parameter there instead of counting the lines twice.

---
 tools/testing/selftests/net/pmtu.sh | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
tools/testing/selftests/net/pmtu.sh +2 -3
index ab367e75f095..d697815d2785 100755
@@ -1249,8 +1249,7 @@ test_list_flush_ipv4_exception() {
 	done
 	run_cmd ${ns_a} ping -q -M want -i 0.1 -c 2 -s 1800 "${dst2}"
 
-	# Each exception is printed as two lines
-	if [ "$(${ns_a} ip route list cache | wc -l)" -ne 202 ]; then
+	if [ "$(${ns_a} ip -oneline route list cache | wc -l)" -ne 101 ]; then
 		err "  can't list cached exceptions"
 		fail=1
 	fi
@@ -1300,7 +1299,7 @@ test_list_flush_ipv6_exception() {
 		run_cmd ${ns_a} ping -q -M want -i 0.1 -w 1 -s 1800 "${dst_prefix1}${i}"
 	done
 	run_cmd ${ns_a} ping -q -M want -i 0.1 -w 1 -s 1800 "${dst2}"
-	if [ "$(${ns_a} ip -6 route list cache | wc -l)" -ne 101 ]; then
+	if [ "$(${ns_a} ip -oneline -6 route list cache | wc -l)" -ne 101 ]; then
 		err "  can't list cached exceptions"
 		fail=1
 	fi
Signature · 1 line
2.20.1
Acked-by on v1 1/1
#1 lore raw

Hi,

Quoted 9 lines · On Thu, 28 Nov 2019 15:58:06 -0300 Thadeu Lima de Souza Cascardo…

Some versions of iproute2 will output more than one line per entry, which will cause the test to fail, like:

TEST: ipv6: list and flush cached exceptions [FAIL]
can't list cached exceptions

That happens, for example, with iproute2 4.15.0. When using the -oneline option, this will work just fine:

Quoted 8 lines

TEST: ipv6: list and flush cached exceptions [ OK ]

This also works just fine with a more recent version of iproute2, like 5.4.0.

For some reason, two lines are printed for the IPv4 test no matter what version of iproute2 is used. Use the same -oneline parameter there instead of counting the lines twice.

Thanks, it looks definitely more robust this way.

Fixes b964641e9925 ("selftests: pmtu: Make list_flush_ipv6_exception test more demanding")
Quoted 1 line
Signature · 1 line
Stefano
maintainer
#2 lore raw
In reply to Thadeu Lima de Souza Cascardo

From: Thadeu Lima de Souza Cascardo <[email protected]>
Date: Thu, 28 Nov 2019 15:58:06 -0300

Quoted 11 lines

Some versions of iproute2 will output more than one line per entry, which will cause the test to fail, like:

TEST: ipv6: list and flush cached exceptions [FAIL]
can't list cached exceptions

That happens, for example, with iproute2 4.15.0. When using the -oneline option, this will work just fine:

TEST: ipv6: list and flush cached exceptions [ OK ]

Quoted 8 lines

This also works just fine with a more recent version of iproute2, like 5.4.0.

For some reason, two lines are printed for the IPv4 test no matter what version of iproute2 is used. Use the same -oneline parameter there instead of counting the lines twice.

Applied with Fixes: tag added and queued up for -stable.

Thanks.