Skip to content

compiletest: Remove the libtest-based executor and its dependency #140392

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

Merged
merged 1 commit into from
Apr 29, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/bootstrap/src/core/build_steps/tool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,7 @@ macro_rules! bootstrap_tool {
}
}

pub(crate) const COMPILETEST_ALLOW_FEATURES: &str = "test,internal_output_capture";
pub(crate) const COMPILETEST_ALLOW_FEATURES: &str = "internal_output_capture";

bootstrap_tool!(
// This is marked as an external tool because it includes dependencies
Expand Down
8 changes: 0 additions & 8 deletions src/tools/compiletest/src/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -413,14 +413,6 @@ pub struct Config {
/// cross-compilation scenarios that do not otherwise want/need to `-Zbuild-std`. Used in e.g.
/// ABI tests.
pub minicore_path: Utf8PathBuf,

/// If true, disable the "new" executor, and use the older libtest-based
/// executor to run tests instead. This is a temporary fallback, to make
/// manual comparative testing easier if bugs are found in the new executor.
///
/// FIXME(Zalathar): Eventually remove this flag and remove the libtest
/// dependency.
pub no_new_executor: bool,
}

impl Config {
Expand Down
1 change: 0 additions & 1 deletion src/tools/compiletest/src/executor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ use crate::common::{Config, TestPaths};

mod deadline;
mod json;
pub(crate) mod libtest;

pub(crate) fn run_tests(config: &Config, tests: Vec<CollectedTest>) -> bool {
let tests_len = tests.len();
Expand Down
111 changes: 0 additions & 111 deletions src/tools/compiletest/src/executor/libtest.rs

This file was deleted.

19 changes: 7 additions & 12 deletions src/tools/compiletest/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
#![crate_name = "compiletest"]
// Needed by the libtest-based test executor.
#![feature(test)]
// Needed by the "new" test executor that does not depend on libtest.
// FIXME(Zalathar): We should be able to get rid of `internal_output_capture`,
// by having `runtest` manually capture all of its println-like output instead.
// That would result in compiletest being written entirely in stable Rust!
#![feature(internal_output_capture)]

extern crate test;

#[cfg(test)]
mod tests;

Expand Down Expand Up @@ -448,8 +447,6 @@ pub fn parse_config(args: Vec<String>) -> Config {
diff_command: matches.opt_str("compiletest-diff-tool"),

minicore_path: opt_path(matches, "minicore-path"),

no_new_executor: matches.opt_present("no-new-executor"),
}
}

Expand Down Expand Up @@ -576,12 +573,10 @@ pub fn run_tests(config: Arc<Config>) {
// 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,
// it will return control to the rest of compiletest by calling `runtest::run`.
let res = if !config.no_new_executor {
Ok(executor::run_tests(&config, tests))
} else {
// FIXME(Zalathar): Eventually remove the libtest executor entirely.
crate::executor::libtest::execute_tests(&config, tests)
};
// FIXME(Zalathar): Once we're confident that we won't need to revert the
// removal of the libtest-based executor, remove this Result and other
// remnants of the old executor.
let res: io::Result<bool> = Ok(executor::run_tests(&config, tests));

// Check the outcome reported by libtest.
match res {
Expand Down
Loading