[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20170123161111.5925-6-mcgrof@kernel.org>
Date: Mon, 23 Jan 2017 08:11:09 -0800
From: "Luis R. Rodriguez" <mcgrof@...nel.org>
To: gregkh@...uxfoundation.org
Cc: ming.lei@...onical.com, keescook@...omium.org,
linux-kernel-dev@...khoff.com, jakub.kicinski@...ronome.com,
chris@...is-wilson.co.uk, oss-drivers@...ronome.com,
johannes@...solutions.net, j@...fi, teg@...m.no, kay@...y.org,
jwboyer@...oraproject.org, dmitry.torokhov@...il.com,
seth.forshee@...onical.com, bjorn.andersson@...aro.org,
linux-kernel@...r.kernel.org, wagi@...om.org,
stephen.boyd@...aro.org, zohar@...ux.vnet.ibm.com, tiwai@...e.de,
dwmw2@...radead.org, fengguang.wu@...el.com, dhowells@...hat.com,
arend.vanspriel@...adcom.com, kvalo@...eaurora.org,
"Luis R. Rodriguez" <mcgrof@...nel.org>
Subject: [PATCH 5/7] tools: firmware: add fallback cancelation testing
Add a test case for cancelling the sync fallback mechanism.
Signed-off-by: Luis R. Rodriguez <mcgrof@...nel.org>
---
tools/testing/selftests/firmware/fw_fallback.sh | 32 +++++++++++++++++++++++++
1 file changed, 32 insertions(+)
diff --git a/tools/testing/selftests/firmware/fw_fallback.sh b/tools/testing/selftests/firmware/fw_fallback.sh
index f694afb7d12d..68e27e5f27a4 100755
--- a/tools/testing/selftests/firmware/fw_fallback.sh
+++ b/tools/testing/selftests/firmware/fw_fallback.sh
@@ -58,6 +58,31 @@ load_fw()
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
# This is an unlikely real-world firmware content. :)
@@ -118,7 +143,14 @@ if ! diff -q "$FW" /dev/test_firmware >/dev/null ; then
exit 1
else
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
exit 0
--
2.11.0
Powered by blists - more mailing lists