selftests: firmware: Add compressed firmware tests
[linux-2.6-block.git] / tools / testing / selftests / firmware / fw_run_tests.sh
1 #!/bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3
4 # This runs all known tests across all known possible configurations we could
5 # emulate in one run.
6
7 set -e
8
9 TEST_DIR=$(dirname $0)
10 source $TEST_DIR/fw_lib.sh
11
12 export HAS_FW_LOADER_USER_HELPER=""
13 export HAS_FW_LOADER_USER_HELPER_FALLBACK=""
14 export HAS_FW_LOADER_COMPRESS=""
15
16 run_tests()
17 {
18         proc_set_force_sysfs_fallback $1
19         proc_set_ignore_sysfs_fallback $2
20         $TEST_DIR/fw_filesystem.sh
21
22         proc_set_force_sysfs_fallback $1
23         proc_set_ignore_sysfs_fallback $2
24         $TEST_DIR/fw_fallback.sh
25 }
26
27 run_test_config_0001()
28 {
29         echo "-----------------------------------------------------"
30         echo "Running kernel configuration test 1 -- rare"
31         echo "Emulates:"
32         echo "CONFIG_FW_LOADER=y"
33         echo "CONFIG_FW_LOADER_USER_HELPER=n"
34         echo "CONFIG_FW_LOADER_USER_HELPER_FALLBACK=n"
35         run_tests 0 1
36 }
37
38 run_test_config_0002()
39 {
40         echo "-----------------------------------------------------"
41         echo "Running kernel configuration test 2 -- distro"
42         echo "Emulates:"
43         echo "CONFIG_FW_LOADER=y"
44         echo "CONFIG_FW_LOADER_USER_HELPER=y"
45         echo "CONFIG_FW_LOADER_USER_HELPER_FALLBACK=n"
46         proc_set_ignore_sysfs_fallback 0
47         run_tests 0 0
48 }
49
50 run_test_config_0003()
51 {
52         echo "-----------------------------------------------------"
53         echo "Running kernel configuration test 3 -- android"
54         echo "Emulates:"
55         echo "CONFIG_FW_LOADER=y"
56         echo "CONFIG_FW_LOADER_USER_HELPER=y"
57         echo "CONFIG_FW_LOADER_USER_HELPER_FALLBACK=y"
58         run_tests 1 0
59 }
60
61 check_mods
62 check_setup
63
64 if [ -f $FW_FORCE_SYSFS_FALLBACK ]; then
65         run_test_config_0001
66         run_test_config_0002
67         run_test_config_0003
68 else
69         echo "Running basic kernel configuration, working with your config"
70         run_tests
71 fi