test: Print the name of each test before running it
[platform/kernel/u-boot.git] / test / run
1 #!/bin/bash
2
3 # Script to run all U-Boot tests that use sandbox.
4
5 # Runs a test and checks the exit code to decide if it passed
6 #  $1:         Test name
7 #  $2 onwards: command line to run
8 run_test() {
9         echo -n "$1: "
10         shift
11         "$@"
12         [ $? -ne 0 ] && result=$((result+1))
13 }
14
15 result=0
16
17 # Run all tests that the standard sandbox build can support
18 run_test "sandbox" ./test/py/test.py --bd sandbox --build
19
20 # Run tests which require sandbox_spl
21 run_test "sandbox_spl" ./test/py/test.py --bd sandbox_spl --build \
22         -k test_ofplatdata.py
23
24 # Run tests for the flat DT version of sandbox
25 run_test "sandbox_flattree" ./test/py/test.py --bd sandbox_flattree --build
26
27 # Set up a path to dtc (device-tree compiler) and libfdt.py, a library it
28 # provides and which is built by the sandbox_spl config.
29 DTC_DIR=build-sandbox_spl/scripts/dtc
30 export PYTHONPATH=${DTC_DIR}/pylibfdt
31 export DTC=${DTC_DIR}/dtc
32
33 run_test "binman" ./tools/binman/binman -t
34 run_test "patman" ./tools/patman/patman --test
35 run_test "buildman" ./tools/buildman/buildman -t
36 run_test "dtoc" ./tools/dtoc/dtoc -t
37
38 # This needs you to set up Python test coverage tools.
39 # To enable Python test coverage on Debian-type distributions (e.g. Ubuntu):
40 #   $ sudo apt-get install python-pytest python-coverage
41 run_test "binman code coverage" ./tools/binman/binman -T
42 run_test "dtoc code coverage" ./tools/dtoc/dtoc -T
43 run_test "fdt code coverage" ./tools/dtoc/test_fdt -T
44
45 if [ $result == 0 ]; then
46         echo "Tests passed!"
47 else
48         echo "Tests FAILED"
49         exit 1
50 fi