[COMPILETEST-UNTANGLE 5/N] Test mode adjustments and other assorted cleanups#143823
[COMPILETEST-UNTANGLE 5/N] Test mode adjustments and other assorted cleanups#143823bors merged 6 commits intorust-lang:masterfrom
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.
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.
| /// 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.
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.
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.
Remark: also, I just find this quite nasty.
|
r? kobzol |
Kobzol
left a comment
There was a problem hiding this comment.
Nice little cleanup! Left one question, but it's not blocking. Feel free to r=me after CI is green.
| string_enum! { | ||
| #[derive(Clone, Copy, PartialEq, Debug)] | ||
| pub enum Mode { | ||
| pub enum TestMode { |
There was a problem hiding this comment.
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.
However, note that tests/coverage/ is a special case: it is TestSuite::Coverage, but the same test files can be run under two test modes, TestMode::{CoverageMap,CoverageRun}.
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
Rollup of 12 pull requests Successful merges: - #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) - #143841 (Label clippy changes with `T-clippy`) Failed merges: - #143850 (Compiletest: Simplify {Html,Json}DocCk directive handling) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of #143823 - jieyouxu:compiletest-maintenance-5, 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 #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 12 pull requests Successful merges: - rust-lang/rust#143776 (std: move NuttX to use arc4random for random number generation) - rust-lang/rust#143778 (Some const_trait_impl test cleanups) - rust-lang/rust#143782 (Disambiguate between rustc vs std having debug assertions in `run-make-support` and `run-make` tests) - rust-lang/rust#143791 (Update sysinfo version to `0.36.0`) - rust-lang/rust#143796 (Fix ICE for parsed attributes with longer path not handled by CheckAttribute) - rust-lang/rust#143798 (Remove format short command trait) - rust-lang/rust#143803 (New tracking issues for const_ops and const_cmp) - rust-lang/rust#143814 (htmldocck: better error messages for some negative directives) - rust-lang/rust#143817 (Access `wasi_sdk_path` instead of reading environment variable in bootstrap) - rust-lang/rust#143822 (./x test miri: fix cleaning the miri_ui directory) - rust-lang/rust#143823 ([COMPILETEST-UNTANGLE 5/N] Test mode adjustments and other assorted cleanups) - rust-lang/rust#143841 (Label clippy changes with `T-clippy`) Failed merges: - rust-lang/rust#143850 (Compiletest: Simplify {Html,Json}DocCk directive handling) r? `@ghost` `@rustbot` modify labels: rollup
This is part of a patch series to untangle
compiletestto hopefully nudge it towards being more maintainable.This PR should contain no functional changes modulo the removed debugger version warning.
string_enumout ofcommonintoutilmodule.#[derive(Default)forModeandConfig. 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 aTestSuiteenum 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::VariantNameform.src/tools/rustdoc-gui-test/depends oncompiletestfor//@ {compile,run}-pathsdirective parsing and extraction, which involves creating a dummycompiletestconfig (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-testuses compiletest directives +TestProphandling 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.