diff mbox series

[net] selftests: rtnetlink: add 'ethtool' as a dependency

Message ID 20240903151524.586614-1-anezbeda@redhat.com (mailing list archive)
State Superseded
Delegated to: Netdev Maintainers
Headers show
Series [net] selftests: rtnetlink: add 'ethtool' as a dependency | expand

Checks

Context Check Description
netdev/series_format success Single patches do not need cover letters
netdev/tree_selection success Clearly marked for net
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag present in non-next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 7 this patch: 7
netdev/build_tools success Errors and warnings before: 0 this patch: 0
netdev/cc_maintainers warning 5 maintainers not CCed: pabeni@redhat.com kuba@kernel.org edumazet@google.com shuah@kernel.org linux-kselftest@vger.kernel.org
netdev/build_clang success Errors and warnings before: 7 this patch: 7
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success net selftest script(s) already in Makefile
netdev/verify_fixes success Fixes tag looks correct
netdev/build_allmodconfig_warn success Errors and warnings before: 7 this patch: 7
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 18 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0
netdev/contest fail net-next-2024-09-03--18-00 (tests: 714)

Commit Message

Ales Nezbeda Sept. 3, 2024, 3:15 p.m. UTC
Introduction of `kci_test_macsec_offload()` in `rtnetlink.sh` created
a new dependency `ethtool` for the test suite. This dependency is not
reflected in checks that run before all the tests, so if the `ethtool`
is not present, all tests will start, but `macsec_offload` test will
fail with a misleading message. Message would say that MACsec offload is
not supported, yet it never actually managed to check this, since it
needs the `ethtool` to do so.

Fixes: 3b5222e2ac57 ("selftests: rtnetlink: add MACsec offload tests")
Signed-off-by: Ales Nezbeda <anezbeda@redhat.com>
---
 tools/testing/selftests/net/rtnetlink.sh | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Stanislav Fomichev Sept. 3, 2024, 8:28 p.m. UTC | #1
On 09/03, Ales Nezbeda wrote:
> Introduction of `kci_test_macsec_offload()` in `rtnetlink.sh` created
> a new dependency `ethtool` for the test suite. This dependency is not
> reflected in checks that run before all the tests, so if the `ethtool`
> is not present, all tests will start, but `macsec_offload` test will
> fail with a misleading message. Message would say that MACsec offload is
> not supported, yet it never actually managed to check this, since it
> needs the `ethtool` to do so.
> 
> Fixes: 3b5222e2ac57 ("selftests: rtnetlink: add MACsec offload tests")
> Signed-off-by: Ales Nezbeda <anezbeda@redhat.com>
> ---
>  tools/testing/selftests/net/rtnetlink.sh | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/tools/testing/selftests/net/rtnetlink.sh b/tools/testing/selftests/net/rtnetlink.sh
> index bdf6f10d0558..fdd116458222 100755
> --- a/tools/testing/selftests/net/rtnetlink.sh
> +++ b/tools/testing/selftests/net/rtnetlink.sh
> @@ -1306,6 +1306,7 @@ if [ "$(id -u)" -ne 0 ];then
>  	exit $ksft_skip
>  fi
>  
> +#check for dependencies
>  for x in ip tc;do
>  	$x -Version 2>/dev/null >/dev/null
>  	if [ $? -ne 0 ];then
> @@ -1313,6 +1314,11 @@ for x in ip tc;do
>  		exit $ksft_skip
>  	fi
>  done
> +ethtool --version 2>/dev/null >/dev/null
> +if [ $? -ne 0 ];then
> +	end_test "SKIP: Could not run test without the ethtool tool"
> +	exit $ksft_skip
> +fi

Can we use a 'require_command ethtool' (lib.sh helper) instead?
Ales Nezbeda Sept. 8, 2024, 11:09 p.m. UTC | #2
On Tue, Sep 3, 2024 at 10:28 PM Stanislav Fomichev <sdf@fomichev.me> wrote:
> Can we use a 'require_command ethtool' (lib.sh helper) instead?

Hi, I apologize for not responding so long, I have looked at the
function from the `lib.sh` helper you mentioned. Thanks for pointing
it out, it is a much cleaner solution and would resolve the need to
test 'ip' and 'tc' differently from the 'ethtool'. It seems that it is
currently not present in the `lib.sh` file that is used in the
`rtnetlink.sh` that is modified by the patch.

There are multiple versions of `lib.sh` file, and the
`require_command` function is defined in only two of them. It looks
like some of the tests are reusing the `lib.sh` file that does contain
the `require_command` function from other tests (like
`selftests/drivers/net/netdevsim/psample.sh`), but I feel like adding
the `require_command` function to the currently used `lib.sh` file is
a cleaner solution.

I will create a new patch that will add the `require_command` to
`lib.sh` file and rewrite the check in `rtnetlink.sh` to use that
function.
diff mbox series

Patch

diff --git a/tools/testing/selftests/net/rtnetlink.sh b/tools/testing/selftests/net/rtnetlink.sh
index bdf6f10d0558..fdd116458222 100755
--- a/tools/testing/selftests/net/rtnetlink.sh
+++ b/tools/testing/selftests/net/rtnetlink.sh
@@ -1306,6 +1306,7 @@  if [ "$(id -u)" -ne 0 ];then
 	exit $ksft_skip
 fi
 
+#check for dependencies
 for x in ip tc;do
 	$x -Version 2>/dev/null >/dev/null
 	if [ $? -ne 0 ];then
@@ -1313,6 +1314,11 @@  for x in ip tc;do
 		exit $ksft_skip
 	fi
 done
+ethtool --version 2>/dev/null >/dev/null
+if [ $? -ne 0 ];then
+	end_test "SKIP: Could not run test without the ethtool tool"
+	exit $ksft_skip
+fi
 
 while getopts t:hvpP o; do
 	case $o in