Skip to content

Commit ed1deec

Browse files
computersforpeacegregkh
authored andcommitted
selftests: firmware: add empty string and async tests
commit 1b1fe542b6f010cf6bc7e1c92805e1c0e133e007 upstream. 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> [AmitP: Dropped the async trigger testing parts from original commit] Signed-off-by: Amit Pundir <amit.pundir@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent c08f3a8 commit ed1deec

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

tools/testing/selftests/firmware/fw_filesystem.sh

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,16 @@ echo "ABCD0123" >"$FW"
4848

4949
NAME=$(basename "$FW")
5050

51+
if printf '\000' >"$DIR"/trigger_request; then
52+
echo "$0: empty filename should not succeed" >&2
53+
exit 1
54+
fi
55+
5156
# Request a firmware that doesn't exist, it should fail.
52-
echo -n "nope-$NAME" >"$DIR"/trigger_request
57+
if echo -n "nope-$NAME" >"$DIR"/trigger_request; then
58+
echo "$0: firmware shouldn't have loaded" >&2
59+
exit 1
60+
fi
5361
if diff -q "$FW" /dev/test_firmware >/dev/null ; then
5462
echo "$0: firmware was not expected to match" >&2
5563
exit 1

0 commit comments

Comments
 (0)