From d8d09b06815b14badfa9940f7bfc2a3ff5698ac6 Mon Sep 17 00:00:00 2001 From: Zalathar Date: Mon, 12 Jun 2023 18:07:04 +1000 Subject: [PATCH] Declare a `run-coverage` test mode/suite in bootstrap --- src/bootstrap/builder.rs | 1 + src/bootstrap/test.rs | 14 ++++++++++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs index 7c8e3536df5..77d59452ffc 100644 --- a/src/bootstrap/builder.rs +++ b/src/bootstrap/builder.rs @@ -686,6 +686,7 @@ macro_rules! describe { test::Tidy, test::Ui, test::RunPassValgrind, + test::RunCoverage, test::MirOpt, test::Codegen, test::CodegenUnits, diff --git a/src/bootstrap/test.rs b/src/bootstrap/test.rs index ec447a1cd73..398895d16fa 100644 --- a/src/bootstrap/test.rs +++ b/src/bootstrap/test.rs @@ -1319,6 +1319,8 @@ fn run(self, builder: &Builder<'_>) { default_test!(Assembly { path: "tests/assembly", mode: "assembly", suite: "assembly" }); +host_test!(RunCoverage { path: "tests/run-coverage", mode: "run-coverage", suite: "run-coverage" }); + // For the mir-opt suite we do not use macros, as we need custom behavior when blessing. #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] pub struct MirOpt { @@ -1516,7 +1518,7 @@ fn run(self, builder: &Builder<'_>) { .arg(builder.ensure(tool::JsonDocLint { compiler: json_compiler, target })); } - if mode == "run-make" { + if mode == "run-make" || mode == "run-coverage" { let rust_demangler = builder .ensure(tool::RustDemangler { compiler, @@ -1703,17 +1705,21 @@ fn run(self, builder: &Builder<'_>) { add_link_lib_path(vec![llvm_libdir.trim().into()], &mut cmd); } - // Only pass correct values for these flags for the `run-make` suite as it - // requires that a C++ compiler was configured which isn't always the case. - if !builder.config.dry_run() && matches!(suite, "run-make" | "run-make-fulldeps") { + if !builder.config.dry_run() + && (matches!(suite, "run-make" | "run-make-fulldeps") || mode == "run-coverage") + { // The llvm/bin directory contains many useful cross-platform // tools. Pass the path to run-make tests so they can use them. + // (The run-coverage tests also need these tools to process + // coverage reports.) let llvm_bin_path = llvm_config .parent() .expect("Expected llvm-config to be contained in directory"); assert!(llvm_bin_path.is_dir()); cmd.arg("--llvm-bin-dir").arg(llvm_bin_path); + } + if !builder.config.dry_run() && matches!(suite, "run-make" | "run-make-fulldeps") { // If LLD is available, add it to the PATH if builder.config.lld_enabled { let lld_install_root =