xref: /openbmc/u-boot/test/run (revision ed772fe79bf4419320e997de94b3f93dbbe0838a)
12f52018cSSimon Glass#!/bin/bash
22f52018cSSimon Glass
32f52018cSSimon Glassrun_test() {
42f52018cSSimon Glass	$@
52f52018cSSimon Glass	[ $? -ne 0 ] && result=$((result+1))
62f52018cSSimon Glass}
707f4eadcSSimon Glass
873a01d90SSimon Glassresult=0
973a01d90SSimon Glass
10029ab15aSSimon Glass# Run all tests that the standard sandbox build can support
112f52018cSSimon Glassrun_test ./test/py/test.py --bd sandbox --build
12029ab15aSSimon Glass
13029ab15aSSimon Glass# Run tests which require sandbox_spl
142f52018cSSimon Glassrun_test ./test/py/test.py --bd sandbox_spl --build -k \
152f52018cSSimon Glass		test/py/tests/test_ofplatdata.py
16029ab15aSSimon Glass
17029ab15aSSimon Glass# Run tests for the flat DT version of sandbox
18029ab15aSSimon Glass./test/py/test.py --bd sandbox_flattree --build
192f52018cSSimon Glass
20*ed772fe7SSimon GlassDTC_DIR=build-sandbox_spl/scripts/dtc
21*ed772fe7SSimon Glass
22*ed772fe7SSimon GlassPYTHONPATH=${DTC_DIR}/pylibfdt DTC=${DTC_DIR}/dtc run_test \
2372d8172bSSimon Glass	./tools/binman/binman -t
24adb5b616SSimon Glassrun_test ./tools/patman/patman --test
2534ba7d77SSimon Glassrun_test ./tools/buildman/buildman -t
26*ed772fe7SSimon GlassPYTHONPATH=${DTC_DIR}/pylibfdt DTC=${DTC_DIR}/dtc run_test ./tools/dtoc/dtoc -t
2772d8172bSSimon Glass
2830d704c6SSimon Glass# This needs you to set up Python test coverage tools.
2930d704c6SSimon Glass# To enable Python test coverage on Debian-type distributions (e.g. Ubuntu):
3030d704c6SSimon Glass#   $ sudo apt-get install python-pip python-pytest
3130d704c6SSimon Glass#   $ sudo pip install coverage
32*ed772fe7SSimon GlassPYTHONPATH=${DTC_DIR}/pylibfdt DTC=${DTC_DIR}/dtc run_test \
3330d704c6SSimon Glass	./tools/binman/binman -T
3430d704c6SSimon Glass
352f52018cSSimon Glassif [ $result == 0 ]; then
362f52018cSSimon Glass	echo "Tests passed!"
372f52018cSSimon Glasselse
382f52018cSSimon Glass	echo "Tests FAILED"
392f52018cSSimon Glass	exit 1
402f52018cSSimon Glassfi
41