Auto merge of #140288 - Zalathar:new-executor, r=jieyouxu

compiletest: Re-land using the new non-libtest executor by default

This PR re-lands #139998, which had the misfortune of triggering download-rustc in its CI jobs, so we didn't get proper test metrics for comparison with the old implementation. So that was PR was reverted in #140233, with the intention of re-landing it alongside a dummy compiler change to inhibit download-rustc.

---

Original PR description for #139998:
>The new executor was implemented in #139660, but required a manual opt-in. This PR activates the new executor by default, but leaves the old libtest-based executor in place (temporarily) to make reverting easier if something unexpectedly goes horribly wrong.
>
>Currently the new executor can be explicitly disabled by passing the `-N` flag to compiletest (e.g. `./x test ui -- -N`), but eventually that flag will be removed, alongside the removal of the libtest dependency. The flag is mostly there to make manual comparative testing easier if something does go wrong.
>
>As before, there *should* be no user-visible difference between the old executor and the new executor.

---
r? jieyouxu
This commit is contained in:
bors 2025-04-26 22:33:56 +00:00
commit 43e62a789c
3 changed files with 12 additions and 8 deletions

View File

@ -89,7 +89,7 @@ fn instrument_function_for_coverage<'tcx>(tcx: TyCtxt<'tcx>, mir_body: &mut mir:
// Use the coverage graph to prepare intermediate data that will eventually // Use the coverage graph to prepare intermediate data that will eventually
// be used to assign physical counters and counter expressions to points in // be used to assign physical counters and counter expressions to points in
// the control-flow graph // the control-flow graph.
let BcbCountersData { node_flow_data, priority_list } = let BcbCountersData { node_flow_data, priority_list } =
counters::prepare_bcb_counters_data(&graph); counters::prepare_bcb_counters_data(&graph);

View File

@ -414,10 +414,13 @@ pub struct Config {
/// ABI tests. /// ABI tests.
pub minicore_path: Utf8PathBuf, pub minicore_path: Utf8PathBuf,
/// If true, run tests with the "new" executor that was written to replace /// If true, disable the "new" executor, and use the older libtest-based
/// compiletest's dependency on libtest. Eventually this will become the /// executor to run tests instead. This is a temporary fallback, to make
/// default, and the libtest dependency will be removed. /// manual comparative testing easier if bugs are found in the new executor.
pub new_executor: bool, ///
/// FIXME(Zalathar): Eventually remove this flag and remove the libtest
/// dependency.
pub no_new_executor: bool,
} }
impl Config { impl Config {

View File

@ -203,7 +203,7 @@ pub fn parse_config(args: Vec<String>) -> Config {
"COMMAND", "COMMAND",
) )
.reqopt("", "minicore-path", "path to minicore aux library", "PATH") .reqopt("", "minicore-path", "path to minicore aux library", "PATH")
.optflag("n", "new-executor", "enables the new test executor instead of using libtest") .optflag("N", "no-new-executor", "disables the new test executor, and uses libtest instead")
.optopt( .optopt(
"", "",
"debugger", "debugger",
@ -449,7 +449,7 @@ pub fn parse_config(args: Vec<String>) -> Config {
minicore_path: opt_path(matches, "minicore-path"), minicore_path: opt_path(matches, "minicore-path"),
new_executor: matches.opt_present("new-executor"), no_new_executor: matches.opt_present("no-new-executor"),
} }
} }
@ -576,9 +576,10 @@ pub fn run_tests(config: Arc<Config>) {
// Delegate to the executor to filter and run the big list of test structures // Delegate to the executor to filter and run the big list of test structures
// created during test discovery. When the executor decides to run a test, // created during test discovery. When the executor decides to run a test,
// it will return control to the rest of compiletest by calling `runtest::run`. // it will return control to the rest of compiletest by calling `runtest::run`.
let res = if config.new_executor { let res = if !config.no_new_executor {
Ok(executor::run_tests(&config, tests)) Ok(executor::run_tests(&config, tests))
} else { } else {
// FIXME(Zalathar): Eventually remove the libtest executor entirely.
crate::executor::libtest::execute_tests(&config, tests) crate::executor::libtest::execute_tests(&config, tests)
}; };