Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add compiletest docs for FileCheck prefixes and //@ filecheck-flags: #1914

Merged
merged 1 commit into from
Mar 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions src/tests/compiletest.md
Original file line number Diff line number Diff line change
Expand Up @@ -568,6 +568,21 @@ fn test_foo() {
}
```

In test suites that use the LLVM [FileCheck] tool, the current revision name is
also registered as an additional prefix for FileCheck directives:

```rust,ignore
//@ revisions: NORMAL COVERAGE
//@ [COVERAGE] compile-flags: -Cinstrument-coverage
//@ [COVERAGE] needs-profiler-support

// COVERAGE: @__llvm_coverage_mapping
// NORMAL-NOT: @__llvm_coverage_mapping

// CHECK: main
fn main() {}
```

Note that not all headers have meaning when customized to a revision.
For example, the `ignore-test` header (and all "ignore" headers)
currently only apply to the test as a whole, not to particular
Expand All @@ -579,6 +594,7 @@ Following is classes of tests that support revisions:
- UI
- assembly
- codegen
- coverage
- debuginfo
- rustdoc UI tests
- incremental (these are special in that they inherently cannot be run in parallel)
Expand Down
16 changes: 16 additions & 0 deletions src/tests/headers.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,9 @@ found in [`header.rs`] from the compiletest source.
for a known bug that has not yet been fixed
* [Assembly](compiletest.md#assembly-tests) headers
* `assembly-output` — the type of assembly output to check
* [Tool-specific headers](#tool-specific-headers)
* `filecheck-flags` - passes extra flags to the `FileCheck` tool
* `llvm-cov-flags` - passes extra flags to the `llvm-cov` tool


### Ignoring tests
Expand Down Expand Up @@ -230,6 +233,19 @@ test suites.
to be loaded by the host compiler.


### Tool-specific headers

The following headers affect how certain command-line tools are invoked,
in test suites that use those tools:

* `filecheck-flags` adds extra flags when running LLVM's `FileCheck` tool.
- Used by [codegen tests](compiletest.md#codegen-tests),
[assembly tests](compiletest.md#assembly-tests), and
[MIR-opt tests](compiletest.md#mir-opt-tests).
* `llvm-cov-flags` adds extra flags when running LLVM's `llvm-cov` tool.
- Used by [coverage tests](compiletest.md#coverage-tests) in `coverage-run` mode.


## Substitutions

Headers values support substituting a few variables which will be replaced
Expand Down