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

Update compiletest directives to be in ui_test style //@ #1895

Merged
merged 1 commit into from
Feb 22, 2024

Conversation

jieyouxu
Copy link
Member

Waiting on rust-lang/rust#121370 to be merged.

Copy link
Member

@JohnTitor JohnTitor left a comment

Choose a reason for hiding this comment

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

Thanks!

@jieyouxu jieyouxu force-pushed the migrate-compiletest-directives branch from 4baa4e2 to 0f89f5e Compare February 22, 2024 12:06
@jieyouxu
Copy link
Member Author

(oops I rebased the wrong repo lol, I thought it was rustc)

bors added a commit to rust-lang-ci/rust that referenced this pull request Feb 22, 2024
…ves, 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
(<rust-lang/compiler-team#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 (rust-lang/compiler-team#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). <rust-lang/rustc-dev-guide#1895>.
@Noratrieb
Copy link
Member

This PR #1895 updating the docs on compiletest headers should probably also get merged soon now that the migration is done to avoid confusion lol

ok

@Noratrieb Noratrieb merged commit 7b0ef5b into rust-lang:master Feb 22, 2024
1 check passed
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Feb 26, 2024
Update books

## rust-lang/book

1 commits in 71352deb20727b4dda9ebfe8182709d5bf17dfea..19c40bfd2d57641d962f3119a1c343355f1b3c5e
2024-02-19 20:39:35 UTC to 2024-02-19 20:39:35 UTC

- Rust upgrades (rust-lang/book#3844)

## rust-lang/edition-guide

3 commits in 76bd48a273a0e0413a3bf22c699112d41497b99e..e1eead1181a691e56299294d5f1d62fe7a26d317
2024-02-24 21:15:28 UTC to 2024-02-17 21:44:36 UTC

- Rename static_mut_refs (rust-lang/edition-guide#293)
- Add 2024 prelude (rust-lang/edition-guide#292)
- Add some more initial stub docs for 2024. (rust-lang/edition-guide#291)

## rust-lang/reference

5 commits in 8227666de13f6e7bb32dea9dc42e841adb5ce4b7..3417f866932cb1c09c6be0f31d2a02ee01b4b95d
2024-02-25 19:37:14 UTC to 2024-02-15 13:28:59 UTC

- Document `target_abi` (rust-lang/reference#1446)
- Add `rust-toolchain.toml` and revise README (rust-lang/reference#1474)
- Clarify semantics of the various pointer to pointer casts (rust-lang/reference#1451)
- Update aarch64 target feature docs to match LLVM (rust-lang/reference#1470)
- Fix grammar for TypePathFn (rust-lang/reference#1281)

## rust-lang/rust-by-example

4 commits in e188d5d466f7f3ff9f1d518393235f4fe951be46..57f1e708f5d5850562bc385aaf610e6af14d6ec8
2024-02-24 18:31:19 UTC to 2024-02-14 13:06:53 UTC

- bug: fix typo (rust-lang/rust-by-example#1822)
- Fix typo in attribute.md (rust-lang/rust-by-example#1818)
- Add Japanese translation (rust-lang/rust-by-example#1794)
- Remove unused .travis.yml file (rust-lang/rust-by-example#1816)

## rust-lang/rustc-dev-guide

9 commits in 1f30cc7cca9a3433bc1872abdc98960b36c21ca0..7b0ef5b0bea5e3ce3b9764aa5754a60e2cc05c52
2024-02-22 19:15:52 UTC to 2024-02-13 12:13:06 UTC

- Update compiletest directives to be in `ui_test` style `//`@`` (rust-lang/rustc-dev-guide#1895)
- Add notes on tweak rust-analyzer.check.overrideCommand (rust-lang/rustc-dev-guide#1890)
- Fix more links (rust-lang/rustc-dev-guide#1884)
- Remove references to -Z ast-json and -Z ast-json-noexpand (rust-lang/rustc-dev-guide#1893)
- Specify ui test suite directives and add note on ignore-tidy directives (rust-lang/rustc-dev-guide#1892)
- Update docs about ui tests now using `//`@`` headers (rust-lang/rustc-dev-guide#1885)
- Make git rebase commands more bulletproof (rust-lang/rustc-dev-guide#1889)
- updating-llvm.md: command does not work (rust-lang/rustc-dev-guide#1887)
- fix update llvm build command (rust-lang/rustc-dev-guide#1886)
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Feb 27, 2024
Rollup merge of rust-lang#121639 - rustbot:docs-update, r=ehuss

Update books

## rust-lang/book

1 commits in 71352deb20727b4dda9ebfe8182709d5bf17dfea..19c40bfd2d57641d962f3119a1c343355f1b3c5e
2024-02-19 20:39:35 UTC to 2024-02-19 20:39:35 UTC

- Rust upgrades (rust-lang/book#3844)

## rust-lang/edition-guide

3 commits in 76bd48a273a0e0413a3bf22c699112d41497b99e..e1eead1181a691e56299294d5f1d62fe7a26d317
2024-02-24 21:15:28 UTC to 2024-02-17 21:44:36 UTC

- Rename static_mut_refs (rust-lang/edition-guide#293)
- Add 2024 prelude (rust-lang/edition-guide#292)
- Add some more initial stub docs for 2024. (rust-lang/edition-guide#291)

## rust-lang/reference

5 commits in 8227666de13f6e7bb32dea9dc42e841adb5ce4b7..3417f866932cb1c09c6be0f31d2a02ee01b4b95d
2024-02-25 19:37:14 UTC to 2024-02-15 13:28:59 UTC

- Document `target_abi` (rust-lang/reference#1446)
- Add `rust-toolchain.toml` and revise README (rust-lang/reference#1474)
- Clarify semantics of the various pointer to pointer casts (rust-lang/reference#1451)
- Update aarch64 target feature docs to match LLVM (rust-lang/reference#1470)
- Fix grammar for TypePathFn (rust-lang/reference#1281)

## rust-lang/rust-by-example

4 commits in e188d5d466f7f3ff9f1d518393235f4fe951be46..57f1e708f5d5850562bc385aaf610e6af14d6ec8
2024-02-24 18:31:19 UTC to 2024-02-14 13:06:53 UTC

- bug: fix typo (rust-lang/rust-by-example#1822)
- Fix typo in attribute.md (rust-lang/rust-by-example#1818)
- Add Japanese translation (rust-lang/rust-by-example#1794)
- Remove unused .travis.yml file (rust-lang/rust-by-example#1816)

## rust-lang/rustc-dev-guide

9 commits in 1f30cc7cca9a3433bc1872abdc98960b36c21ca0..7b0ef5b0bea5e3ce3b9764aa5754a60e2cc05c52
2024-02-22 19:15:52 UTC to 2024-02-13 12:13:06 UTC

- Update compiletest directives to be in `ui_test` style `//`@`` (rust-lang/rustc-dev-guide#1895)
- Add notes on tweak rust-analyzer.check.overrideCommand (rust-lang/rustc-dev-guide#1890)
- Fix more links (rust-lang/rustc-dev-guide#1884)
- Remove references to -Z ast-json and -Z ast-json-noexpand (rust-lang/rustc-dev-guide#1893)
- Specify ui test suite directives and add note on ignore-tidy directives (rust-lang/rustc-dev-guide#1892)
- Update docs about ui tests now using `//`@`` headers (rust-lang/rustc-dev-guide#1885)
- Make git rebase commands more bulletproof (rust-lang/rustc-dev-guide#1889)
- updating-llvm.md: command does not work (rust-lang/rustc-dev-guide#1887)
- fix update llvm build command (rust-lang/rustc-dev-guide#1886)
github-actions bot pushed a commit to rust-lang/miri that referenced this pull request Feb 27, 2024
Update books

## rust-lang/book

1 commits in 71352deb20727b4dda9ebfe8182709d5bf17dfea..19c40bfd2d57641d962f3119a1c343355f1b3c5e
2024-02-19 20:39:35 UTC to 2024-02-19 20:39:35 UTC

- Rust upgrades (rust-lang/book#3844)

## rust-lang/edition-guide

3 commits in 76bd48a273a0e0413a3bf22c699112d41497b99e..e1eead1181a691e56299294d5f1d62fe7a26d317
2024-02-24 21:15:28 UTC to 2024-02-17 21:44:36 UTC

- Rename static_mut_refs (rust-lang/edition-guide#293)
- Add 2024 prelude (rust-lang/edition-guide#292)
- Add some more initial stub docs for 2024. (rust-lang/edition-guide#291)

## rust-lang/reference

5 commits in 8227666de13f6e7bb32dea9dc42e841adb5ce4b7..3417f866932cb1c09c6be0f31d2a02ee01b4b95d
2024-02-25 19:37:14 UTC to 2024-02-15 13:28:59 UTC

- Document `target_abi` (rust-lang/reference#1446)
- Add `rust-toolchain.toml` and revise README (rust-lang/reference#1474)
- Clarify semantics of the various pointer to pointer casts (rust-lang/reference#1451)
- Update aarch64 target feature docs to match LLVM (rust-lang/reference#1470)
- Fix grammar for TypePathFn (rust-lang/reference#1281)

## rust-lang/rust-by-example

4 commits in e188d5d466f7f3ff9f1d518393235f4fe951be46..57f1e708f5d5850562bc385aaf610e6af14d6ec8
2024-02-24 18:31:19 UTC to 2024-02-14 13:06:53 UTC

- bug: fix typo (rust-lang/rust-by-example#1822)
- Fix typo in attribute.md (rust-lang/rust-by-example#1818)
- Add Japanese translation (rust-lang/rust-by-example#1794)
- Remove unused .travis.yml file (rust-lang/rust-by-example#1816)

## rust-lang/rustc-dev-guide

9 commits in 1f30cc7cca9a3433bc1872abdc98960b36c21ca0..7b0ef5b0bea5e3ce3b9764aa5754a60e2cc05c52
2024-02-22 19:15:52 UTC to 2024-02-13 12:13:06 UTC

- Update compiletest directives to be in `ui_test` style `//`@`` (rust-lang/rustc-dev-guide#1895)
- Add notes on tweak rust-analyzer.check.overrideCommand (rust-lang/rustc-dev-guide#1890)
- Fix more links (rust-lang/rustc-dev-guide#1884)
- Remove references to -Z ast-json and -Z ast-json-noexpand (rust-lang/rustc-dev-guide#1893)
- Specify ui test suite directives and add note on ignore-tidy directives (rust-lang/rustc-dev-guide#1892)
- Update docs about ui tests now using `//`@`` headers (rust-lang/rustc-dev-guide#1885)
- Make git rebase commands more bulletproof (rust-lang/rustc-dev-guide#1889)
- updating-llvm.md: command does not work (rust-lang/rustc-dev-guide#1887)
- fix update llvm build command (rust-lang/rustc-dev-guide#1886)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants