diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2023-06-29 16:36:31 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-06-29 16:36:31 +0200 |
| commit | f00db43e97dc9a4138686e5fca0fdb0be0775eed (patch) | |
| tree | a143c85fcfcc7d7af6f4882abc7586ee8c80dfe7 /src/bootstrap | |
| parent | 93a97c7a2a7d6ddcc40254331ce81f2fc1fe0790 (diff) | |
| parent | 7b4e75b98965f45dd35a31968d388c7deca997a2 (diff) | |
| download | rust-f00db43e97dc9a4138686e5fca0fdb0be0775eed.tar.gz rust-f00db43e97dc9a4138686e5fca0fdb0be0775eed.zip | |
Rollup merge of #112300 - Zalathar:run-coverage, r=wesleywiser
Convert `run-make/coverage-reports` tests to use a custom compiletest mode I was frustrated by the fact that most of the coverage tests are glued together with makefiles and shell scripts, so I tried my hand at converting most of them over to a newly-implemented `run-coverage` mode/suite in compiletest. This ~~*mostly*~~ resolves #85009, ~~though I've left a small number of the existing tests as-is because they would require more work to fix/support~~. --- I had time to go back and add support for the more troublesome tests that I had initially skipped over, so this PR now manages to completely get rid of `run-make/coverage-reports`. --- The patches are arranged as follows: - Declare the new mode/suite in bootstrap - Small changes to compiletest that will be used by the new mode - Implement the new mode in compiletest - Migrate most of the tests over - Add more code to bootstrap and compiletest to support the remaining tests - Migrate the remaining tests (with some temporary hacks to avoid re-blessing them) - Remove the temporary hacks and re-bless the migrated tests - Remove the unused remnants of `run-make/coverage-reports`
Diffstat (limited to 'src/bootstrap')
| -rw-r--r-- | src/bootstrap/builder.rs | 2 | ||||
| -rw-r--r-- | src/bootstrap/test.rs | 20 |
2 files changed, 18 insertions, 4 deletions
diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs index 7c8e3536df5..a1d3453377a 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, @@ -694,6 +695,7 @@ impl<'a> Builder<'a> { test::Debuginfo, test::UiFullDeps, test::Rustdoc, + test::RunCoverageRustdoc, test::Pretty, test::Crate, test::CrateLibrustc, diff --git a/src/bootstrap/test.rs b/src/bootstrap/test.rs index ec447a1cd73..2c1f612e39f 100644 --- a/src/bootstrap/test.rs +++ b/src/bootstrap/test.rs @@ -1319,6 +1319,13 @@ 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" }); +host_test!(RunCoverageRustdoc { + path: "tests/run-coverage-rustdoc", + mode: "run-coverage", + suite: "run-coverage-rustdoc" +}); + // 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 { @@ -1503,6 +1510,7 @@ note: if you're sure you want to do this, please open an issue as to why. In the || (mode == "ui" && is_rustdoc) || mode == "js-doc-test" || mode == "rustdoc-json" + || suite == "run-coverage-rustdoc" { cmd.arg("--rustdoc-path").arg(builder.rustdoc(compiler)); } @@ -1516,7 +1524,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 +1711,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 = |
