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

Break up compiletest runtest.rs into smaller helper modules #130566

Merged
merged 1 commit into from
Sep 20, 2024

Conversation

jieyouxu
Copy link
Member

@jieyouxu jieyouxu commented Sep 19, 2024

Previously compiletest's runtest.rs was a massive 4700 lines file that made reading and navigation very awkward. This PR breaks the runtest.rs file up into smaller helper modules, one for each test suite/mode.

Note

This PR should not contain functional changes, it is intended to be mostly code motion to breakup runtest.rs into smaller helper modules to make it easier to digest.

This PR intentionally does not neatly reorganize where all the methods on TestCx goes, that is intended for a follow-up PR. Some methods on TestCx do not need to be on TestCx. It also does not address a weirdness in valgrind, that is intended for a follow-up PR as well.

Part of a series of compiletest cleanups #130565.

Fixes #89475.

r? @ghost (I need to do a self-review pass first)

@rustbot rustbot added A-testsuite Area: The testsuite used to check the correctness of rustc S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) labels Sep 19, 2024
Copy link
Member Author

@jieyouxu jieyouxu left a comment

Choose a reason for hiding this comment

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

This PR might want to get its git rev ignored as it does a lot of moving.

@@ -18,7 +18,7 @@ impl<'test> TestCx<'test> {
.unwrap_or_else(|| self.fatal("missing --coverage-dump"))
}

pub(crate) fn run_coverage_map_test(&self) {
pub(super) fn run_coverage_map_test(&self) {
Copy link
Member Author

Choose a reason for hiding this comment

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

Remark: changed visibility from pub(crate) -> pub(super) for consistency as it does not need to be visible outside of runtest.rs.

Comment on lines +4 to +6
// FIXME(jieyouxu): `run_rpass_test` got hoisted out of this because apparently valgrind falls back
// to `run_rpass_test` if valgrind isn't available, which is questionable, but keeping it for
// refactoring changes to preserve current behavior.
Copy link
Member Author

Choose a reason for hiding this comment

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

Remark: FIXME because valgrind just runs rpass if valgrind isn't available, which is highly questionable.

Comment on lines +7 to +12
// FIXME(jieyouxu): does this really make any sense? If a valgrind test isn't testing
// valgrind, what is it even testing?
if self.config.valgrind_path.is_none() {
assert!(!self.config.force_valgrind);
return self.run_rpass_test();
}
Copy link
Member Author

Choose a reason for hiding this comment

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

Remark: this is sus

Copy link
Member Author

Choose a reason for hiding this comment

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

Remark: I know this file is still really messy, further changes planned in future PRs.

src/tools/compiletest/src/runtest.rs Show resolved Hide resolved
@jieyouxu jieyouxu marked this pull request as ready for review September 19, 2024 16:28
@jieyouxu jieyouxu added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Sep 19, 2024
@jieyouxu jieyouxu marked this pull request as draft September 19, 2024 16:28
@jieyouxu jieyouxu added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Sep 19, 2024
Previously compiletest's `runtest.rs` was a massive 4700 lines file that
made reading and navigation very awkward.

This commit intentionally does not neatly reorganize where all the
methods on `TestCx` goes, that is intended for a follow-up PR.
@jieyouxu jieyouxu marked this pull request as ready for review September 19, 2024 16:32
@jieyouxu
Copy link
Member Author

This should now be ready for review.
r? compiler
@rustbot ready

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Sep 19, 2024
@jieyouxu
Copy link
Member Author

jieyouxu commented Sep 19, 2024

Would appreciate feedback if this organization makes sense, or if there's a better way to organize it. (And feel free to reroll :3)

@jieyouxu jieyouxu added the A-compiletest Area: the compiletest test runner label Sep 19, 2024
@compiler-errors
Copy link
Member

@bors r+

@bors
Copy link
Contributor

bors commented Sep 20, 2024

📌 Commit 60600a6 has been approved by compiler-errors

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Sep 20, 2024
bors added a commit to rust-lang-ci/rust that referenced this pull request Sep 20, 2024
…llaumeGomez

Rollup of 6 pull requests

Successful merges:

 - rust-lang#129542 (Add regression test for rust-lang#129541)
 - rust-lang#129755 (test: cross-edition metavar fragment specifiers)
 - rust-lang#130566 (Break up compiletest `runtest.rs` into smaller helper modules)
 - rust-lang#130585 (Add tidy check for rustdoc templates to ensure the whitespace characters are all stripped)
 - rust-lang#130605 (Fix feature name in test)
 - rust-lang#130607 ([Clippy] Remove final std paths for diagnostic item)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 6a762c9 into rust-lang:master Sep 20, 2024
6 checks passed
@rustbot rustbot added this to the 1.83.0 milestone Sep 20, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Sep 20, 2024
Rollup merge of rust-lang#130566 - jieyouxu:breakup-runtest, r=compiler-errors

Break up compiletest `runtest.rs` into smaller helper modules

Previously compiletest's `runtest.rs` was a massive 4700 lines file that made reading and navigation very awkward. This PR breaks the `runtest.rs` file up into smaller helper modules, one for each test suite/mode.

> [!NOTE]
> This PR should not contain functional changes, it is intended to be mostly code motion to breakup `runtest.rs` into smaller helper modules to make it easier to digest.
>
> This PR intentionally does not neatly reorganize where all the methods on `TestCx` goes, that is intended for a follow-up PR. Some methods on `TestCx` do not need to be on `TestCx`. It also does not address a weirdness in valgrind, that is intended for a follow-up PR as well.

Part of a series of compiletest cleanups rust-lang#130565.

Fixes rust-lang#89475.

r? `@ghost` (I need to do a self-review pass first)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-compiletest Area: the compiletest test runner A-testsuite Area: The testsuite used to check the correctness of rustc S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
Development

Successfully merging this pull request may close these issues.

Splitting up compiletest::runtest
4 participants