Guide answers "what" but not "why" and "how" for codegen tests #1965
Labels
A-codegen
Area: code generation
A-FileCheck
Area: LLVM FileCheck tool
A-test-suite
Area: our test suite `tests/`
C-enhancement
Category: enhancement
E-hard
Difficulty: might require advanced knowledge
T-compiler
Relevant to compiler team
The section on codegen tests is bereft of an explanation of how to use FileCheck, and I do not think the documentation for FileCheck is the best example for it. The documentation for FileCheck focuses on its usage as a CLI tool first, but we are not passing random args to FileCheck!
In fact, it's probably exactly the reverse order for what we want. What is probably most important is how and when to use the regex capturing, introduced at the end, since most tests shouldn't break if a variable changes its name but uses a few different ones: we don't want to focus on LLVM's exact behavior like that. Then we usually want people to use CHECK-LABELs, again, introduced just before regex usage. Then we want to discuss when to use CHECK-NEXT, CHECK-NOT, and CHECK-DAG, and when not to use them.
In our actual usage, CHECK, the directive they introduce first and focus on using, is mostly a directive for corraling CHECK-NEXT and CHECK-DAGs when CHECK-LABEL does not suffice for that, as CHECK is itself the hardest-to-contain directive.
A step-by-step explanation for
would be better.
And neither of these answer why we use them, which is particular to the Rust codebase. We can't simply upstream all our tests unless LLVM adds rustc to the test suite, as we want e.g. our MIR opts to be taken into account when running our codegen tests.
The text was updated successfully, but these errors were encountered: