Skip to content
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: 8 additions & 8 deletions src/doc/rustc-dev-guide/src/tests/directives.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,17 +70,17 @@ See [Controlling pass/fail expectations](ui.md#controlling-passfail-expectations

| Directive | Explanation | Supported test suites | Possible values |
|-----------------------------|---------------------------------------------|-------------------------------------------|-----------------|
| `check-pass` | Building (no codegen) should pass | `ui`, `crashes` | N/A |
| `check-fail` | Building (no codegen) should fail | `ui`, `crashes` | N/A |
| `build-pass` | Building should pass | `ui`, `crashes`, `codegen` | N/A |
| `build-fail` | Building should fail | `ui`, `crashes` | N/A |
| `run-pass` | Program must exit with code `0` | `ui`, `crashes` | N/A |
| `run-fail` | Program must exit with code `1..=127` | `ui`, `crashes` | N/A |
| `check-pass` | Building (no codegen) should pass | `ui` | N/A |
| `check-fail` | Building (no codegen) should fail | `ui` | N/A |
| `build-pass` | Building should pass | `ui` | N/A |
| `build-fail` | Building should fail | `ui` | N/A |
| `run-pass` | Program must exit with code `0` | `ui` | N/A |
| `run-fail` | Program must exit with code `1..=127` | `ui` | N/A |
| `run-crash` | Program must crash | `ui` | N/A |
| `run-fail-or-crash` | Program must `run-fail` or `run-crash` | `ui` | N/A |
| `ignore-pass` | Ignore `--pass` flag | `ui`, `crashes`, `codegen`, `incremental` | N/A |
| `ignore-pass` | Ignore `--pass` flag | `ui` | N/A |
| `dont-check-failure-status` | Don't check exact failure status (i.e. `1`) | `ui`, `incremental` | N/A |
| `failure-status` | On failure, the compiler must exit with this status code. To expect an ICE, use `//@ failure-status: 101`. | `ui`, `crashes`, `incremental` | Any `u16` |
| `failure-status` | On failure, the compiler must exit with this status code. To expect an ICE, use `//@ failure-status: 101`. | `ui`, `incremental` | Any `u16` |
| `should-fail` | Compiletest self-test | All | N/A |

### Controlling output snapshots and normalizations
Expand Down
4 changes: 1 addition & 3 deletions src/tools/compiletest/src/directives.rs
Original file line number Diff line number Diff line change
Expand Up @@ -408,8 +408,7 @@ impl TestProps {

fn update_fail_mode(&mut self, ln: &DirectiveLine<'_>, config: &Config) {
let check_ui = |mode: &str| {
// Mode::Crashes may need build-fail in order to trigger llvm errors or stack overflows
if config.mode != TestMode::Ui && config.mode != TestMode::Crashes {
if config.mode != TestMode::Ui {
panic!("`{}-fail` directive is only supported in UI tests", mode);
}
};
Expand Down Expand Up @@ -441,7 +440,6 @@ impl TestProps {
fn update_pass_mode(&mut self, ln: &DirectiveLine<'_>, config: &Config) {
let check_no_run = |s| match (config.mode, s) {
(TestMode::Ui, _) => (),
(TestMode::Crashes, _) => (),
(mode, _) => panic!("`{s}` directive is not supported in `{mode}` tests"),
};
let pass_mode = if config.parse_name_directive(ln, "check-pass") {
Expand Down
5 changes: 2 additions & 3 deletions src/tools/compiletest/src/runtest/crashes.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
use super::{TestCx, WillExecute};
use super::{Emit, TestCx, WillExecute};

impl TestCx<'_> {
pub(super) fn run_crash_test(&self) {
let pm = self.pass_mode();
let proc_res = self.compile_test(WillExecute::No, self.should_emit_metadata(pm));
let proc_res = self.compile_test(WillExecute::No, Emit::None);

if std::env::var("COMPILETEST_VERBOSE_CRASHES").is_ok() {
writeln!(self.stderr, "{}", proc_res.status);
Expand Down
Loading