[U-Boot,25/26] binman: Return non-zero exit code on test failure

Message ID 20171113045231.15911-26-sjg@chromium.org
State New
Delegated to: Simon Glass
Headers show
Series
  • test: Include Python tools in test coverage
Related show

Commit Message

Simon Glass Nov. 13, 2017, 4:52 a.m.
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 | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

Patch

diff --git a/tools/binman/binman.py b/tools/binman/binman.py
index 7ad4d3030b9..3ccf25f1f88 100755
--- a/tools/binman/binman.py
+++ b/tools/binman/binman.py
@@ -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()