From f03074da23c4b3e4e8ffcff3408151929a583fdf Mon Sep 17 00:00:00 2001 From: Jieyou Xu Date: Mon, 30 Jun 2025 15:09:03 +0800 Subject: Move compiletest `main.rs` to `src/bin/` To make it obvious `compiletest`-the-tool has two components: 1. The core compiletest library, and 2. The tool binary, which will be executed by bootstrap. --- src/tools/compiletest/Cargo.toml | 4 ++++ src/tools/compiletest/src/bin/main.rs | 24 ++++++++++++++++++++++++ src/tools/compiletest/src/main.rs | 24 ------------------------ 3 files changed, 28 insertions(+), 24 deletions(-) create mode 100644 src/tools/compiletest/src/bin/main.rs delete mode 100644 src/tools/compiletest/src/main.rs (limited to 'src/tools/compiletest') diff --git a/src/tools/compiletest/Cargo.toml b/src/tools/compiletest/Cargo.toml index 3b544d8b828..cdada5a2230 100644 --- a/src/tools/compiletest/Cargo.toml +++ b/src/tools/compiletest/Cargo.toml @@ -6,6 +6,10 @@ edition = "2024" [lib] doctest = false +[[bin]] +name = "compiletest" +path = "src/bin/main.rs" + [dependencies] # tidy-alphabetical-start anstyle-svg = "0.1.3" diff --git a/src/tools/compiletest/src/bin/main.rs b/src/tools/compiletest/src/bin/main.rs new file mode 100644 index 00000000000..1f777e71cf9 --- /dev/null +++ b/src/tools/compiletest/src/bin/main.rs @@ -0,0 +1,24 @@ +use std::env; +use std::io::IsTerminal; +use std::sync::Arc; + +use compiletest::{early_config_check, log_config, parse_config, run_tests}; + +fn main() { + tracing_subscriber::fmt::init(); + + // colored checks stdout by default, but for some reason only stderr is a terminal. + // compiletest *does* print many things to stdout, but it doesn't really matter. + if std::io::stderr().is_terminal() + && matches!(std::env::var("NO_COLOR").as_deref(), Err(_) | Ok("0")) + { + colored::control::set_override(true); + } + + let config = Arc::new(parse_config(env::args().collect())); + + early_config_check(&config); + + log_config(&config); + run_tests(config); +} diff --git a/src/tools/compiletest/src/main.rs b/src/tools/compiletest/src/main.rs deleted file mode 100644 index 1f777e71cf9..00000000000 --- a/src/tools/compiletest/src/main.rs +++ /dev/null @@ -1,24 +0,0 @@ -use std::env; -use std::io::IsTerminal; -use std::sync::Arc; - -use compiletest::{early_config_check, log_config, parse_config, run_tests}; - -fn main() { - tracing_subscriber::fmt::init(); - - // colored checks stdout by default, but for some reason only stderr is a terminal. - // compiletest *does* print many things to stdout, but it doesn't really matter. - if std::io::stderr().is_terminal() - && matches!(std::env::var("NO_COLOR").as_deref(), Err(_) | Ok("0")) - { - colored::control::set_override(true); - } - - let config = Arc::new(parse_config(env::args().collect())); - - early_config_check(&config); - - log_config(&config); - run_tests(config); -} -- cgit 1.4.1-3-g733a5