aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAmit Pundir <amit.pundir@linaro.org>2017-11-08 14:40:35 -0500
committerShuah Khan <shuahkh@osg.samsung.com>2017-11-15 10:27:57 -0500
commitc3e0d179bff503cd56758579a2c33216b40b9b7b (patch)
treed79c85045ead69c0eea78bd291ba3f1557ea27ba
parent157339a14ac41c710333b2abc18f5a6f52204625 (diff)
selftests: firmware: skip unsupported custom firmware fallback tests
Ignore custom firmware loading and cancellation tests on older kernel releases, which do not support this feature. Fixes: 061132d2b9c9 ("test_firmware: add test custom fallback trigger") Reviewed-by: Sumit Semwal <sumit.semwal@linaro.org> Acked-by: Luis R. Rodriguez <mcgrof@kernel.org> Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Amit Pundir <amit.pundir@linaro.org> Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
-rwxr-xr-xtools/testing/selftests/firmware/fw_fallback.sh38
1 files changed, 26 insertions, 12 deletions
diff --git a/tools/testing/selftests/firmware/fw_fallback.sh b/tools/testing/selftests/firmware/fw_fallback.sh
index a52a3bab532b..34a42c68ebfb 100755
--- a/tools/testing/selftests/firmware/fw_fallback.sh
+++ b/tools/testing/selftests/firmware/fw_fallback.sh
@@ -86,6 +86,11 @@ load_fw_cancel()
86 86
87load_fw_custom() 87load_fw_custom()
88{ 88{
89 if [ ! -e "$DIR"/trigger_custom_fallback ]; then
90 echo "$0: custom fallback trigger not present, ignoring test" >&2
91 return 1
92 fi
93
89 local name="$1" 94 local name="$1"
90 local file="$2" 95 local file="$2"
91 96
@@ -108,11 +113,17 @@ load_fw_custom()
108 113
109 # Wait for request to finish. 114 # Wait for request to finish.
110 wait 115 wait
116 return 0
111} 117}
112 118
113 119
114load_fw_custom_cancel() 120load_fw_custom_cancel()
115{ 121{
122 if [ ! -e "$DIR"/trigger_custom_fallback ]; then
123 echo "$0: canceling custom fallback trigger not present, ignoring test" >&2
124 return 1
125 fi
126
116 local name="$1" 127 local name="$1"
117 local file="$2" 128 local file="$2"
118 129
@@ -133,6 +144,7 @@ load_fw_custom_cancel()
133 144
134 # Wait for request to finish. 145 # Wait for request to finish.
135 wait 146 wait
147 return 0
136} 148}
137 149
138load_fw_fallback_with_child() 150load_fw_fallback_with_child()
@@ -227,20 +239,22 @@ else
227 echo "$0: cancelling fallback mechanism works" 239 echo "$0: cancelling fallback mechanism works"
228fi 240fi
229 241
230load_fw_custom "$NAME" "$FW" 242if load_fw_custom "$NAME" "$FW" ; then
231if ! diff -q "$FW" /dev/test_firmware >/dev/null ; then 243 if ! diff -q "$FW" /dev/test_firmware >/dev/null ; then
232 echo "$0: firmware was not loaded" >&2 244 echo "$0: firmware was not loaded" >&2
233 exit 1 245 exit 1
234else 246 else
235 echo "$0: custom fallback loading mechanism works" 247 echo "$0: custom fallback loading mechanism works"
248 fi
236fi 249fi
237 250
238load_fw_custom_cancel "nope-$NAME" "$FW" 251if load_fw_custom_cancel "nope-$NAME" "$FW" ; then
239if diff -q "$FW" /dev/test_firmware >/dev/null ; then 252 if diff -q "$FW" /dev/test_firmware >/dev/null ; then
240 echo "$0: firmware was expected to be cancelled" >&2 253 echo "$0: firmware was expected to be cancelled" >&2
241 exit 1 254 exit 1
242else 255 else
243 echo "$0: cancelling custom fallback mechanism works" 256 echo "$0: cancelling custom fallback mechanism works"
257 fi
244fi 258fi
245 259
246set +e 260set +e