Skip to content

Commit 6aa536d

Browse files
jieyouxuNoratrieb
authored andcommitted
Document crashes test suite
Describe procedure for adding new crashes tests and removing crashes tests when the crash is intentionally fixed. Also mention setting `COMPILETEST_VERBOSE_CRASHES=1` env var for verbose crashes test output.
1 parent 7cffa3b commit 6aa536d

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

src/tests/compiletest.md

+37
Original file line numberDiff line numberDiff line change
@@ -521,6 +521,43 @@ only running the main `coverage` suite.
521521
[`src/tools/coverage-dump`]: https://github.com/rust-lang/rust/tree/master/src/tools/coverage-dump
522522
[`tests/coverage-run-rustdoc`]: https://github.com/rust-lang/rust/tree/master/tests/coverage-run-rustdoc
523523

524+
### Crashes tests
525+
526+
[`tests/crashes`] serve as a collection of tests that are expected to cause the compiler to ICE, panic
527+
or crash in some other way, so that accidental fixes are tracked. This was formally done at
528+
<https://github.com/rust-lang/glacier> but doing it inside the rust-lang/rust testsuite is more
529+
convenient.
530+
531+
It is imperative that a test in the suite causes rustc to ICE, panic or crash crash in some other
532+
way. A test will "pass" if rustc exits with an exit status other than 1 or 0.
533+
534+
If you want to see verbose stdout/stderr, you need to set `COMPILETEST_VERBOSE_CRASHES=1`, e.g.
535+
536+
```bash
537+
$ COMPILETEST_VERBOSE_CRASHES=1 ./x test tests/crashes/999999.rs --stage 1
538+
```
539+
540+
When adding crashes from <https://github.com/rust-lang/rust/issues>, the issue number should be
541+
noted in the file name (`12345.rs` should suffice) and also inside the file include a `//@ known-bug
542+
#4321` directive.
543+
544+
If you happen to fix one of the crashes, please move it to a fitting subdirectory in `tests/ui` and
545+
give it a meaningful name. Please add a doc comment at the top of the file explaining why this test
546+
exists, even better if you can briefly explain how the example causes rustc to crash previously and
547+
what was done to prevent rustc to ICE/panic/crash.
548+
549+
Adding
550+
551+
```text
552+
Fixes #NNNNN
553+
Fixes #MMMMM
554+
```
555+
556+
to the description of your pull request will ensure the corresponding tickets be closed
557+
automatically upon merge. The ticket ids can be found in the file name or the `//@ known-bug`
558+
directive inside the test file.
559+
560+
[`tests/crashes`]: https://github.com/rust-lang/rust/tree/master/tests/crashes
524561

525562
## Building auxiliary crates
526563

0 commit comments

Comments
 (0)