binman: Return non-zero exit code on test failure
authorSimon Glass <sjg@chromium.org>
Mon, 13 Nov 2017 04:52:29 +0000 (21:52 -0700)
committerSimon Glass <sjg@chromium.org>
Thu, 23 Nov 2017 01:05:38 +0000 (18:05 -0700)
Return exit code 1 when test fail so that callers can detect this.

Signed-off-by: Simon Glass <sjg@chromium.org>
tools/binman/binman.py

index 7ad4d3030b90115928633c807280e8edc5517914..3ccf25f1f884249ca98733b6b88423539c353516 100755 (executable)
@@ -58,7 +58,11 @@ def RunTests():
     for test, err in result.errors:
         print test.id(), err
     for test, err in result.failures:
-        print err
+        print err, result.failures
+    if result.errors or result.failures:
+      print 'binman tests FAILED'
+      return 1
+    return 0
 
 def RunTestCoverage():
     """Run the tests and check that we get 100% coverage"""
@@ -106,7 +110,7 @@ def RunBinman(options, args):
         sys.tracebacklimit = 0
 
     if options.test:
-        RunTests()
+        ret_code = RunTests()
 
     elif options.test_coverage:
         RunTestCoverage()