diff mbox series

[net-next] selftests: netdevsim: be less selective for FW for the devlink test

Message ID 20240224050658.930272-1-kuba@kernel.org (mailing list archive)
State Accepted
Commit b819a8481a19043ca990980dd56b1a41389c665c
Delegated to: Netdev Maintainers
Headers show
Series [net-next] selftests: netdevsim: be less selective for FW for the devlink test | expand

Checks

Context Check Description
netdev/series_format success Single patches do not need cover letters
netdev/tree_selection success Clearly marked for net-next
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 8 this patch: 8
netdev/build_tools success Errors and warnings before: 0 this patch: 0
netdev/cc_maintainers fail 2 maintainers not CCed: shuah@kernel.org linux-kselftest@vger.kernel.org
netdev/build_clang success Errors and warnings before: 8 this patch: 8
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 No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 8 this patch: 8
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 8 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 success net-next-2024-02-25--03-00 (tests: 1457)

Commit Message

Jakub Kicinski Feb. 24, 2024, 5:06 a.m. UTC
Commit 6151ff9c7521 ("selftests: netdevsim: use suitable existing dummy
file for flash test") introduced a nice trick to the devlink flashing
test. Instead of user having to create a file under /lib/firmware
we just pick the first one that already exists.

Sadly, in AWS Linux there are no files directly under /lib/firmware,
only in subdirectories. Don't limit the search to -maxdepth 1.
We can use the %P print format to get the correct path for files
inside subdirectories:

$ find /lib/firmware -type f -printf '%P\n' | head -1
intel-ucode/06-1a-05

The full path is /lib/firmware/intel-ucode/06-1a-05

This works in GNU find, busybox doesn't have printf at all,
so we're not making it worse.

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
 tools/testing/selftests/drivers/net/netdevsim/devlink.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Jiri Pirko Feb. 26, 2024, 9:24 a.m. UTC | #1
Sat, Feb 24, 2024 at 06:06:58AM CET, kuba@kernel.org wrote:
>Commit 6151ff9c7521 ("selftests: netdevsim: use suitable existing dummy
>file for flash test") introduced a nice trick to the devlink flashing
>test. Instead of user having to create a file under /lib/firmware
>we just pick the first one that already exists.
>
>Sadly, in AWS Linux there are no files directly under /lib/firmware,

Ah :)


>only in subdirectories. Don't limit the search to -maxdepth 1.
>We can use the %P print format to get the correct path for files
>inside subdirectories:
>
>$ find /lib/firmware -type f -printf '%P\n' | head -1
>intel-ucode/06-1a-05
>
>The full path is /lib/firmware/intel-ucode/06-1a-05
>
>This works in GNU find, busybox doesn't have printf at all,
>so we're not making it worse.
>
>Signed-off-by: Jakub Kicinski <kuba@kernel.org>

Reviewed-by: Jiri Pirko <jiri@nvidia.com>
patchwork-bot+netdevbpf@kernel.org Feb. 27, 2024, 2:30 p.m. UTC | #2
Hello:

This patch was applied to netdev/net-next.git (main)
by Paolo Abeni <pabeni@redhat.com>:

On Fri, 23 Feb 2024 21:06:58 -0800 you wrote:
> Commit 6151ff9c7521 ("selftests: netdevsim: use suitable existing dummy
> file for flash test") introduced a nice trick to the devlink flashing
> test. Instead of user having to create a file under /lib/firmware
> we just pick the first one that already exists.
> 
> Sadly, in AWS Linux there are no files directly under /lib/firmware,
> only in subdirectories. Don't limit the search to -maxdepth 1.
> We can use the %P print format to get the correct path for files
> inside subdirectories:
> 
> [...]

Here is the summary with links:
  - [net-next] selftests: netdevsim: be less selective for FW for the devlink test
    https://git.kernel.org/netdev/net-next/c/b819a8481a19

You are awesome, thank you!
diff mbox series

Patch

diff --git a/tools/testing/selftests/drivers/net/netdevsim/devlink.sh b/tools/testing/selftests/drivers/net/netdevsim/devlink.sh
index 46e20b13473c..b5ea2526f23c 100755
--- a/tools/testing/selftests/drivers/net/netdevsim/devlink.sh
+++ b/tools/testing/selftests/drivers/net/netdevsim/devlink.sh
@@ -31,7 +31,7 @@  devlink_wait()
 
 fw_flash_test()
 {
-	DUMMYFILE=$(find /lib/firmware -maxdepth 1 -type f  -printf '%f\n' |head -1)
+	DUMMYFILE=$(find /lib/firmware -type f -printf '%P\n' | head -1)
 	RET=0
 
 	if [ -z "$DUMMYFILE" ]