From a6f8b8a2116f0ea7e31d572d3120508678ed8079 Mon Sep 17 00:00:00 2001 From: Rich Kadel Date: Thu, 2 Jul 2020 11:27:15 -0700 Subject: Generating the coverage map rustc now generates the coverage map and can support (limited) coverage report generation, at the function level. Example: $ BUILD=$HOME/rust/build/x86_64-unknown-linux-gnu $ $BUILD/stage1/bin/rustc -Zinstrument-coverage \ $HOME/rust/src/test/run-make-fulldeps/instrument-coverage/main.rs $ LLVM_PROFILE_FILE="main.profraw" ./main called $ $BUILD/llvm/bin/llvm-profdata merge -sparse main.profraw -o main.profdata $ $BUILD/llvm/bin/llvm-cov show --instr-profile=main.profdata main 1| 1|pub fn will_be_called() { 2| 1| println!("called"); 3| 1|} 4| | 5| 0|pub fn will_not_be_called() { 6| 0| println!("should not have been called"); 7| 0|} 8| | 9| 1|fn main() { 10| 1| let less = 1; 11| 1| let more = 100; 12| 1| 13| 1| if less < more { 14| 1| will_be_called(); 15| 1| } else { 16| 1| will_not_be_called(); 17| 1| } 18| 1|} --- src/bootstrap/builder.rs | 1 + src/bootstrap/test.rs | 4 ++++ src/bootstrap/tool.rs | 1 + 3 files changed, 6 insertions(+) (limited to 'src/bootstrap') diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs index f6060ac14e7..128e8dd6ba8 100644 --- a/src/bootstrap/builder.rs +++ b/src/bootstrap/builder.rs @@ -369,6 +369,7 @@ impl<'a> Builder<'a> { tool::Cargo, tool::Rls, tool::RustAnalyzer, + tool::RustDemangler, tool::Rustdoc, tool::Clippy, tool::CargoClippy, diff --git a/src/bootstrap/test.rs b/src/bootstrap/test.rs index 1916d96bed7..a5f5a2f9950 100644 --- a/src/bootstrap/test.rs +++ b/src/bootstrap/test.rs @@ -1019,6 +1019,10 @@ impl Step for Compiletest { cmd.arg("--rustdoc-path").arg(builder.rustdoc(compiler)); } + if mode == "run-make" && suite.ends_with("fulldeps") { + cmd.arg("--rust-demangler-path").arg(builder.tool_exe(Tool::RustDemangler)); + } + cmd.arg("--src-base").arg(builder.src.join("src/test").join(suite)); cmd.arg("--build-base").arg(testdir(builder, compiler.host).join(suite)); cmd.arg("--stage-id").arg(format!("stage{}-{}", compiler.stage, target)); diff --git a/src/bootstrap/tool.rs b/src/bootstrap/tool.rs index 450b534d5df..233b15b40c7 100644 --- a/src/bootstrap/tool.rs +++ b/src/bootstrap/tool.rs @@ -361,6 +361,7 @@ bootstrap_tool!( Compiletest, "src/tools/compiletest", "compiletest", is_unstable_tool = true; BuildManifest, "src/tools/build-manifest", "build-manifest"; RemoteTestClient, "src/tools/remote-test-client", "remote-test-client"; + RustDemangler, "src/tools/rust-demangler", "rust-demangler"; RustInstaller, "src/tools/rust-installer", "fabricate", is_external_tool = true; RustdocTheme, "src/tools/rustdoc-themes", "rustdoc-themes"; ExpandYamlAnchors, "src/tools/expand-yaml-anchors", "expand-yaml-anchors"; -- cgit 1.4.1-3-g733a5