[llvm] [llvm-lit] Show test output when combining -v or -a with -q (PR #106668)

via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 29 23:00:46 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-testing-tools

Author: Henrik G. Olsson (hnrklssn)

<details>
<summary>Changes</summary>

This allows the user to silence lit's note and warn diagnostics with --quiet/-q, but still get test output with --verbose/-v or --show-all/-a.

Previously -v and -a silently did nothing when combined with -q, regardless of the order they appeared in.

This fixes #<!-- -->106643

---
Full diff: https://github.com/llvm/llvm-project/pull/106668.diff


2 Files Affected:

- (modified) llvm/utils/lit/lit/display.py (+2-1) 
- (modified) llvm/utils/lit/tests/shtest-output-printing.py (+4) 


``````````diff
diff --git a/llvm/utils/lit/lit/display.py b/llvm/utils/lit/lit/display.py
index 7de5a298d2302b..1cdabd57371d96 100644
--- a/llvm/utils/lit/lit/display.py
+++ b/llvm/utils/lit/lit/display.py
@@ -2,7 +2,7 @@
 
 
 def create_display(opts, tests, total_tests, workers):
-    if opts.quiet:
+    if opts.quiet and not (opts.showOutput or opts.showAllOutput):
         return NopDisplay()
 
     num_tests = len(tests)
@@ -97,6 +97,7 @@ def update(self, test):
         show_result = (
             test.isFailure()
             or self.opts.showAllOutput
+            or self.opts.showOutput
             or (not self.opts.quiet and not self.opts.succinct)
         )
         if show_result:
diff --git a/llvm/utils/lit/tests/shtest-output-printing.py b/llvm/utils/lit/tests/shtest-output-printing.py
index 129cff981eb5b2..728d2b24425079 100644
--- a/llvm/utils/lit/tests/shtest-output-printing.py
+++ b/llvm/utils/lit/tests/shtest-output-printing.py
@@ -3,6 +3,10 @@
 # RUN: not %{lit} -v %{inputs}/shtest-output-printing > %t.out
 # RUN: FileCheck --input-file %t.out --match-full-lines %s
 #
+# Check that -q doesn't override -v
+# RUN: not %{lit} -v -q %{inputs}/shtest-output-printing > %t.out
+# RUN: FileCheck --input-file %t.out --match-full-lines %s
+#
 # END.
 
 #       CHECK: -- Testing: {{.*}}

``````````

</details>


https://github.com/llvm/llvm-project/pull/106668


More information about the llvm-commits mailing list