-
Notifications
You must be signed in to change notification settings - Fork 13.5k
[COMPILETEST-UNTANGLE 5/N] Test mode adjustments and other assorted cleanups #143823
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
base: master
Are you sure you want to change the base?
Conversation
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.
rustbot has assigned @compiler-errors. Use |
// Make the macro visible outside of this module, for tests. | ||
#[cfg(test)] | ||
pub(crate) use string_enum; | ||
use crate::util::{Utf8PathBufExt, add_dylib_path, string_enum}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: I'm also going to double-check if we need string_enum
at all (or if it even makes sense in this formulation) in a follow-up.
@@ -151,7 +145,7 @@ pub enum Sanitizer { | |||
/// | |||
/// FIXME: audit these options to make sure we are not hashing less than necessary for build stamp | |||
/// (for changed test detection). | |||
#[derive(Debug, Default, Clone)] | |||
#[derive(Debug, Clone)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remark: I was wondering what a default Config
even means, turns out it's simply unused. Ditto on test mode.
if config.mode == TestMode::Ui { | ||
config.force_pass_mode.hash(&mut hash); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remark: as a concrete example, tests/ui/
is both TestMode::Ui
and TestSuite::Ui
, but these are very different things and must not be mixed up, because a test mode can correspond to multiple test suites.
(TestSuite
is something I want to introduce over stringly-typed test suite names in a follow-up.)
Assembly, Codegen, CodegenUnits, CompareMode, Config, CoverageMap, CoverageRun, Crashes, | ||
DebugInfo, Debugger, FailMode, Incremental, MirOpt, PassMode, Pretty, RunMake, Rustdoc, | ||
RustdocJs, RustdocJson, TestPaths, UI_EXTENSIONS, UI_FIXED, UI_RUN_STDERR, UI_RUN_STDOUT, | ||
UI_STDERR, UI_STDOUT, UI_SVG, UI_WINDOWS_SVG, Ui, expected_output_path, incremental_dir, | ||
output_base_dir, output_base_name, output_testname_unique, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remark: also, I just find this quite nasty.
r? kobzol |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice little cleanup! Left one question, but it's not blocking. Feel free to r=me after CI is green.
use crate::executor::{ColorConfig, OutputFormat}; | ||
use crate::fatal; | ||
use crate::util::{Utf8PathBufExt, add_dylib_path, string_enum}; | ||
|
||
string_enum! { | ||
#[derive(Clone, Copy, PartialEq, Debug)] | ||
pub enum Mode { | ||
pub enum TestMode { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How does TestMode
differ from a "test suite"? One mode maps to 1-N test suites? And a test suites is essentially just a directory within tests
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment has been minimized.
This comment has been minimized.
Oh I see where the default is used... |
I pushed a new commit which (for this PR) preserves the rustdoc-gui-test dummy It may seem rather verbose, but I really do not want to @rustbot review |
35081bb
to
6f8a7f0
Compare
Fine as a temporary solution, better than making a weird |
PR CI is 🟢 |
…, r=Kobzol [COMPILETEST-UNTANGLE 5/N] Test mode adjustments and other assorted cleanups 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 modulo the removed debugger version warning. - Commit 1: Removes a very outdated debugger version warning. - Commit 2: Moves `string_enum` out of `common` into `util` module. - Commit 3: Remove `#[derive(Default)` for `Mode` and `Config`. It is very important for correctness that we *don't* `#[derive(Default)]`, because there are no sensible defaults, so stop pretending there is. - Commit 4: Rename `Mode` -> `TestMode`, because I would like to introduce a `TestSuite` enum to stop using stringly-typed test suite names where test mode names can be the same as test suite names, and we also have a bunch of other "modes" in compiletest. Make this as unambiguous as possible. A corollary is that now it's more natural to reference via intra-doc links as ``[`TestMode`]``. - Commit 5: Ditto on `TestSuite`, stop glob-reexporting `TestMode::*` variants, and always use `EnumName::VariantName` form. - Commit 6: Apparently, `src/tools/rustdoc-gui-test/` depends on `compiletest` for `//@ {compile,run}-paths` directive parsing and extraction, which involves creating a dummy `compiletest` config (hence the existence of the default impls removed in Commit 3). Make this a specific associated function with a FIXME pointing to rust-lang#143827 as I think this setup is quite questionable. Commits {4, 5} are also intended to help improve the self-consistency in nomenclature used within compiletest. Best reviewed commit-by-commit.
Rollup of 15 pull requests Successful merges: - #143554 (slice: Mark `rotate_left`, `rotate_right` unstably const) - #143634 (interpret/allocation: expose init + write_wildcards on a range) - #143710 (Updates to random number generation APIs) - #143774 (constify `From` and `Into`) - #143776 (std: move NuttX to use arc4random for random number generation) - #143778 (Some const_trait_impl test cleanups) - #143782 (Disambiguate between rustc vs std having debug assertions in `run-make-support` and `run-make` tests) - #143791 (Update sysinfo version to `0.36.0`) - #143796 (Fix ICE for parsed attributes with longer path not handled by CheckAttribute) - #143798 (Remove format short command trait) - #143803 (New tracking issues for const_ops and const_cmp) - #143814 (htmldocck: better error messages for some negative directives) - #143817 (Access `wasi_sdk_path` instead of reading environment variable in bootstrap) - #143822 (./x test miri: fix cleaning the miri_ui directory) - #143823 ([COMPILETEST-UNTANGLE 5/N] Test mode adjustments and other assorted cleanups) r? `@ghost` `@rustbot` modify labels: rollup
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 modulo the removed debugger version warning.
string_enum
out ofcommon
intoutil
module.#[derive(Default)
forMode
andConfig
. It is very important for correctness that we don't#[derive(Default)]
, because there are no sensible defaults, so stop pretending there is.Mode
->TestMode
, because I would like to introduce aTestSuite
enum to stop using stringly-typed test suite names where test mode names can be the same as test suite names, and we also have a bunch of other "modes" in compiletest. Make this as unambiguous as possible. A corollary is that now it's more natural to reference via intra-doc links as[`TestMode`]
.TestSuite
, stop glob-reexportingTestMode::*
variants, and always useEnumName::VariantName
form.src/tools/rustdoc-gui-test/
depends oncompiletest
for//@ {compile,run}-paths
directive parsing and extraction, which involves creating a dummycompiletest
config (hence the existence of the default impls removed in Commit 3). Make this a specific associated function with a FIXME pointing tosrc/tools/rustdoc-gui-test
uses compiletest directives +TestProp
handling internals in a questionable way #143827 as I think this setup is quite questionable.Commits {4, 5} are also intended to help improve the self-consistency in nomenclature used within compiletest.
Best reviewed commit-by-commit.