diff options
| author | bors <bors@rust-lang.org> | 2024-02-22 16:39:09 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2024-02-22 16:39:09 +0000 |
| commit | f62f490fd410c06031a57915b4e5580ccbd7a30f (patch) | |
| tree | d070b9f4ba33bd10d028044860c87705806e6f77 /tests/codegen/enum | |
| parent | 933a05bd0ba91caf219222e5f61d1c92d141ff61 (diff) | |
| parent | cd25009469926abec4b1104396ef99026a6b9b9c (diff) | |
| download | rust-f62f490fd410c06031a57915b4e5580ccbd7a30f.tar.gz rust-f62f490fd410c06031a57915b4e5580ccbd7a30f.zip | |
Auto merge of #121370 - jieyouxu:migrate-compiletest-directives, r=oli-obk
Migrate compiletest to use `ui_test`-style `//@` directives
## Preface
There's an on-going effort to rewrite parts of or the entirety of compiletest
(<https://github.com/rust-lang/compiler-team/issues/536>). A step towards this involve migrating
compiletest tests to use the [`ui_test`](https://github.com/oli-obk/ui_test) framework, which
involves changing compiletest directives in `// <directive-name>` style to `ui_test`
`//@ <directive-name>` style (https://github.com/rust-lang/compiler-team/issues/512).
This PR aims to implement the directive-style change from `//` to `//`@`` for the remaining
non-"ui" test suite tests.
## Key Changes
1. All `tests/` tests now use `//`@`` directives.
2. Compiletest only accepts `//`@`` and issues an error if an old-style directive is detected.
3. `// ignore-tidy` and `// ignore-tidy-*` are considered tidy directives and are ignored by
compiletest header parsing.
## Diff Generation
The diff is generated by:
- Collecting directives from `tests/` via hijacking compiletest to emit successfully parsed
directive lines.
- Using a migration tool
(<https://github.com/jieyouxu/compiletest-ui_test-header-migration/tree/master>) to replace
`//` directives in compiletest tests with `//`@`.`
### Reproduction Steps
0. Delete the temporary file `$RUSTC_REPO_PATH/build/<target_triple>/test/__directive_lines.txt`,
if the collection script was previously ran.
1. Use the <https://github.com/jieyouxu/rust/tree/collect-test-directives> collect-test-directives
script, which outputs a temporary file recording headers occuring in each compiletest test.
- You need to checkout this branch: `git checkout collect-test-directives`.
- This needs to be rebased on latest master to ensure up-to-date test directives can be collected.
- You need to run `./x test` on each of the `test/*` subfolders once:
```bash
./x test tests/assembly/ --stage 1 --force-rerun
./x test tests/codegen/ --stage 1 --force-rerun
./x test tests/codegen-units/ --stage 1 --force-rerun
./x test tests/coverage/ --stage 1 --force-rerun
./x test tests/coverage-run-rustdoc/ --stage 1 --force-rerun
./x test tests/debuginfo/ --stage 1 --force-rerun
./x test tests/incremental/ --stage 1 --force-rerun
./x test tests/mir-opt/ --stage 1 --force-rerun
./x test tests/pretty/ --stage 1 --force-rerun
./x test tests/run-make/ --stage 1 --force-rerun
./x test tests/run-make-fulldeps/ --stage 1 --force-rerun
./x test tests/run-pass-valgrind/ --stage 1 --force-rerun
./x test tests/rustdoc/ --stage 1 --force-rerun
TARGET=<target-triple> ./x test tests/rustdoc-gui/ --stage 1 --force-rerun
./x test tests/rustdoc-js/ --stage 1 --force-rerun
./x test tests/rustdoc-js-std/ --stage 1 --force-rerun
./x test tests/rustdoc-json/ --stage 1 --force-rerun
./x test tests/rustdoc-ui/ --stage 1 --force-rerun
./x test tests/ui/ --stage 1 --force-rerun
./x test tests/ui-fulldeps/ --stage 1 --force-rerun
```
2. Checkout the `migrate-compiletest-directives` branch.
3. Run the migration tool <https://github.com/jieyouxu/compiletest-ui_test-header-migration>.
4. Check that the migration at least does not cause test failures if you change compiletest to
accept `//`@`` directives only. This is also required if the test outputs somehow need to be
blessed.
- `RUSTC_TEST_FAIL_FAST=1 ./x test tests/<secondary-directory> --stage 1 --bless`
5. Confirm that there is no difference after running the migration tool when you are on the
`migrate-compiletest-directives` branch.
## Follow Up Work
- [ ] Adjust rustc-dev-guide docs for compiletest directives (this time for all the other suites and modes). <https://github.com/rust-lang/rustc-dev-guide/pull/1895>.
Diffstat (limited to 'tests/codegen/enum')
| -rw-r--r-- | tests/codegen/enum/enum-bounds-check-derived-idx.rs | 2 | ||||
| -rw-r--r-- | tests/codegen/enum/enum-bounds-check-issue-13926.rs | 2 | ||||
| -rw-r--r-- | tests/codegen/enum/enum-bounds-check-issue-82871.rs | 2 | ||||
| -rw-r--r-- | tests/codegen/enum/enum-bounds-check.rs | 2 | ||||
| -rw-r--r-- | tests/codegen/enum/enum-debug-clike.rs | 4 | ||||
| -rw-r--r-- | tests/codegen/enum/enum-debug-niche-2.rs | 4 | ||||
| -rw-r--r-- | tests/codegen/enum/enum-debug-niche.rs | 4 | ||||
| -rw-r--r-- | tests/codegen/enum/enum-debug-tagged.rs | 4 | ||||
| -rw-r--r-- | tests/codegen/enum/enum-discriminant-value.rs | 2 | ||||
| -rw-r--r-- | tests/codegen/enum/enum-match.rs | 4 | ||||
| -rw-r--r-- | tests/codegen/enum/enum-u128.rs | 4 |
11 files changed, 17 insertions, 17 deletions
diff --git a/tests/codegen/enum/enum-bounds-check-derived-idx.rs b/tests/codegen/enum/enum-bounds-check-derived-idx.rs index aa66c2ed08e..15280cb2e6c 100644 --- a/tests/codegen/enum/enum-bounds-check-derived-idx.rs +++ b/tests/codegen/enum/enum-bounds-check-derived-idx.rs @@ -1,6 +1,6 @@ // This test checks an optimization that is not guaranteed to work. This test case should not block // a future LLVM update. -// compile-flags: -O +//@ compile-flags: -O #![crate_type = "lib"] diff --git a/tests/codegen/enum/enum-bounds-check-issue-13926.rs b/tests/codegen/enum/enum-bounds-check-issue-13926.rs index b26945bc549..b60ff38ce39 100644 --- a/tests/codegen/enum/enum-bounds-check-issue-13926.rs +++ b/tests/codegen/enum/enum-bounds-check-issue-13926.rs @@ -1,6 +1,6 @@ // This test checks an optimization that is not guaranteed to work. This test case should not block // a future LLVM update. -// compile-flags: -O +//@ compile-flags: -O #![crate_type = "lib"] diff --git a/tests/codegen/enum/enum-bounds-check-issue-82871.rs b/tests/codegen/enum/enum-bounds-check-issue-82871.rs index 32fdc4a5f4f..3b8a146838a 100644 --- a/tests/codegen/enum/enum-bounds-check-issue-82871.rs +++ b/tests/codegen/enum/enum-bounds-check-issue-82871.rs @@ -1,4 +1,4 @@ -// compile-flags: -C opt-level=0 +//@ compile-flags: -C opt-level=0 #![crate_type = "lib"] diff --git a/tests/codegen/enum/enum-bounds-check.rs b/tests/codegen/enum/enum-bounds-check.rs index 17322d5911b..a1b32ec9295 100644 --- a/tests/codegen/enum/enum-bounds-check.rs +++ b/tests/codegen/enum/enum-bounds-check.rs @@ -1,4 +1,4 @@ -// compile-flags: -O +//@ compile-flags: -O #![crate_type = "lib"] diff --git a/tests/codegen/enum/enum-debug-clike.rs b/tests/codegen/enum/enum-debug-clike.rs index 1e369a2c4e6..205c57d1456 100644 --- a/tests/codegen/enum/enum-debug-clike.rs +++ b/tests/codegen/enum/enum-debug-clike.rs @@ -2,9 +2,9 @@ // This is ignored for the fallback mode on MSVC due to problems with PDB. // -// ignore-msvc +//@ ignore-msvc -// compile-flags: -g -C no-prepopulate-passes +//@ compile-flags: -g -C no-prepopulate-passes // CHECK-LABEL: @main // CHECK: {{.*}}DICompositeType{{.*}}tag: DW_TAG_enumeration_type,{{.*}}name: "E",{{.*}}flags: DIFlagEnumClass,{{.*}} diff --git a/tests/codegen/enum/enum-debug-niche-2.rs b/tests/codegen/enum/enum-debug-niche-2.rs index 4b607d50574..4315741e0bd 100644 --- a/tests/codegen/enum/enum-debug-niche-2.rs +++ b/tests/codegen/enum/enum-debug-niche-2.rs @@ -2,9 +2,9 @@ // This is ignored for the fallback mode on MSVC due to problems with PDB. // -// ignore-msvc +//@ ignore-msvc -// compile-flags: -g -C no-prepopulate-passes +//@ compile-flags: -g -C no-prepopulate-passes // CHECK: {{.*}}DICompositeType{{.*}}tag: DW_TAG_variant_part,{{.*}}size: 32,{{.*}} // CHECK: {{.*}}DIDerivedType{{.*}}tag: DW_TAG_member,{{.*}}name: "Placeholder",{{.*}}extraData: i128 4294967295{{[,)].*}} diff --git a/tests/codegen/enum/enum-debug-niche.rs b/tests/codegen/enum/enum-debug-niche.rs index b718a6854dd..fc6a73e8472 100644 --- a/tests/codegen/enum/enum-debug-niche.rs +++ b/tests/codegen/enum/enum-debug-niche.rs @@ -1,9 +1,9 @@ // This tests that optimized enum debug info accurately reflects the enum layout. // This is ignored for the fallback mode on MSVC due to problems with PDB. -// ignore-msvc +//@ ignore-msvc -// compile-flags: -g -C no-prepopulate-passes +//@ compile-flags: -g -C no-prepopulate-passes // CHECK-LABEL: @main // CHECK: {{.*}}DICompositeType{{.*}}tag: DW_TAG_variant_part,{{.*}}discriminator:{{.*}} diff --git a/tests/codegen/enum/enum-debug-tagged.rs b/tests/codegen/enum/enum-debug-tagged.rs index 095c49ac3ac..87a6ccae291 100644 --- a/tests/codegen/enum/enum-debug-tagged.rs +++ b/tests/codegen/enum/enum-debug-tagged.rs @@ -1,9 +1,9 @@ // This tests that debug info for tagged (ordinary) enums is properly emitted. // This is ignored for the fallback mode on MSVC due to problems with PDB. -// ignore-msvc +//@ ignore-msvc -// compile-flags: -g -C no-prepopulate-passes +//@ compile-flags: -g -C no-prepopulate-passes // CHECK-LABEL: @main // CHECK: {{.*}}DICompositeType{{.*}}tag: DW_TAG_structure_type,{{.*}}name: "E",{{.*}} diff --git a/tests/codegen/enum/enum-discriminant-value.rs b/tests/codegen/enum/enum-discriminant-value.rs index cc14c212002..d6b0c6d6c10 100644 --- a/tests/codegen/enum/enum-discriminant-value.rs +++ b/tests/codegen/enum/enum-discriminant-value.rs @@ -1,6 +1,6 @@ // Verify that DIEnumerator uses isUnsigned flag when appropriate. // -// compile-flags: -g -C no-prepopulate-passes +//@ compile-flags: -g -C no-prepopulate-passes #[repr(i64)] pub enum I64 { diff --git a/tests/codegen/enum/enum-match.rs b/tests/codegen/enum/enum-match.rs index 5548cd25147..2e6dad8791b 100644 --- a/tests/codegen/enum/enum-match.rs +++ b/tests/codegen/enum/enum-match.rs @@ -1,5 +1,5 @@ -// compile-flags: -Copt-level=1 -// only-x86_64 +//@ compile-flags: -Copt-level=1 +//@ only-x86_64 #![crate_type = "lib"] diff --git a/tests/codegen/enum/enum-u128.rs b/tests/codegen/enum/enum-u128.rs index f50d360ac9f..94e80e34068 100644 --- a/tests/codegen/enum/enum-u128.rs +++ b/tests/codegen/enum/enum-u128.rs @@ -2,9 +2,9 @@ // This is ignored for the fallback mode on MSVC due to problems with PDB. // -// ignore-msvc +//@ ignore-msvc -// compile-flags: -g -C no-prepopulate-passes +//@ compile-flags: -g -C no-prepopulate-passes // CHECK-LABEL: @main // CHECK: {{.*}}DICompositeType{{.*}}tag: DW_TAG_enumeration_type,{{.*}}name: "Foo",{{.*}}flags: DIFlagEnumClass,{{.*}} |
