Some kselftests rely on teamd to create LAG devices. If the kernel is
built without CONFIG_NET_TEAM, the teamd command fails with:
Failed: Operation not supported
Currently, the exit code of teamd is not properly checked, causing
the test to proceed and eventually fail instead of being skipped.
Add a check for the teamd exit code, mark the test as skipped
to avoid self-positive failures.
Signed-off-by: Aleksei Oladko <aleksey.oladko@virtuozzo.com>
---
tools/testing/selftests/net/forwarding/lib.sh | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/tools/testing/selftests/net/forwarding/lib.sh b/tools/testing/selftests/net/forwarding/lib.sh
index a9034f0bb58b..0a474b02371d 100644
--- a/tools/testing/selftests/net/forwarding/lib.sh
+++ b/tools/testing/selftests/net/forwarding/lib.sh
@@ -771,9 +771,21 @@ team_create()
{
local if_name=$1; shift
local mode=$1; shift
+ local output
+ local status
require_command $TEAMD
- $TEAMD -t $if_name -d -c '{"runner": {"name": "'$mode'"}}'
+ output=$($TEAMD -t $if_name -d -c '{"runner": {"name": "'$mode'"}}' 2>&1)
+ status=$?
+
+ if [ $status -ne 0 ]; then
+ if echo "$output" | grep -q "Operation not supported"; then
+ exit $ksft_skip
+ else
+ exit 1
+ fi
+ fi
+
for slave in "$@"; do
ip link set dev $slave down
ip link set dev $slave master $if_name
--
2.43.0