Skip to content

Commit

Permalink
Declare a run-coverage test mode/suite in bootstrap
Browse files Browse the repository at this point in the history
  • Loading branch information
Zalathar committed Jun 28, 2023
1 parent 6b46c99 commit d8d09b0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/bootstrap/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -686,6 +686,7 @@ impl<'a> Builder<'a> {
test::Tidy,
test::Ui,
test::RunPassValgrind,
test::RunCoverage,
test::MirOpt,
test::Codegen,
test::CodegenUnits,
Expand Down
14 changes: 10 additions & 4 deletions src/bootstrap/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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 =
Expand Down

0 comments on commit d8d09b0

Please sign in to comment.