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.

https://virtuozzo.atlassian.net/browse/VSTOR-121418

Signed-off-by: Aleksei Oladko <[email protected]>
---
 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 89c25f72b10c..7f22496bfdf9 100644
--- a/tools/testing/selftests/net/forwarding/lib.sh
+++ b/tools/testing/selftests/net/forwarding/lib.sh
@@ -955,9 +955,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

_______________________________________________
Devel mailing list
[email protected]
https://lists.openvz.org/mailman/listinfo/devel

Reply via email to