Move some early config checks to the compiletest lib

This commit is contained in:
Jieyou Xu 2025-06-30 15:03:17 +08:00
parent f19142044f
commit c8cef5bfaa
No known key found for this signature in database
GPG key ID: 045B995028EA6AFC
2 changed files with 17 additions and 14 deletions

View file

@ -1111,3 +1111,18 @@ fn check_for_overlapping_test_paths(found_path_stems: &HashSet<Utf8PathBuf>) {
);
}
}
pub fn early_config_check(config: &Config) {
if !config.has_html_tidy && config.mode == Mode::Rustdoc {
eprintln!("warning: `tidy` (html-tidy.org) is not installed; diffs will not be generated");
}
if !config.profiler_runtime && config.mode == Mode::CoverageRun {
let actioned = if config.bless { "blessed" } else { "checked" };
eprintln!(
r#"
WARNING: profiler runtime is not available, so `.coverage` files won't be {actioned}
help: try setting `profiler = true` in the `[build]` section of `bootstrap.toml`"#
);
}
}

View file

@ -2,8 +2,7 @@ use std::env;
use std::io::IsTerminal;
use std::sync::Arc;
use compiletest::common::Mode;
use compiletest::{log_config, parse_config, run_tests};
use compiletest::{early_config_check, log_config, parse_config, run_tests};
fn main() {
tracing_subscriber::fmt::init();
@ -18,18 +17,7 @@ fn main() {
let config = Arc::new(parse_config(env::args().collect()));
if !config.has_html_tidy && config.mode == Mode::Rustdoc {
eprintln!("warning: `tidy` (html-tidy.org) is not installed; diffs will not be generated");
}
if !config.profiler_runtime && config.mode == Mode::CoverageRun {
let actioned = if config.bless { "blessed" } else { "checked" };
eprintln!(
r#"
WARNING: profiler runtime is not available, so `.coverage` files won't be {actioned}
help: try setting `profiler = true` in the `[build]` section of `bootstrap.toml`"#
);
}
early_config_check(&config);
log_config(&config);
run_tests(config);