selftests: firmware: skip unsupported async loading tests
authorAmit Pundir <amit.pundir@linaro.org>
Wed, 8 Nov 2017 19:40:34 +0000 (01:10 +0530)
committerShuah Khan <shuahkh@osg.samsung.com>
Wed, 15 Nov 2017 15:27:24 +0000 (08:27 -0700)
Ignore async firmware loading tests on older kernel releases,
which do not support this feature.

Fixes: 1b1fe542b6f0:
       ("selftests: firmware: add empty string and async tests")
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>
tools/testing/selftests/firmware/fw_filesystem.sh

index 62f2d6f..b1f20fe 100755 (executable)
@@ -70,9 +70,13 @@ if printf '\000' >"$DIR"/trigger_request 2> /dev/null; then
        exit 1
 fi
 
-if printf '\000' >"$DIR"/trigger_async_request 2> /dev/null; then
-       echo "$0: empty filename should not succeed (async)" >&2
-       exit 1
+if [ ! -e "$DIR"/trigger_async_request ]; then
+       echo "$0: empty filename: async trigger not present, ignoring test" >&2
+else
+       if printf '\000' >"$DIR"/trigger_async_request 2> /dev/null; then
+               echo "$0: empty filename should not succeed (async)" >&2
+               exit 1
+       fi
 fi
 
 # Request a firmware that doesn't exist, it should fail.
@@ -105,17 +109,21 @@ else
 fi
 
 # Try the asynchronous version too
-if ! echo -n "$NAME" >"$DIR"/trigger_async_request ; then
-       echo "$0: could not trigger async request" >&2
-       exit 1
-fi
-
-# Verify the contents are what we expect.
-if ! diff -q "$FW" /dev/test_firmware >/dev/null ; then
-       echo "$0: firmware was not loaded (async)" >&2
-       exit 1
+if [ ! -e "$DIR"/trigger_async_request ]; then
+       echo "$0: firmware loading: async trigger not present, ignoring test" >&2
 else
-       echo "$0: async filesystem loading works"
+       if ! echo -n "$NAME" >"$DIR"/trigger_async_request ; then
+               echo "$0: could not trigger async request" >&2
+               exit 1
+       fi
+
+       # Verify the contents are what we expect.
+       if ! diff -q "$FW" /dev/test_firmware >/dev/null ; then
+               echo "$0: firmware was not loaded (async)" >&2
+               exit 1
+       else
+               echo "$0: async filesystem loading works"
+       fi
 fi
 
 ### Batched requests tests