aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorBrian Norris <computersforpeace@gmail.com>2015-12-09 17:50:29 -0500
committerShuah Khan <shuahkh@osg.samsung.com>2016-01-07 16:41:07 -0500
commit1b1fe542b6f010cf6bc7e1c92805e1c0e133e007 (patch)
tree6443ea9d6072c5fb4057b4ffbc68f163fcfe5b70 /tools
parent715780ae4bb76d6fd2f20eb78e2a9ba9769a6cdc (diff)
selftests: firmware: add empty string and async tests
Now that we've added a 'trigger_async_request' knob to test the request_firmware_nowait() API, let's use it. Also add tests for the empty ("") string, since there have been a couple errors in that handling already. Since we now have real ways that the sysfs write might fail, let's add the appropriate check on the 'echo' lines too. Signed-off-by: Brian Norris <computersforpeace@gmail.com> Acked-by: Kees Cook <keescook@chromium.org> Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
Diffstat (limited to 'tools')
-rwxr-xr-xtools/testing/selftests/firmware/fw_filesystem.sh29
1 files changed, 28 insertions, 1 deletions
diff --git a/tools/testing/selftests/firmware/fw_filesystem.sh b/tools/testing/selftests/firmware/fw_filesystem.sh
index c4366dc74e01..5c495ad7958a 100755
--- a/tools/testing/selftests/firmware/fw_filesystem.sh
+++ b/tools/testing/selftests/firmware/fw_filesystem.sh
@@ -48,8 +48,21 @@ echo "ABCD0123" >"$FW"
48 48
49NAME=$(basename "$FW") 49NAME=$(basename "$FW")
50 50
51if printf '\000' >"$DIR"/trigger_request; then
52 echo "$0: empty filename should not succeed" >&2
53 exit 1
54fi
55
56if printf '\000' >"$DIR"/trigger_async_request; then
57 echo "$0: empty filename should not succeed (async)" >&2
58 exit 1
59fi
60
51# Request a firmware that doesn't exist, it should fail. 61# Request a firmware that doesn't exist, it should fail.
52echo -n "nope-$NAME" >"$DIR"/trigger_request 62if echo -n "nope-$NAME" >"$DIR"/trigger_request; then
63 echo "$0: firmware shouldn't have loaded" >&2
64 exit 1
65fi
53if diff -q "$FW" /dev/test_firmware >/dev/null ; then 66if diff -q "$FW" /dev/test_firmware >/dev/null ; then
54 echo "$0: firmware was not expected to match" >&2 67 echo "$0: firmware was not expected to match" >&2
55 exit 1 68 exit 1
@@ -74,4 +87,18 @@ else
74 echo "$0: filesystem loading works" 87 echo "$0: filesystem loading works"
75fi 88fi
76 89
90# Try the asynchronous version too
91if ! echo -n "$NAME" >"$DIR"/trigger_async_request ; then
92 echo "$0: could not trigger async request" >&2
93 exit 1
94fi
95
96# Verify the contents are what we expect.
97if ! diff -q "$FW" /dev/test_firmware >/dev/null ; then
98 echo "$0: firmware was not loaded (async)" >&2
99 exit 1
100else
101 echo "$0: async filesystem loading works"
102fi
103
77exit 0 104exit 0