about summary refs log tree commit diff
path: root/tests/codegen/debug-accessibility
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2024-02-22 16:39:09 +0000
committerbors <bors@rust-lang.org>2024-02-22 16:39:09 +0000
commitf62f490fd410c06031a57915b4e5580ccbd7a30f (patch)
treed070b9f4ba33bd10d028044860c87705806e6f77 /tests/codegen/debug-accessibility
parent933a05bd0ba91caf219222e5f61d1c92d141ff61 (diff)
parentcd25009469926abec4b1104396ef99026a6b9b9c (diff)
downloadrust-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/debug-accessibility')
-rw-r--r--tests/codegen/debug-accessibility/crate-enum.rs2
-rw-r--r--tests/codegen/debug-accessibility/crate-struct.rs2
-rw-r--r--tests/codegen/debug-accessibility/private-enum.rs2
-rw-r--r--tests/codegen/debug-accessibility/private-struct.rs2
-rw-r--r--tests/codegen/debug-accessibility/public-enum.rs2
-rw-r--r--tests/codegen/debug-accessibility/public-struct.rs2
-rw-r--r--tests/codegen/debug-accessibility/struct-fields.rs2
-rw-r--r--tests/codegen/debug-accessibility/super-enum.rs2
-rw-r--r--tests/codegen/debug-accessibility/super-struct.rs2
-rw-r--r--tests/codegen/debug-accessibility/tuple-fields.rs2
10 files changed, 10 insertions, 10 deletions
diff --git a/tests/codegen/debug-accessibility/crate-enum.rs b/tests/codegen/debug-accessibility/crate-enum.rs
index eeea18dd815..c80700d7b28 100644
--- a/tests/codegen/debug-accessibility/crate-enum.rs
+++ b/tests/codegen/debug-accessibility/crate-enum.rs
@@ -1,4 +1,4 @@
-// compile-flags: -C debuginfo=2
+//@ compile-flags: -C debuginfo=2
 // ignore-tidy-linelength
 
 #![allow(dead_code)]
diff --git a/tests/codegen/debug-accessibility/crate-struct.rs b/tests/codegen/debug-accessibility/crate-struct.rs
index 68d126a3478..73a8ce852ed 100644
--- a/tests/codegen/debug-accessibility/crate-struct.rs
+++ b/tests/codegen/debug-accessibility/crate-struct.rs
@@ -1,4 +1,4 @@
-// compile-flags: -C debuginfo=2
+//@ compile-flags: -C debuginfo=2
 
 #![allow(dead_code)]
 
diff --git a/tests/codegen/debug-accessibility/private-enum.rs b/tests/codegen/debug-accessibility/private-enum.rs
index 7f81026ddec..22d49a40eff 100644
--- a/tests/codegen/debug-accessibility/private-enum.rs
+++ b/tests/codegen/debug-accessibility/private-enum.rs
@@ -1,4 +1,4 @@
-// compile-flags: -C debuginfo=2
+//@ compile-flags: -C debuginfo=2
 // ignore-tidy-linelength
 
 #![allow(dead_code)]
diff --git a/tests/codegen/debug-accessibility/private-struct.rs b/tests/codegen/debug-accessibility/private-struct.rs
index 43b260f9024..488a680e81c 100644
--- a/tests/codegen/debug-accessibility/private-struct.rs
+++ b/tests/codegen/debug-accessibility/private-struct.rs
@@ -1,4 +1,4 @@
-// compile-flags: -C debuginfo=2
+//@ compile-flags: -C debuginfo=2
 
 #![allow(dead_code)]
 
diff --git a/tests/codegen/debug-accessibility/public-enum.rs b/tests/codegen/debug-accessibility/public-enum.rs
index 29ae5fd6421..f16ccf1a3c9 100644
--- a/tests/codegen/debug-accessibility/public-enum.rs
+++ b/tests/codegen/debug-accessibility/public-enum.rs
@@ -1,4 +1,4 @@
-// compile-flags: -C debuginfo=2
+//@ compile-flags: -C debuginfo=2
 // ignore-tidy-linelength
 
 #![allow(dead_code)]
diff --git a/tests/codegen/debug-accessibility/public-struct.rs b/tests/codegen/debug-accessibility/public-struct.rs
index e7cd9b40d09..8b2a53f993c 100644
--- a/tests/codegen/debug-accessibility/public-struct.rs
+++ b/tests/codegen/debug-accessibility/public-struct.rs
@@ -1,4 +1,4 @@
-// compile-flags: -C debuginfo=2
+//@ compile-flags: -C debuginfo=2
 
 #![allow(dead_code)]
 
diff --git a/tests/codegen/debug-accessibility/struct-fields.rs b/tests/codegen/debug-accessibility/struct-fields.rs
index 76831bdc6c6..f68bb3438be 100644
--- a/tests/codegen/debug-accessibility/struct-fields.rs
+++ b/tests/codegen/debug-accessibility/struct-fields.rs
@@ -1,4 +1,4 @@
-// compile-flags: -C debuginfo=2
+//@ compile-flags: -C debuginfo=2
 
 #![allow(dead_code)]
 
diff --git a/tests/codegen/debug-accessibility/super-enum.rs b/tests/codegen/debug-accessibility/super-enum.rs
index 9d83fb45bd0..1b6d7d793ed 100644
--- a/tests/codegen/debug-accessibility/super-enum.rs
+++ b/tests/codegen/debug-accessibility/super-enum.rs
@@ -1,4 +1,4 @@
-// compile-flags: -C debuginfo=2
+//@ compile-flags: -C debuginfo=2
 // ignore-tidy-linelength
 
 #![allow(dead_code)]
diff --git a/tests/codegen/debug-accessibility/super-struct.rs b/tests/codegen/debug-accessibility/super-struct.rs
index 481006c3965..63954bfb203 100644
--- a/tests/codegen/debug-accessibility/super-struct.rs
+++ b/tests/codegen/debug-accessibility/super-struct.rs
@@ -1,4 +1,4 @@
-// compile-flags: -C debuginfo=2
+//@ compile-flags: -C debuginfo=2
 
 #![allow(dead_code)]
 
diff --git a/tests/codegen/debug-accessibility/tuple-fields.rs b/tests/codegen/debug-accessibility/tuple-fields.rs
index 1163ba2c7c3..feec6e9eb41 100644
--- a/tests/codegen/debug-accessibility/tuple-fields.rs
+++ b/tests/codegen/debug-accessibility/tuple-fields.rs
@@ -1,4 +1,4 @@
-// compile-flags: -C debuginfo=2
+//@ compile-flags: -C debuginfo=2
 
 #![allow(dead_code)]