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

Document crashes test suite #2075

Merged
merged 2 commits into from
Sep 24, 2024
Merged
Changes from 1 commit
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
37 changes: 37 additions & 0 deletions src/tests/compiletest.md
Original file line number Diff line number Diff line change
Expand Up @@ -510,6 +510,43 @@ only running the main `coverage` suite.
[`src/tools/coverage-dump`]: https://github.com/rust-lang/rust/tree/master/src/tools/coverage-dump
[`tests/coverage-run-rustdoc`]: https://github.com/rust-lang/rust/tree/master/tests/coverage-run-rustdoc

### Crashes tests

[`tests/crashes`] serve as a collection of tests that are expected to cause the compiler to ICE, panic
or crash in some other way, so that accidental fixes are tracked. This was formally done at
<https://github.com/rust-lang/glacier> but doing it inside the rust-lang/rust testsuite is more
convenient.

It is imperative that a test in the suite causes rustc to ICE, panic or crash crash in some other
way. A test will "pass" if rustc exits with an exit status other than 1 or 0.

If you want to see verbose stdout/stderr, you need to set `COMPILETEST_VERBOSE_CRASHES=1`, e.g.

```bash
$ COMPILETEST_VERBOSE_CRASHES=1 ./x test tests/crashes/999999.rs --stage 1
```

When adding crashes from <https://github.com/rust-lang/rust/issues>, the issue number should be
noted in the file name (`12345.rs` should suffice) and also inside the file include a `//@ known-bug
#4321` directive.

If you happen to fix one of the crashes, please move it to a fitting subdirectory in `tests/ui` and
give it a meaningful name. Please add a doc comment at the top of the file explaining why this test
exists, even better if you can briefly explain how the example causes rustc to crash previously and
what was done to prevent rustc to ICE/panic/crash.

Adding

```text
Fixes #NNNNN
Fixes #MMMMM
```

to the description of your pull request will ensure the corresponding tickets be closed
automatically upon merge. The ticket ids can be found in the file name or the `//@ known-bug`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
to the description of your pull request will ensure the corresponding tickets be closed
automatically upon merge. The ticket ids can be found in the file name or the `//@ known-bug`
to the description of your pull request will ensure the corresponding tickets be closed
automatically upon merge.
Make sure that your fix actually fixes the root cause of the issue and not just a subset first.
The issue numbers can be found in the file name or the `//@ known-bug`

directive inside the test file.

[`tests/crashes`]: https://github.com/rust-lang/rust/tree/master/tests/crashes

## Building auxiliary crates

Expand Down