Skip to content

Commit fb6176d

Browse files
bstrieJoshua Nelson
authored andcommitted
Add notes about running the UI test suite
1 parent e66adf6 commit fb6176d

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

src/tests/running.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,43 @@ Likewise, you can test a single file by passing its path:
5959
./x.py test src/test/ui/const-generics/const-test.rs
6060
```
6161

62+
### Run the UI test suite
63+
64+
The UI test suite is special in that it tests the command-line output
65+
of the compiler, e.g. the wording and formatting of warnings and errors.
66+
Every UI test file such as `foo.rs` will have a corresponding file
67+
`foo.stderr` describing its expected output.
68+
69+
Similar to any other test suite, the UI test suite can be run with:
70+
71+
```bash
72+
./x.py test src/test/ui
73+
```
74+
75+
If you have made a change to the way that the compiler formats its output,
76+
it would be extraordinarily tedious to have to reformat every `*.stderr`
77+
file manually. Fortunately there exists a flag that will allow you to
78+
"bless" the current output of the compiler as the expected output.
79+
When using this flag with the test runner, any UI tests that would
80+
ordinarily fail will instead have their `*.stderr` files overwritten
81+
with whatever output the compiler produces:
82+
83+
```bash
84+
./x.py test src/test/ui --bless
85+
```
86+
87+
Some UI tests will have different output depending on which "mode" that
88+
the compiler is in. Specifically, the compiler may have different output
89+
depending on whether the feature "non-lexical lifetimes" (NLL) is enabled.
90+
Any UI test such as `foo.rs` whose output differs with NLL enabled will
91+
have both a `foo.stderr` file and a `foo.nll.stderr` file.
92+
By default, the UI test suite will not be run in NLL mode.
93+
To run the UI test suite in NLL mode, use the following:
94+
95+
```bash
96+
./x.py test src/test/ui --compare-mode=nll
97+
```
98+
6299
### Run only the tidy script
63100

64101
```bash

0 commit comments

Comments
 (0)