about summary refs log tree commit diff
path: root/src/bootstrap
diff options
context:
space:
mode:
authorZalathar <Zalathar@users.noreply.github.com>2023-06-12 18:07:04 +1000
committerZalathar <Zalathar@users.noreply.github.com>2023-06-28 11:08:09 +1000
commitd8d09b06815b14badfa9940f7bfc2a3ff5698ac6 (patch)
tree70e311f3bd0d633fa5338e4fc9ee648128d8b0f4 /src/bootstrap
parent6b46c996e1d3a07dd73beb2873d74a8a0458d05f (diff)
downloadrust-d8d09b06815b14badfa9940f7bfc2a3ff5698ac6.tar.gz
rust-d8d09b06815b14badfa9940f7bfc2a3ff5698ac6.zip
Declare a `run-coverage` test mode/suite in bootstrap
Diffstat (limited to 'src/bootstrap')
-rw-r--r--src/bootstrap/builder.rs1
-rw-r--r--src/bootstrap/test.rs14
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 @@ impl<'a> Builder<'a> {
                 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 @@ host_test!(RunMakeFullDeps {
 
 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 @@ note: if you're sure you want to do this, please open an issue as to why. In the
                 .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 @@ note: if you're sure you want to do this, please open an issue as to why. In the
                 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 =