]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
test_firmware: wrap custom sysfs load tests into helper
authorLuis R. Rodriguez <mcgrof@kernel.org>
Mon, 20 Nov 2017 18:24:01 +0000 (10:24 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 29 Nov 2017 10:22:49 +0000 (11:22 +0100)
These can run on certain kernel configs. This will allow
us later to enable these tests under the right kernel
configurations.

Signed-off-by: Luis R. Rodriguez <mcgrof@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
tools/testing/selftests/firmware/fw_fallback.sh

index 0d4527c5e8a4f288331fac0cf2e3465a8704180c..722cad91df741bcb16ae736c528b64f7a410a9f6 100755 (executable)
@@ -256,24 +256,37 @@ run_sysfs_main_tests()
        set -e
 }
 
-run_sysfs_main_tests
+run_sysfs_custom_load_tests()
+{
+       if load_fw_custom "$NAME" "$FW" ; then
+               if ! diff -q "$FW" /dev/test_firmware >/dev/null ; then
+                       echo "$0: firmware was not loaded" >&2
+                       exit 1
+               else
+                       echo "$0: custom fallback loading mechanism works"
+               fi
+       fi
 
-if load_fw_custom "$NAME" "$FW" ; then
-       if ! diff -q "$FW" /dev/test_firmware >/dev/null ; then
-               echo "$0: firmware was not loaded" >&2
-               exit 1
-       else
-               echo "$0: custom fallback loading mechanism works"
+       if load_fw_custom "$NAME" "$FW" ; then
+               if ! diff -q "$FW" /dev/test_firmware >/dev/null ; then
+                       echo "$0: firmware was not loaded" >&2
+                       exit 1
+               else
+                       echo "$0: custom fallback loading mechanism works"
+               fi
        fi
-fi
 
-if load_fw_custom_cancel "nope-$NAME" "$FW" ; then
-       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 custom fallback mechanism works"
+       if load_fw_custom_cancel "nope-$NAME" "$FW" ; then
+               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 custom fallback mechanism works"
+               fi
        fi
-fi
+}
+
+run_sysfs_main_tests
+run_sysfs_custom_load_tests
 
 exit 0