From c74b452de600f7b3216751d191b5be04602b00a9 Mon Sep 17 00:00:00 2001 From: "Henrik G. Olsson" Date: Thu, 29 Aug 2024 17:26:56 -0700 Subject: [PATCH] [llvm-lit] Show test output when combining -v or -a with -q 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 --- llvm/utils/lit/lit/display.py | 3 ++- llvm/utils/lit/tests/shtest-output-printing.py | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/llvm/utils/lit/lit/display.py b/llvm/utils/lit/lit/display.py index 7de5a298d2302..1cdabd57371d9 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 129cff981eb5b..728d2b2442507 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: {{.*}}