aboutsummaryrefslogtreecommitdiffstats
path: root/tools/testing/selftests/firmware/fw_filesystem.sh
diff options
context:
space:
mode:
authorLuis R. Rodriguez <mcgrof@kernel.org>2018-03-10 06:14:53 -0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-03-20 09:28:47 +0100
commitf5a614519e67b429faf01ca36db90030976449cc (patch)
tree4d4c9c3f5d2a16edc1fb9153c4ab2e6b078140e6 /tools/testing/selftests/firmware/fw_filesystem.sh
parentfirmware: enable to force disable the fallback mechanism at run time (diff)
downloadlinux-dev-f5a614519e67b429faf01ca36db90030976449cc.tar.xz
linux-dev-f5a614519e67b429faf01ca36db90030976449cc.zip
test_firmware: expand on library with shared helpers
This expands our library with as many things we could find which both scripts we use share. 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_filesystem.sh')
-rwxr-xr-xtools/testing/selftests/firmware/fw_filesystem.sh41
1 files changed, 5 insertions, 36 deletions
diff --git a/tools/testing/selftests/firmware/fw_filesystem.sh b/tools/testing/selftests/firmware/fw_filesystem.sh
index 748f2f5737e9..7f47877fa7fa 100755
--- a/tools/testing/selftests/firmware/fw_filesystem.sh
+++ b/tools/testing/selftests/firmware/fw_filesystem.sh
@@ -6,38 +6,15 @@
# know so we can be sure we're not accidentally testing the user helper.
set -e
+TEST_REQS_FW_SYSFS_FALLBACK="no"
+TEST_REQS_FW_SET_CUSTOM_PATH="yes"
TEST_DIR=$(dirname $0)
source $TEST_DIR/fw_lib.sh
check_mods
-
-# CONFIG_FW_LOADER_USER_HELPER has a sysfs class under /sys/class/firmware/
-# These days most distros enable CONFIG_FW_LOADER_USER_HELPER but disable
-# CONFIG_FW_LOADER_USER_HELPER_FALLBACK. We use /sys/class/firmware/ as an
-# indicator for CONFIG_FW_LOADER_USER_HELPER.
-HAS_FW_LOADER_USER_HELPER=$(if [ -d /sys/class/firmware/ ]; then echo yes; else echo no; fi)
-
-if [ "$HAS_FW_LOADER_USER_HELPER" = "yes" ]; then
- OLD_TIMEOUT=$(cat /sys/class/firmware/timeout)
-fi
-
-OLD_FWPATH=$(cat /sys/module/firmware_class/parameters/path)
-
-FWPATH=$(mktemp -d)
-FW="$FWPATH/test-firmware.bin"
-
-test_finish()
-{
- if [ "$HAS_FW_LOADER_USER_HELPER" = "yes" ]; then
- echo "$OLD_TIMEOUT" >/sys/class/firmware/timeout
- fi
- if [ "$OLD_FWPATH" = "" ]; then
- OLD_FWPATH=" "
- fi
- echo -n "$OLD_FWPATH" >/sys/module/firmware_class/parameters/path
- rm -f "$FW"
- rmdir "$FWPATH"
-}
+check_setup
+verify_reqs
+setup_tmp_file
trap "test_finish" EXIT
@@ -46,14 +23,6 @@ if [ "$HAS_FW_LOADER_USER_HELPER" = "yes" ]; then
echo 1 >/sys/class/firmware/timeout
fi
-# Set the kernel search path.
-echo -n "$FWPATH" >/sys/module/firmware_class/parameters/path
-
-# This is an unlikely real-world firmware content. :)
-echo "ABCD0123" >"$FW"
-
-NAME=$(basename "$FW")
-
if printf '\000' >"$DIR"/trigger_request 2> /dev/null; then
echo "$0: empty filename should not succeed" >&2
exit 1