]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
dtoc: Return a non-zero exit code when tests fail
authorSimon Glass <sjg@chromium.org>
Sat, 20 Jul 2019 18:23:23 +0000 (12:23 -0600)
committerSimon Glass <sjg@chromium.org>
Mon, 29 Jul 2019 15:38:05 +0000 (09:38 -0600)
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

index c1a1d3534d493efec0b4b35334c4334f240982a0..514e0dd4a34b683c53c40898539583044ddaf5ff 100755 (executable)
@@ -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()