Skip to content

[COMPILETEST-UNTANGLE 6/N] Use TestSuite enum instead of stringly-typed test suites #143870

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

Draft
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

jieyouxu
Copy link
Member

Caution

Stacked on top of #143823.

This is part of a patch series to untangle compiletest to hopefully nudge it towards being more maintainable.

This PR should contain no functional changes.

jieyouxu added 7 commits July 13, 2025 14:48
They do not have sensible defaults, and it is crucial that we get them
right.
It is *critical* that we maintain clear nomenclature in `compiletest`.
We have many types of "modes" in `compiletest` -- pass modes, coverage
modes, compare modes, you name it. `Mode` is also a *super* general
term. Rename it to `TestMode` to leave no room for such ambiguity.

As a follow-up, I also intend to introduce an enum for `TestSuite`, then
rid of all usage of glob re-exported `TestMode::*` enum variants -- many
test suites share the same name as the test mode.
I would like to introduce `TestSuite` over stringly-typed test suite
names, and some test suite names are the same as test modes, which can
make this very confusing.
@jieyouxu jieyouxu added the S-blocked Status: Blocked on something else such as an RFC or other implementation work. label Jul 13, 2025
@rustbot rustbot added A-compiletest Area: The compiletest test runner A-testsuite Area: The testsuite used to check the correctness of rustc S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. labels Jul 13, 2025
@@ -869,7 +867,6 @@ const COMPILETEST_DIRECTIVE_PREFIX: &str = "//@";

fn iter_directives(
mode: TestMode,
_suite: &str,
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: removed as this is (at the moment) unused.

Comment on lines +56 to +80
// Note that coverage tests use the same test files for multiple test modes.
string_enum! {
#[derive(Clone, Copy, PartialEq, Debug)]
pub enum TestSuite {
Assembly => "assembly",
Codegen => "codegen",
CodegenUnits => "codegen-units",
Coverage => "coverage",
CoverageRunRustdoc => "coverage-run-rustdoc",
Crashes => "crashes",
Debuginfo => "debuginfo",
Incremental => "incremental",
MirOpt => "mir-opt",
Pretty => "pretty",
RunMake => "run-make",
Rustdoc => "rustdoc",
RustdocGui => "rustdoc-gui",
RustdocJs => "rustdoc-js",
RustdocJsStd=> "rustdoc-js-std",
RustdocJson => "rustdoc-json",
RustdocUi => "rustdoc-ui",
Ui => "ui",
UiFullDeps => "ui-fulldeps",
}
}
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: probably will want to share this definition in the future with bootstrap, but strive for compiletest-internal self-consistency first (à la #135653, but don't want to do that yet to make compiletest refactorings less annoying).

@Kobzol
Copy link
Member

Kobzol commented Jul 13, 2025

Looks simple enough, and a nice cleanup.

@Kobzol
Copy link
Member

Kobzol commented Jul 13, 2025

r? @Kobzol

@rust-log-analyzer
Copy link
Collaborator

The job x86_64-gnu-tools failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)

@bors
Copy link
Collaborator

bors commented Jul 13, 2025

☔ The latest upstream changes (presumably #143867) made this pull request unmergeable. Please resolve the merge conflicts.

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-blocked Status: Blocked on something else such as an RFC or other implementation work. S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants