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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

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
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-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) 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
3 participants