diff mbox series

[U-Boot,01/53] dtoc: Return a non-zero exit code when tests fail

Message ID 20190720182416.183626-2-sjg@chromium.org
State Accepted
Commit 1000096b06ea53487b3457eb1d0d1704276c1c62
Delegated to: Simon Glass
Headers show
Series binman: Support replacing entries in an existing image | expand

Commit Message

Simon Glass July 20, 2019, 6:23 p.m. UTC
At present 'dtoc -t' return a success code even if some of the tests fail.
Fix this by checking the test result and setting the exit code. This
allows 'make qcheck' to function as expected.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 tools/dtoc/dtoc.py | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

Comments

Simon Glass July 29, 2019, 9:22 p.m. UTC | #1
At present 'dtoc -t' return a success code even if some of the tests fail.
Fix this by checking the test result and setting the exit code. This
allows 'make qcheck' to function as expected.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 tools/dtoc/dtoc.py | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

Applied to u-boot-dm, thanks!
diff mbox series

Patch

diff --git a/tools/dtoc/dtoc.py b/tools/dtoc/dtoc.py
index c1a1d3534d4..514e0dd4a34 100755
--- a/tools/dtoc/dtoc.py
+++ b/tools/dtoc/dtoc.py
@@ -71,6 +71,10 @@  def run_tests(args):
         print(err)
     for _, err in result.failures:
         print(err)
+    if result.errors or result.failures:
+        print('dtoc tests FAILED')
+        return 1
+    return 0
 
 def RunTestCoverage():
     """Run the tests and check that we get 100% coverage"""
@@ -101,7 +105,8 @@  parser.add_option('-T', '--test-coverage', action='store_true',
 
 # Run our meagre tests
 if options.test:
-    run_tests(args)
+    ret_code = run_tests(args)
+    sys.exit(ret_code)
 
 elif options.test_coverage:
     RunTestCoverage()