[llvm-dev] [RFC] FileCheck: (dis)allowing unused prefixes
Robinson, Paul via llvm-dev
llvm-dev at lists.llvm.org
Thu Oct 29 11:15:24 PDT 2020
Thanks for doing this! I am impressed that the test count is so high; what is that, around 2% of all tests? I wonder how many are typos (bad) versus genuinely unused (benign), but that would be tedious to determine.
Example of a typo: clang/test/AST/ast-dump-decl.c, MODULE vs MODULES
Example of unused: llvm/test/DebugInfo/X86/dbg-value-inlined-parameter.ll, specifies LINUX and DARWIN but neither is used.
I’ll take this opportunity to mention that I’m planning a 10% project to look at the inverse question: What directives are in the test files but aren’t exercised by any FileCheck run? This is trickier as you need to collect data across multiple runs, and tests run in parallel. Also it’s a bit ambiguous what “looks like” a directive, they aren’t really all intended to be directives. Should be fun.
If anyone is already delving into this, I’d be curious to hear about the approach.
From: llvm-dev <llvm-dev-bounces at lists.llvm.org> On Behalf Of Mircea Trofin via llvm-dev
Sent: Thursday, October 29, 2020 1:28 PM
To: LLVM Dev <llvm-dev at lists.llvm.org>
Subject: [llvm-dev] [RFC] FileCheck: (dis)allowing unused prefixes
TL;DR; if you used FileCheck --check-prefixes and you missed (misspelled, for instance) one of the prefixes in your test, FileCheck silently ignores that and the test passes.
1579 tests have this property.
Please refer to https://reviews.llvm.org/D90281<https://urldefense.com/v3/__https:/reviews.llvm.org/D90281__;!!JmoZiZGBv3RvKRSx!sQiWDnLaUAuuZLnJnmDYlIXvXwHr_j61zk-FLPNO_AhEEHEXZo_4yewxrqdv8DIPHA$> and the discussion there for more details (make sure you open "older changes" for full context)
The problem is covered by the TL;DR;.
The proposal is to add an explicit flag to FileCheck, --allow-unused-prefixes, to indicate whether the current behavior is intended (for instance, jdoerfert contributed a scenario where that is the case).
We want the default behavior to be 'strict', i.e. --allow-unused-prefixes=false. Doing that right now would lead to 1500 test failures.
To get there (thanks, maskray, for suggestion), we propose we:
* land D90281 where the flag is introduced, but is flipped to match today's behavior
* employ a 'busy beavers' approach, where test maintainers patch their tests:
- either leveraging the flag, to explicitly indicate that unused prefixes is intended (i.e. add --allow-unused-patches=true); or
- fix the test (e.g. maybe there was a misspelling issue/omission/etc).
A spreadsheet with the failing tests is available here<https://urldefense.com/v3/__https:/docs.google.com/spreadsheets/d/1o6q3XH1n3DDyyccnYZ_kVfhFbTDzC_S09e973_cwYuw/edit?usp=sharing__;!!JmoZiZGBv3RvKRSx!sQiWDnLaUAuuZLnJnmDYlIXvXwHr_j61zk-FLPNO_AhEEHEXZo_4yewxrqeR_nOyIg$> .
The request to the community members is to please sign up for their respective area in the spreadsheet, and then mark it completed when that's the case (yes/no in the respective column).
When all the tests are fixed, we will then flip --allow-unused-prefixes to false by default.
Meanwhile, please consider leveraging the flag explicitly when you author new tests that use --check-prefixes. That can be then cleaned up easily after we switch to the 'strict' behavior.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the llvm-dev