From: Simon Glass Date: Sun, 12 Nov 2017 21:52:10 -0700 Subject: [U-Boot] [PATCH 06/26] test/run: Report and return failure In-Reply-To: <20171113045231.15911-1-sjg@chromium.org> References: <20171113045231.15911-1-sjg@chromium.org> Message-ID: <20171113045231.15911-7-sjg@chromium.org> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de This script runs the tests but does not report failure. Also it always returns an exit code of 0 even on failure. Fix these problems by checking the result of each test. Signed-off-by: Simon Glass --- test/run | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/test/run b/test/run index b1649ee1015..caee4f83f2c 100755 --- a/test/run +++ b/test/run @@ -1,10 +1,24 @@ -#!/bin/sh +#!/bin/bash + +run_test() { + $@ + [ $? -ne 0 ] && result=$((result+1)) + echo "result $result" +} # Run all tests that the standard sandbox build can support -./test/py/test.py --bd sandbox --build +run_test ./test/py/test.py --bd sandbox --build # Run tests which require sandbox_spl -./test/py/test.py --bd sandbox_spl --build -k test/py/tests/test_ofplatdata.py +run_test ./test/py/test.py --bd sandbox_spl --build -k \ + test/py/tests/test_ofplatdata.py # Run tests for the flat DT version of sandbox ./test/py/test.py --bd sandbox_flattree --build + +if [ $result == 0 ]; then + echo "Tests passed!" +else + echo "Tests FAILED" + exit 1 +fi -- 2.15.0.448.gf294e3d99a-goog