diff options
| author | Amit Pundir <amit.pundir@linaro.org> | 2017-11-08 14:40:35 -0500 |
|---|---|---|
| committer | Shuah Khan <shuahkh@osg.samsung.com> | 2017-11-15 10:27:57 -0500 |
| commit | c3e0d179bff503cd56758579a2c33216b40b9b7b (patch) | |
| tree | d79c85045ead69c0eea78bd291ba3f1557ea27ba | |
| parent | 157339a14ac41c710333b2abc18f5a6f52204625 (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-x | tools/testing/selftests/firmware/fw_fallback.sh | 38 |
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 | ||
| 87 | load_fw_custom() | 87 | load_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 | ||
| 114 | load_fw_custom_cancel() | 120 | load_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 | ||
| 138 | load_fw_fallback_with_child() | 150 | load_fw_fallback_with_child() |
| @@ -227,20 +239,22 @@ else | |||
| 227 | echo "$0: cancelling fallback mechanism works" | 239 | echo "$0: cancelling fallback mechanism works" |
| 228 | fi | 240 | fi |
| 229 | 241 | ||
| 230 | load_fw_custom "$NAME" "$FW" | 242 | if load_fw_custom "$NAME" "$FW" ; then |
| 231 | if ! 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 |
| 234 | else | 246 | else |
| 235 | echo "$0: custom fallback loading mechanism works" | 247 | echo "$0: custom fallback loading mechanism works" |
| 248 | fi | ||
| 236 | fi | 249 | fi |
| 237 | 250 | ||
| 238 | load_fw_custom_cancel "nope-$NAME" "$FW" | 251 | if load_fw_custom_cancel "nope-$NAME" "$FW" ; then |
| 239 | if 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 |
| 242 | else | 255 | else |
| 243 | echo "$0: cancelling custom fallback mechanism works" | 256 | echo "$0: cancelling custom fallback mechanism works" |
| 257 | fi | ||
| 244 | fi | 258 | fi |
| 245 | 259 | ||
| 246 | set +e | 260 | set +e |
