Skip to content

Commit 44894a7

Browse files
authored
Rollup merge of #100777 - pnkfelix:expand-codegen-tests-readme, r=TaKO8Ki
elaborate how revisions work with FileCheck stuff in src/test/codegen elaborate how revisions work with FileCheck stuff in src/test/codegen
2 parents 7f02896 + f47b61d commit 44894a7

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

src/test/codegen/README.md

+22
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,24 @@
11
The files here use the LLVM FileCheck framework, documented at
22
<https://llvm.org/docs/CommandGuide/FileCheck.html>.
3+
4+
One extension worth noting is the use of revisions as custom prefixes for
5+
FileCheck. If your codegen test has different behavior based on the chosen
6+
target or different compiler flags that you want to exercise, you can use a
7+
revisions annotation, like so:
8+
9+
```rust
10+
// revisions: aaa bbb
11+
// [bbb] compile-flags: --flags-for-bbb
12+
```
13+
14+
After specifying those variations, you can write different expected, or
15+
explicitly *unexpected* output by using `<prefix>-SAME:` and `<prefix>-NOT:`,
16+
like so:
17+
18+
```rust
19+
// CHECK: expected code
20+
// aaa-SAME: emitted-only-for-aaa
21+
// aaa-NOT: emitted-only-for-bbb
22+
// bbb-NOT: emitted-only-for-aaa
23+
// bbb-SAME: emitted-only-for-bbb
24+
```

0 commit comments

Comments
 (0)