summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2017-11-12 21:52:10 -0700
committerSimon Glass <sjg@chromium.org>2017-11-22 18:05:38 -0700
commit2f52018c3cbb83da771f2ed82d9aa36f53d3be12 (patch)
tree01d8c1da26565de59ecdc56bd5c0fa1fb3e59ac1 /test
parentd09682ef8cbbbf29a41f237298ee1e4dbd71e999 (diff)
test/run: Report and return failure
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 <sjg@chromium.org>
Diffstat (limited to 'test')
-rwxr-xr-xtest/run20
1 files changed, 17 insertions, 3 deletions
diff --git a/test/run b/test/run
index b1649ee101..caee4f83f2 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