Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

selftests: forwarding: router_mpath_nh_lib: Don't skip, xfail on veth

When the NH group stats tests are currently run on a veth topology, the
HW-stats leg of each test is SKIP'ped. But kernel networking CI interprets
skips as a sign that tooling is missing, and prompts maintainer
investigation. Lack of capability to pass a test should be expressed as
XFAIL.

Selftests that require HW should normally be put in drivers/net/hw, but
doing so for the NH counter selftests would just lead to a lot of
duplicity.

So instead, introduce a helper, xfail_on_veth(), which can be used to mark
selftests that should XFAIL instead of FAILing when run on a veth topology.
On non-veth topology, they don't do anything.

Use the helper in the HW-stats part of router_mpath_nh_lib selftest.

Signed-off-by: Petr Machata <petrm@nvidia.com>
Link: https://lore.kernel.org/r/15f0ab9637aa0497f164ec30e83c1c8f53d53719.1711464583.git.petrm@nvidia.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Petr Machata and committed by
Jakub Kicinski
6db870bb e1039109

+15 -11
+14
tools/testing/selftests/net/forwarding/lib.sh
··· 459 459 fi 460 460 } 461 461 462 + xfail_on_veth() 463 + { 464 + local dev=$1; shift 465 + local kind 466 + 467 + kind=$(ip -j -d link show dev $dev | 468 + jq -r '.[].linkinfo.info_kind') 469 + if [[ $kind = veth ]]; then 470 + FAIL_TO_XFAIL=yes "$@" 471 + else 472 + "$@" 473 + fi 474 + } 475 + 462 476 log_test_result() 463 477 { 464 478 local test_name=$1; shift
+1 -11
tools/testing/selftests/net/forwarding/router_mpath_nh_lib.sh
··· 56 56 local group_id=$1; shift 57 57 local mz="$@" 58 58 59 - local used 60 - 61 59 nh_stats_do_test "$what" "$nh1_id" "$nh2_id" "$group_id" \ 62 60 nh_stats_get "${mz[@]}" 63 61 64 - used=$(ip -s -j -d nexthop show id $group_id | 65 - jq '.[].hw_stats.used') 66 - kind=$(ip -j -d link show dev $rp11 | 67 - jq -r '.[].linkinfo.info_kind') 68 - if [[ $used == true ]]; then 62 + xfail_on_veth $rp11 \ 69 63 nh_stats_do_test "HW $what" "$nh1_id" "$nh2_id" "$group_id" \ 70 64 nh_stats_get_hw "${mz[@]}" 71 - elif [[ $kind == veth ]]; then 72 - log_test_xfail "HW stats not offloaded on veth topology" 73 - fi 74 65 } 75 66 76 67 nh_stats_test_dispatch() ··· 74 83 local mz="$@" 75 84 76 85 local enabled 77 - local kind 78 86 79 87 if ! ip nexthop help 2>&1 | grep -q hw_stats; then 80 88 log_test_skip "NH stats test: ip doesn't support HW stats"