diff options
author | Luis R. Rodriguez <mcgrof@kernel.org> | 2018-03-10 06:14:58 -0800 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2018-03-20 09:28:47 +0100 |
commit | 9952db75e0659d9db62d76d9a351fdae06898642 (patch) | |
tree | fb97369618a504a9e01dee76de493f65fab9f11b /tools/testing/selftests/firmware/fw_lib.sh | |
parent | 3194d06a7e41d31ea4d8771b1ff3d93445e27403 (diff) | |
download | linux-9952db75e0659d9db62d76d9a351fdae06898642.tar.gz linux-9952db75e0659d9db62d76d9a351fdae06898642.tar.xz |
test_firmware: modify custom fallback tests to use unique files
Users of the custom firmware fallback interface is are not supposed to
use the firmware cache interface, this can happen if for instance the
one of the APIs which use the firmware cache is used first with one
firmware file and then the request_firmware_nowait(uevent=false) API
is used with the same file.
We'll soon become strict about this on the firmware interface to reject
such calls later, so correct the test scripts to avoid such uses as well.
We address this on the tests scripts by simply using unique names when
testing the custom fallback interface.
Signed-off-by: Luis R. Rodriguez <mcgrof@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'tools/testing/selftests/firmware/fw_lib.sh')
-rwxr-xr-x | tools/testing/selftests/firmware/fw_lib.sh | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/tools/testing/selftests/firmware/fw_lib.sh b/tools/testing/selftests/firmware/fw_lib.sh index 98dceb847ba0..9ea31b57d71a 100755 --- a/tools/testing/selftests/firmware/fw_lib.sh +++ b/tools/testing/selftests/firmware/fw_lib.sh @@ -104,6 +104,29 @@ setup_tmp_file() fi } +__setup_random_file() +{ + RANDOM_FILE_PATH="$(mktemp -p $FWPATH)" + # mktemp says dry-run -n is unsafe, so... + if [[ "$1" = "fake" ]]; then + rm -rf $RANDOM_FILE_PATH + sync + else + echo "ABCD0123" >"$RANDOM_FILE_PATH" + fi + echo $RANDOM_FILE_PATH +} + +setup_random_file() +{ + echo $(__setup_random_file) +} + +setup_random_file_fake() +{ + echo $(__setup_random_file fake) +} + proc_set_force_sysfs_fallback() { if [ -f $FW_FORCE_SYSFS_FALLBACK ]; then |