diff options
author | Brian Norris <computersforpeace@gmail.com> | 2015-12-09 17:50:29 -0500 |
---|---|---|
committer | Shuah Khan <shuahkh@osg.samsung.com> | 2016-01-07 16:41:07 -0500 |
commit | 1b1fe542b6f010cf6bc7e1c92805e1c0e133e007 (patch) | |
tree | 6443ea9d6072c5fb4057b4ffbc68f163fcfe5b70 /tools | |
parent | 715780ae4bb76d6fd2f20eb78e2a9ba9769a6cdc (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-x | tools/testing/selftests/firmware/fw_filesystem.sh | 29 |
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 | ||
49 | NAME=$(basename "$FW") | 49 | NAME=$(basename "$FW") |
50 | 50 | ||
51 | if printf '\000' >"$DIR"/trigger_request; then | ||
52 | echo "$0: empty filename should not succeed" >&2 | ||
53 | exit 1 | ||
54 | fi | ||
55 | |||
56 | if printf '\000' >"$DIR"/trigger_async_request; then | ||
57 | echo "$0: empty filename should not succeed (async)" >&2 | ||
58 | exit 1 | ||
59 | fi | ||
60 | |||
51 | # Request a firmware that doesn't exist, it should fail. | 61 | # Request a firmware that doesn't exist, it should fail. |
52 | echo -n "nope-$NAME" >"$DIR"/trigger_request | 62 | if echo -n "nope-$NAME" >"$DIR"/trigger_request; then |
63 | echo "$0: firmware shouldn't have loaded" >&2 | ||
64 | exit 1 | ||
65 | fi | ||
53 | if diff -q "$FW" /dev/test_firmware >/dev/null ; then | 66 | if 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" |
75 | fi | 88 | fi |
76 | 89 | ||
90 | # Try the asynchronous version too | ||
91 | if ! echo -n "$NAME" >"$DIR"/trigger_async_request ; then | ||
92 | echo "$0: could not trigger async request" >&2 | ||
93 | exit 1 | ||
94 | fi | ||
95 | |||
96 | # Verify the contents are what we expect. | ||
97 | if ! diff -q "$FW" /dev/test_firmware >/dev/null ; then | ||
98 | echo "$0: firmware was not loaded (async)" >&2 | ||
99 | exit 1 | ||
100 | else | ||
101 | echo "$0: async filesystem loading works" | ||
102 | fi | ||
103 | |||
77 | exit 0 | 104 | exit 0 |