This was initially sparked by a discussion in [llvm-lit] Show test output when combining -v or -a with -q · Issue #106643 · llvm/llvm-project · GitHub about how the various flags controlling output in llvm-lit
should behave when combined.
At the moment -q
is the only flag that can silence notes and warnings emitted by llvm-lit
, but -q
also completely overrides the other flags (-v
, -a
, -s
) – no matter the order of the flags. This means it’s impossible to silence notes and warnings while also seeing the output of a command.
After thinking a bit, I think the best approach would be to restructure the flags into smaller, more focused options. The current ones would remain as a shorthand for setting multiple options with a single flag. The behaviour when combining existing flags would be whatever the behaviour is when combining the options they alias. I also propose that flags occurring later in the lit invokation override earlier flags, rather than the current behaviour of some flags always overriding other flags. This proposal would have the unfortunate side effect that e.g. -s -a
and -a -s
would result in different behaviour in non-obvious ways, but this can be alleviated by emitting warnings, if necessary.
The new flags I propose are:
--test-output=[off,failed,all]
- whether the executed commands and their outputs are printed after each test
- default:
off
--test-progress=[off,failed,all]
- whether the result of each test is printed during testing (as opposed to the summary at the end)
- default:
all
- I don’t love this name, but naming things is hard :-/
--progress-bar
(complementing the existing--no-progress-bar
)- whether a progress bar is shown during testing
- default: disabled
--diagnostic-level=[error,warning,note,debug]
- whether to only emit lit diagnostics of levels
fatal
anderror
, or additionallywarning
, or additionallynote
, or additionally debug output - default:
note
- I don’t feel strongly about incorporating
debug
into this option
- whether to only emit lit diagnostics of levels
There is some crossover between --test-output
and --test-progress
: --test-output
requires, and implies, --test-progress
of at least the same level. That is to say, there’s no way of printing the output of test foo/bar.c
, if we aren’t even printing the fact that foo/bar.c
was executed. So --test-output=all
implies --test-progress=all
, and --test-output=failed
sets --test-progress=failed
if the current mode is --test-progress=off
. Conversely, --test-output=all --test-progress=off
results in no test output. This is why -s -a
and -a -s
give different results, as the current options would be aliases as follows:
-v
→--test-output=failed
-a
→--test-output=all
-s
→--progress-bar --test-progress=failed
-q
→--diagnostic-level=error --test-output=off
--debug
→--diagnostic-level=debug
Happy to hear what the community has to say!