xref: /openbmc/u-boot/test/run (revision c9adb355)
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
8run_test() {
9	echo -n "$1: "
10	shift
11	"$@"
12	[ $? -ne 0 ] && result=$((result+1))
13}
14
15result=0
16
17# Run all tests that the standard sandbox build can support
18run_test "sandbox" ./test/py/test.py --bd sandbox --build
19
20# Run tests which require sandbox_spl
21run_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
25run_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.
29DTC_DIR=build-sandbox_spl/scripts/dtc
30export PYTHONPATH=${DTC_DIR}/pylibfdt
31export DTC=${DTC_DIR}/dtc
32
33run_test "binman" ./tools/binman/binman -t
34run_test "patman" ./tools/patman/patman --test
35run_test "buildman" ./tools/buildman/buildman -t
36run_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
41run_test "binman code coverage" ./tools/binman/binman -T
42run_test "dtoc code coverage" ./tools/dtoc/dtoc -T
43run_test "fdt code coverage" ./tools/dtoc/test_fdt -T
44
45if [ $result == 0 ]; then
46	echo "Tests passed!"
47else
48	echo "Tests FAILED"
49	exit 1
50fi
51