]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
selftests: forwarding: router_mpath_nh_lib: Don't skip, xfail on veth
authorPetr Machata <petrm@nvidia.com>
Tue, 26 Mar 2024 16:54:40 +0000 (17:54 +0100)
committerJakub Kicinski <kuba@kernel.org>
Fri, 29 Mar 2024 01:03:43 +0000 (18:03 -0700)
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>
tools/testing/selftests/net/forwarding/lib.sh
tools/testing/selftests/net/forwarding/router_mpath_nh_lib.sh

index 58df57855bff304c00b7d3aa5109a34fe84a2438..4103ed7afcde3d31144380eec3637e73736a0743 100644 (file)
@@ -459,6 +459,20 @@ xfail_on_slow()
        fi
 }
 
+xfail_on_veth()
+{
+       local dev=$1; shift
+       local kind
+
+       kind=$(ip -j -d link show dev $dev |
+                       jq -r '.[].linkinfo.info_kind')
+       if [[ $kind = veth ]]; then
+               FAIL_TO_XFAIL=yes "$@"
+       else
+               "$@"
+       fi
+}
+
 log_test_result()
 {
        local test_name=$1; shift
index b2d2c6cecc01eae4d9637516a2bfdcc69b61054a..2903294d8bca0c5f063269fdc5076a180562d352 100644 (file)
@@ -56,21 +56,12 @@ nh_stats_test_dispatch_swhw()
        local group_id=$1; shift
        local mz="$@"
 
-       local used
-
        nh_stats_do_test "$what" "$nh1_id" "$nh2_id" "$group_id" \
                         nh_stats_get "${mz[@]}"
 
-       used=$(ip -s -j -d nexthop show id $group_id |
-                  jq '.[].hw_stats.used')
-       kind=$(ip -j -d link show dev $rp11 |
-                  jq -r '.[].linkinfo.info_kind')
-       if [[ $used == true ]]; then
+       xfail_on_veth $rp11 \
                nh_stats_do_test "HW $what" "$nh1_id" "$nh2_id" "$group_id" \
                                 nh_stats_get_hw "${mz[@]}"
-       elif [[ $kind == veth ]]; then
-               log_test_xfail "HW stats not offloaded on veth topology"
-       fi
 }
 
 nh_stats_test_dispatch()
@@ -83,7 +74,6 @@ nh_stats_test_dispatch()
        local mz="$@"
 
        local enabled
-       local kind
 
        if ! ip nexthop help 2>&1 | grep -q hw_stats; then
                log_test_skip "NH stats test: ip doesn't support HW stats"