[llvm] 7837de1 - [lit] Improve consistency for showing result groups

Julian Lettner via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 16 12:40:55 PDT 2020


Author: Julian Lettner
Date: 2020-06-16T12:40:06-07:00
New Revision: 7837de13943ff28648f0a443e8ba21c81bbe9679

URL: https://github.com/llvm/llvm-project/commit/7837de13943ff28648f0a443e8ba21c81bbe9679
DIFF: https://github.com/llvm/llvm-project/commit/7837de13943ff28648f0a443e8ba21c81bbe9679.diff

LOG: [lit] Improve consistency for showing result groups

Before this change we showed all result groups with a code that was not
explicitly hard-coded set.  This set missed the FLAKYPASS result code.

Let's generalize the code to always show failures and the additionally
requested result codes.

Added: 
    

Modified: 
    llvm/utils/lit/lit/cl_arguments.py
    llvm/utils/lit/lit/main.py
    llvm/utils/lit/tests/custom-result-category.py

Removed: 
    


################################################################################
diff  --git a/llvm/utils/lit/lit/cl_arguments.py b/llvm/utils/lit/lit/cl_arguments.py
index 6bbaa4203b47..803e5f9ba02b 100644
--- a/llvm/utils/lit/lit/cl_arguments.py
+++ b/llvm/utils/lit/lit/cl_arguments.py
@@ -187,6 +187,12 @@ def parse_args():
     else:
         opts.shard = None
 
+    opts.show_results = set()
+    if opts.show_unsupported:
+        opts.show_results.add(lit.Test.UNSUPPORTED)
+    if opts.show_xfail:
+        opts.show_results.add(lit.Test.XFAIL)
+
     opts.reports = filter(None, [opts.output, opts.xunit_xml_output])
 
     return opts

diff  --git a/llvm/utils/lit/lit/main.py b/llvm/utils/lit/lit/main.py
index 0c4c986d4561..e1a6f2260965 100755
--- a/llvm/utils/lit/lit/main.py
+++ b/llvm/utils/lit/lit/main.py
@@ -287,19 +287,15 @@ def print_results(tests, elapsed, opts):
         tests_by_code[test.result.code].append(test)
 
     for (code, label) in result_codes:
-        print_group(code, label, tests_by_code[code], opts)
+        print_group(code, label, tests_by_code[code], opts.show_results)
 
     print_summary(tests_by_code, opts.quiet, elapsed)
 
 
-def print_group(code, label, tests, opts):
+def print_group(code, label, tests, show_results):
     if not tests:
         return
-    # TODO(yln): FLAKYPASS? Make this more consistent!
-    if code in {lit.Test.EXCLUDED, lit.Test.SKIPPED, lit.Test.PASS}:
-        return
-    if (lit.Test.XFAIL == code and not opts.show_xfail) or \
-       (lit.Test.UNSUPPORTED == code and not opts.show_unsupported):
+    if not code.isFailure and code not in show_results:
         return
     print('*' * 20)
     print('%s Tests (%d):' % (label, len(tests)))

diff  --git a/llvm/utils/lit/tests/custom-result-category.py b/llvm/utils/lit/tests/custom-result-category.py
index bbc8a304bbb1..8a374e393a96 100644
--- a/llvm/utils/lit/tests/custom-result-category.py
+++ b/llvm/utils/lit/tests/custom-result-category.py
@@ -6,10 +6,10 @@
 # CHECK: CUSTOM_PASS: custom-result-category :: test1.txt
 # CHECK: CUSTOM_FAILURE: custom-result-category :: test2.txt
 
-# TODO(yln): Passed tests shouldn't be printed by default.
-# CHECK: My Passed Tests (1)
-# CHECK: My Failed Tests (1)
-# CHECK:   custom-result-category :: test2.txt
+# CHECK-NOT: My Passed Tests (1)
+# CHECK-NOT:   custom-result-category :: test1.txt
+# CHECK:     My Failed Tests (1)
+# CHECK:       custom-result-category :: test2.txt
 
 # CHECK: My Passed: 1
 # CHECK: My Failed: 1


        


More information about the llvm-commits mailing list