12f52018cSSimon Glass#!/bin/bash 22f52018cSSimon Glass 3*c9adb355SSimon Glass# Script to run all U-Boot tests that use sandbox. 4*c9adb355SSimon Glass 5*c9adb355SSimon Glass# Runs a test and checks the exit code to decide if it passed 6*c9adb355SSimon Glass# $1: Test name 7*c9adb355SSimon Glass# $2 onwards: command line to run 82f52018cSSimon Glassrun_test() { 9*c9adb355SSimon Glass echo -n "$1: " 10*c9adb355SSimon Glass shift 11*c9adb355SSimon Glass "$@" 122f52018cSSimon Glass [ $? -ne 0 ] && result=$((result+1)) 132f52018cSSimon Glass} 1407f4eadcSSimon Glass 1573a01d90SSimon Glassresult=0 1673a01d90SSimon Glass 17029ab15aSSimon Glass# Run all tests that the standard sandbox build can support 18*c9adb355SSimon Glassrun_test "sandbox" ./test/py/test.py --bd sandbox --build 19029ab15aSSimon Glass 20029ab15aSSimon Glass# Run tests which require sandbox_spl 21*c9adb355SSimon Glassrun_test "sandbox_spl" ./test/py/test.py --bd sandbox_spl --build \ 22*c9adb355SSimon Glass -k test_ofplatdata.py 23029ab15aSSimon Glass 24029ab15aSSimon Glass# Run tests for the flat DT version of sandbox 25*c9adb355SSimon Glassrun_test "sandbox_flattree" ./test/py/test.py --bd sandbox_flattree --build 262f52018cSSimon Glass 27734f3de9SSimon Glass# Set up a path to dtc (device-tree compiler) and libfdt.py, a library it 28734f3de9SSimon Glass# provides and which is built by the sandbox_spl config. 29ed772fe7SSimon GlassDTC_DIR=build-sandbox_spl/scripts/dtc 30734f3de9SSimon Glassexport PYTHONPATH=${DTC_DIR}/pylibfdt 31734f3de9SSimon Glassexport DTC=${DTC_DIR}/dtc 32ed772fe7SSimon Glass 33*c9adb355SSimon Glassrun_test "binman" ./tools/binman/binman -t 34*c9adb355SSimon Glassrun_test "patman" ./tools/patman/patman --test 35*c9adb355SSimon Glassrun_test "buildman" ./tools/buildman/buildman -t 36*c9adb355SSimon Glassrun_test "dtoc" ./tools/dtoc/dtoc -t 3772d8172bSSimon Glass 3830d704c6SSimon Glass# This needs you to set up Python test coverage tools. 3930d704c6SSimon Glass# To enable Python test coverage on Debian-type distributions (e.g. Ubuntu): 4016d836cdSTom Rini# $ sudo apt-get install python-pytest python-coverage 41*c9adb355SSimon Glassrun_test "binman code coverage" ./tools/binman/binman -T 42*c9adb355SSimon Glassrun_test "dtoc code coverage" ./tools/dtoc/dtoc -T 43*c9adb355SSimon Glassrun_test "fdt code coverage" ./tools/dtoc/test_fdt -T 4430d704c6SSimon Glass 452f52018cSSimon Glassif [ $result == 0 ]; then 462f52018cSSimon Glass echo "Tests passed!" 472f52018cSSimon Glasselse 482f52018cSSimon Glass echo "Tests FAILED" 492f52018cSSimon Glass exit 1 502f52018cSSimon Glassfi 51