Commit eb67bc3f authored by Luis R. Rodriguez's avatar Luis R. Rodriguez Committed by Greg Kroah-Hartman

tools: firmware: add fallback cancelation testing

Add a test case for cancelling the sync fallback mechanism.
Signed-off-by: default avatarLuis R. Rodriguez <mcgrof@kernel.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 823b0221
...@@ -58,6 +58,31 @@ load_fw() ...@@ -58,6 +58,31 @@ load_fw()
wait wait
} }
load_fw_cancel()
{
local name="$1"
local file="$2"
# This will block until our load (below) has finished.
echo -n "$name" >"$DIR"/trigger_request 2>/dev/null &
# Give kernel a chance to react.
local timeout=10
while [ ! -e "$DIR"/"$name"/loading ]; do
sleep 0.1
timeout=$(( $timeout - 1 ))
if [ "$timeout" -eq 0 ]; then
echo "$0: firmware interface never appeared" >&2
exit 1
fi
done
echo -1 >"$DIR"/"$name"/loading
# Wait for request to finish.
wait
}
trap "test_finish" EXIT trap "test_finish" EXIT
# This is an unlikely real-world firmware content. :) # This is an unlikely real-world firmware content. :)
...@@ -118,7 +143,14 @@ if ! diff -q "$FW" /dev/test_firmware >/dev/null ; then ...@@ -118,7 +143,14 @@ if ! diff -q "$FW" /dev/test_firmware >/dev/null ; then
exit 1 exit 1
else else
echo "$0: fallback mechanism works" echo "$0: fallback mechanism works"
fi
load_fw_cancel "nope-$NAME" "$FW"
if diff -q "$FW" /dev/test_firmware >/dev/null ; then
echo "$0: firmware was expected to be cancelled" >&2
exit 1
else
echo "$0: cancelling fallback mechanism works"
fi fi
exit 0 exit 0
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment