Home Explore Blog CI



rustc

2nd chunk of `src/tests/directives.md`
b1cf08a46975a6615a9b9fdfca228205dfde9698f35548f70000000100001002
| `proc-macro`          | Similar to `aux-build`, but for aux forces host and don't use `-Cprefer-dynamic`[^pm].                | All except `run-make` | Path to auxiliary proc-macro `.rs` file       |
| `build-aux-docs`      | Build docs for auxiliaries as well                                                                    | All except `run-make` | N/A                                           |

    [compiletest](./compiletest.md) chapter for specifics.

### Controlling outcome expectations

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`, `incremental`            | N/A             |
| `check-fail`                | Building (no codegen) should fail           | `ui`, `crashes`                           | N/A             |
| `build-pass`                | Building should pass                        | `ui`, `crashes`, `codegen`, `incremental` | N/A             |
| `build-fail`                | Building should fail                        | `ui`, `crashes`                           | N/A             |
| `run-pass`                  | Running the test binary should pass         | `ui`, `crashes`, `incremental`            | N/A             |
| `run-fail`                  | Running the test binary should fail         | `ui`, `crashes`                           | N/A             |
| `ignore-pass`               | Ignore `--pass` flag                        | `ui`, `crashes`, `codegen`, `incremental` | N/A             |
| `dont-check-failure-status` | Don't check exact failure status (i.e. `1`) | `ui`, `incremental`                       | N/A             |
| `failure-status`            | Check                                       | `ui`, `crashes`                           | Any `u16`       |
| `should-ice`                | Check failure status is `101`               | `coverage`, `incremental`                 | N/A             |
| `should-fail`               | Compiletest self-test                       | All                                       | N/A             |

### Controlling output snapshots and normalizations

See [Normalization](ui.md#normalization), [Output
comparison](ui.md#output-comparison) and [Rustfix tests](ui.md#rustfix-tests)
for more details.

| Directive                         | Explanation                                                                                                              | Supported test suites                        | Possible values                                                                         |
|-----------------------------------|--------------------------------------------------------------------------------------------------------------------------|----------------------------------------------|-----------------------------------------------------------------------------------------|
| `check-run-results`               | Check run test binary `run-{pass,fail}` output snapshot                                                                  | `ui`, `crashes`, `incremental` if `run-pass` | N/A                                                                                     |
| `error-pattern`                   | Check that output contains a specific string                                                                             | `ui`, `crashes`, `incremental` if `run-pass` | String                                                                                  |
| `regex-error-pattern`             | Check that output contains a regex pattern                                                                               | `ui`, `crashes`, `incremental` if `run-pass` | Regex                                                                                   |

Title: Compiletest Directives: Outcome Expectations and Output Control
Summary
This section details compiletest directives related to controlling outcome expectations (pass/fail) and managing output snapshots and normalizations. It lists directives like `check-pass`, `check-fail`, `build-pass`, `build-fail`, `run-pass`, and `run-fail`, explaining their purposes and supported test suites. Additionally, it covers directives for output comparison, error patterns, and Rustfix tests, including `check-run-results`, `error-pattern`, and `regex-error-pattern`.