selftests: netdevsim: be less selective for FW for the devlink test
authorJakub Kicinski <kuba@kernel.org>
Sat, 24 Feb 2024 05:06:58 +0000 (21:06 -0800)
committerPaolo Abeni <pabeni@redhat.com>
Tue, 27 Feb 2024 14:20:08 +0000 (15:20 +0100)
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>
Reviewed-by: Jiri Pirko <jiri@nvidia.com>
Link: https://lore.kernel.org/r/20240224050658.930272-1-kuba@kernel.org
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
tools/testing/selftests/drivers/net/netdevsim/devlink.sh

index 46e20b13473c3c4bd64ad7e003a850a2bbd6b843..b5ea2526f23c46e44af94c6e5d4f8fe578e5dfde 100755 (executable)
@@ -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" ]