]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
patman: Use test_util to show test results
authorSimon Glass <sjg@chromium.org>
Mon, 6 Jul 2020 03:41:48 +0000 (21:41 -0600)
committerSimon Glass <sjg@chromium.org>
Sat, 25 Jul 2020 01:25:15 +0000 (19:25 -0600)
This handles skipped tests correctly, so use it instead of the existing
code.

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

index 28a9a260879a16910b9065885aa021f1ad5ebd73..03668d1bb8c4be9988686196060b21ca15ce62ed 100755 (executable)
@@ -25,6 +25,7 @@ from patman import patchstream
 from patman import project
 from patman import settings
 from patman import terminal
+from patman import test_util
 from patman import test_checkpatch
 
 
@@ -101,12 +102,7 @@ elif options.test:
         suite = doctest.DocTestSuite(module)
         suite.run(result)
 
-    # TODO: Surely we can just 'print' result?
-    print(result)
-    for test, err in result.errors:
-        print(err)
-    for test, err in result.failures:
-        print(err)
+    sys.exit(test_util.ReportResult('patman', None, result))
 
 # Called from git with a patch filename as argument
 # Printout a list of additional CC recipients for this patch
index aac58fb72f0ece175b5a2eb0deec49c7e4bc9e79..0827488f33d63c1005cdbac95b183fa4ce55d66a 100644 (file)
@@ -123,12 +123,12 @@ def ReportResult(toolname:str, test_name: str, result: unittest.TestResult):
     for test, err in result.failures:
         print(err, result.failures)
     if result.skipped:
-        print('%d binman test%s SKIPPED:' %
-              (len(result.skipped), 's' if len(result.skipped) > 1 else ''))
+        print('%d %s test%s SKIPPED:' % (len(result.skipped), toolname,
+            's' if len(result.skipped) > 1 else ''))
         for skip_info in result.skipped:
             print('%s: %s' % (skip_info[0], skip_info[1]))
     if result.errors or result.failures:
-        print('binman tests FAILED')
+        print('%s tests FAILED' % toolname)
         return 1
     return 0