selftests/net/forwarding: teamd command not found
Subsystems (4)
PATCH 1/1 selftests/net/forwarding: teamd command not found
Running "make kselftest TARGETS=net/forwarding" results in several occurrences of the same error:
./lib.sh: line 787: teamd: command not found
Since many tests depends on teamd, this fix stops the tests if the teamd command is not installed.
--- tools/testing/selftests/net/forwarding/lib.sh | 1 + 1 file changed, 1 insertion(+)
tools/testing/selftests/net/forwarding/lib.sh +1 -0
@@ -784,6 +784,7 @@ team_destroy() { local if_name=$1; shift + require_command $TEAMD $TEAMD -t $if_name -k }
Signature · 1 line
2.43.0
Quoted 17 lines · Alessandro Zanni
Running "make kselftest TARGETS=net/forwarding" results in several occurrences of the same error:
./lib.sh: line 787: teamd: command not foundSince many tests depends on teamd, this fix stops the tests if the teamd command is not installed.
Signed-off-by Alessandro Zanni <[email protected]>--- tools/testing/selftests/net/forwarding/lib.sh | 1 + 1 file changed, 1 insertion(+)tools/testing/selftests/net/forwarding/lib.sh +0
-0
tools/testing/selftests/net/forwarding/lib.sh team_destroy() · line 789
Quoted 6 lines
tools/testing/selftests/net/forwarding/lib.sh +1
-0@@ -784,6 +784,7 @@ team_destroy() { local if_name=$1; shift + require_command $TEAMD $TEAMD -t $if_name -k }
I saw team_create() has require_command $TEAMD. Is some test called team_destroy() before team_create()?
Quoted 21 lines · Hangbin Liu
Quoted 20 lines · Alessandro Zanni
Running "make kselftest TARGETS=net/forwarding" results in several occurrences of the same error:
./lib.sh: line 787: teamd: command not foundSince many tests depends on teamd, this fix stops the tests if the teamd command is not installed.
Signed-off-by Alessandro Zanni <[email protected]>--- tools/testing/selftests/net/forwarding/lib.sh | 1 + 1 file changed, 1 insertion(+)tools/testing/selftests/net/forwarding/lib.sh +0
-0@@ -784,6 +784,7 @@ team_destroy() { local if_name=$1; shift
Quoted 6 lines
tools/testing/selftests/net/forwarding/lib.sh team_destroy() · line 789
Quoted 3 lines
tools/testing/selftests/net/forwarding/lib.sh +1
-0+ require_command $TEAMD $TEAMD -t $if_name -k }I saw
team_create()hasrequire_command $TEAMD. Is some test calledteam_destroy()beforeteam_create()?
Actually, the errors seem to raise in the "cleanup()" method.
So, first, during the test preparation the "team_create()" method is called and checks if teamd is installed.
When it fails and skips the test, the "cleanup()" method calls the "team_destroy()" that raises the errors.
Hangbin Liu
Reviewed-byQuoted 29 lines · Alessandro Zanni
Quoted 21 lines · Hangbin Liu
Quoted 20 lines · Alessandro Zanni
Running "make kselftest TARGETS=net/forwarding" results in several occurrences of the same error:
./lib.sh: line 787: teamd: command not foundSince many tests depends on teamd, this fix stops the tests if the teamd command is not installed.
Signed-off-by Alessandro Zanni <[email protected]>--- tools/testing/selftests/net/forwarding/lib.sh | 1 + 1 file changed, 1 insertion(+)tools/testing/selftests/net/forwarding/lib.sh +0
-0@@ -784,6 +784,7 @@ team_destroy() { local if_name=$1; shiftQuoted 6 lines
tools/testing/selftests/net/forwarding/lib.sh team_destroy() · line 789
Quoted 3 lines
tools/testing/selftests/net/forwarding/lib.sh +1
-0+ require_command $TEAMD $TEAMD -t $if_name -k }I saw
team_create()hasrequire_command $TEAMD. Is some test calledteam_destroy()beforeteam_create()?
Quoted 7 lines
Actually, the errors seem to raise in the "
cleanup()" method.So, first, during the test preparation the "
team_create()" method is called and checks if teamd is installed.
When it fails and skips the test, the "cleanup()" method calls the "team_destroy()" that raises the errors.
Thanks for the clarify.
Jakub Kicinski
maintainerQuoted 29 lines · On Fri, 10 Jan 2025 15:35:23 +0100 Alessandro Zanni wrote:
Quoted 21 lines · Hangbin Liu
Quoted 20 lines · Alessandro Zanni
Running "make kselftest TARGETS=net/forwarding" results in several occurrences of the same error:
./lib.sh: line 787: teamd: command not foundSince many tests depends on teamd, this fix stops the tests if the teamd command is not installed.
Signed-off-by Alessandro Zanni <[email protected]>--- tools/testing/selftests/net/forwarding/lib.sh | 1 + 1 file changed, 1 insertion(+)tools/testing/selftests/net/forwarding/lib.sh +0
-0@@ -784,6 +784,7 @@ team_destroy() { local if_name=$1; shiftQuoted 6 lines
tools/testing/selftests/net/forwarding/lib.sh team_destroy() · line 789
Quoted 3 lines
tools/testing/selftests/net/forwarding/lib.sh +1
-0+ require_command $TEAMD $TEAMD -t $if_name -k }I saw
team_create()hasrequire_command $TEAMD. Is some test calledteam_destroy()beforeteam_create()?
Quoted 6 lines
Actually, the errors seem to raise in the "
cleanup()" method.So, first, during the test preparation the "
team_create()" method is called and checks if teamd is installed.
When it fails and skips the test, the "cleanup()" method calls the "team_destroy()" that raises the errors.
Actually, maybe we're better off switching the team handling to the way REQUIRE_JQ REQUIRE_MZ etc are handled? That way we'll validate and exit when lib is imported / sourced.
Petr, do you have a preference?
Signature · 1 line
pw-bot: cr
Quoted 37 lines · Jakub Kicinski
Quoted 29 lines · On Fri, 10 Jan 2025 15:35:23 +0100 Alessandro Zanni wrote:
Quoted 21 lines · Hangbin Liu
Quoted 20 lines · Alessandro Zanni
Running "make kselftest TARGETS=net/forwarding" results in several occurrences of the same error:
./lib.sh: line 787: teamd: command not foundSince many tests depends on teamd, this fix stops the tests if the teamd command is not installed.
Signed-off-by Alessandro Zanni <[email protected]>--- tools/testing/selftests/net/forwarding/lib.sh | 1 + 1 file changed, 1 insertion(+)tools/testing/selftests/net/forwarding/lib.sh +0
-0@@ -784,6 +784,7 @@ team_destroy() { local if_name=$1; shiftQuoted 6 lines
tools/testing/selftests/net/forwarding/lib.sh team_destroy() · line 789
Quoted 3 lines
tools/testing/selftests/net/forwarding/lib.sh +1
-0+ require_command $TEAMD $TEAMD -t $if_name -k }I saw
team_create()hasrequire_command $TEAMD. Is some test calledteam_destroy()beforeteam_create()?Quoted 6 lines
Actually, the errors seem to raise in the "
cleanup()" method.So, first, during the test preparation the "
team_create()" method is called and checks if teamd is installed.
When it fails and skips the test, the "cleanup()" method calls the "team_destroy()" that raises the errors.
Quoted 5 lines
Actually, maybe we're better off switching the team handling to the way
REQUIRE_JQREQUIRE_MZetc are handled? That way we'll validate and exit when lib is imported / sourced.Petr, do you have a preference?
Yeah, that would be better.
My first though was that this is fine, because it's just for tests that don't use defer. (With defer, if the creation bails out, you never schedule the cleanup.)
But if you bail out early from team_destroy(), the rest of the cleanups will be skipped, which is bad.
So maybe we need something like this:
$TEAMD -t $if_name -k 2>/dev/null ||:
... i.e. to just quietly tolerate failures. But that's no good either, because then you never catch issues with the cleanup itself even in valid runs. So maybe team_create() should note whether $TEAMD was found and do this conditionally, but at that point, going with REQUIRE_TEAMD is the cleaner solution.
It looks like we have 7 scripts that use team_create(), so it's not crazy to just fix them all.