Skip to content

Commit fbea746

Browse files
authored
Add compiletest docs for FileCheck prefixes and //@ filecheck-flags: (#1914)
This patch also adds docs for `//@ llvm-cov-flags:`, and notes that coverage tests support revisions (though none of the current tests actually do so).
1 parent d866c38 commit fbea746

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

src/tests/compiletest.md

+16
Original file line numberDiff line numberDiff line change
@@ -598,6 +598,21 @@ fn test_foo() {
598598
}
599599
```
600600

601+
In test suites that use the LLVM [FileCheck] tool, the current revision name is
602+
also registered as an additional prefix for FileCheck directives:
603+
604+
```rust,ignore
605+
//@ revisions: NORMAL COVERAGE
606+
//@ [COVERAGE] compile-flags: -Cinstrument-coverage
607+
//@ [COVERAGE] needs-profiler-support
608+
609+
// COVERAGE: @__llvm_coverage_mapping
610+
// NORMAL-NOT: @__llvm_coverage_mapping
611+
612+
// CHECK: main
613+
fn main() {}
614+
```
615+
601616
Note that not all headers have meaning when customized to a revision.
602617
For example, the `ignore-test` header (and all "ignore" headers)
603618
currently only apply to the test as a whole, not to particular
@@ -609,6 +624,7 @@ Following is classes of tests that support revisions:
609624
- UI
610625
- assembly
611626
- codegen
627+
- coverage
612628
- debuginfo
613629
- rustdoc UI tests
614630
- incremental (these are special in that they inherently cannot be run in parallel)

src/tests/headers.md

+16
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,9 @@ found in [`header.rs`] from the compiletest source.
9595
for a known bug that has not yet been fixed
9696
* [Assembly](compiletest.md#assembly-tests) headers
9797
* `assembly-output` — the type of assembly output to check
98+
* [Tool-specific headers](#tool-specific-headers)
99+
* `filecheck-flags` - passes extra flags to the `FileCheck` tool
100+
* `llvm-cov-flags` - passes extra flags to the `llvm-cov` tool
98101

99102

100103
### Ignoring tests
@@ -231,6 +234,19 @@ test suites.
231234
to be loaded by the host compiler.
232235

233236

237+
### Tool-specific headers
238+
239+
The following headers affect how certain command-line tools are invoked,
240+
in test suites that use those tools:
241+
242+
* `filecheck-flags` adds extra flags when running LLVM's `FileCheck` tool.
243+
- Used by [codegen tests](compiletest.md#codegen-tests),
244+
[assembly tests](compiletest.md#assembly-tests), and
245+
[MIR-opt tests](compiletest.md#mir-opt-tests).
246+
* `llvm-cov-flags` adds extra flags when running LLVM's `llvm-cov` tool.
247+
- Used by [coverage tests](compiletest.md#coverage-tests) in `coverage-run` mode.
248+
249+
234250
## Substitutions
235251

236252
Headers values support substituting a few variables which will be replaced

0 commit comments

Comments
 (0)