forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of rust-lang#120881 - jieyouxu:migrate-ui-test-directives,…
… r=oli-obk Migrate ui tests from legacy compiletest-style directives `//` to `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 ui 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 ui tests only and make compiletest only accept `//`@`` directives in the "ui" test suite (only). ## Key Changes 1. All ui test `//` directives are replaced by `//`@`` directives. 2. Only accept `//`@`` directives for "ui" test suite. 3. Errors if a comment could be interpreted as a legacy-style `//` directive. ## Diff Generation The diff is generated by: - Collecting directives from ui tests via hacking on compiletest. - Using a migration tool to replace `//` directives in ui tests with `//`@`.` ### Reproduction Steps 0. Delete the temporary directory `$RUSTC_REPO_PATH/build/x86_64-apple-darwin/test/ui/__directive_lines` and the temporary file `$RUSTC_REPO_PATH/build/x86_64-apple-darwin/test/ui/__directive_lines.txt` (if you ran the collection script before). 1. Use the <https://github.com/jieyouxu/rust/tree/collect-test-directives> collect-test-directives script, which outputs temporary files recording headers occuring in each ui test. - You need to checkout this branch: `git checkout collect-test-directives`. - You might need to rebase on lastest master and ensure there are no conflicts. - You likely need to run `./x test tests/ui --stage 1 --force-rerun` to generate the temporary files consistently. 2. Checkout the `migrate-ui-test-directives` branch. 4. Run the migration tool <https://github.com/jieyouxu/compiletest-ui_test-header-migration>. - You will need to first generate a `migration_config.toml` via `cargo run -- generate-config` under `$CWD`. - Then, update `manual_directives = ["// should-fail"]` in `migration_config.toml`. This is required because the collection script doesn't deal with some special meta ui tests and there are no other `// should-fail` occurrences. 5. Check that the migration at least does not cause UI test failures if you change compiletest to accept `//`@`` directives for ui tests only. - `RUSTC_TEST_FAIL_FAST=1 ./x test tests/ui --stage 1 --bless` 6. Confirm that there is no difference after running the migration tool when you are on the `migrate-ui-test-directives` branch. ## Next Steps - [x] ~~Need to implement some kind of warning or tidy script to help contributors catch old-style `// <directive-name>` directives, while only accepting `ui_test`-style `//@ <directive-name>` directives.~~ An error is emitted if a comment that could be interpreted as legacy-style test directive is encountered. - [ ] Need to properly document this change in e.g. rustc-dev-guide (rust-lang/rustc-dev-guide#1885). - [x] Add a `README.md` to `tests/ui` describing the directive style change.
- Loading branch information
Showing
9,930 changed files
with
17,008 additions
and
16,703 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.