MCPcopy Create free account
hub / github.com/bytecodealliance/wasmtime / generate_report

Function generate_report

scripts/coverage.rs:163–201  ·  view source on GitHub ↗
(llvm_cov: &Path, binaries: &[String], profdata_file: &Path, report_dir: &Path)

Source from the content-addressed store, hash-verified

161}
162
163fn generate_report(llvm_cov: &Path, binaries: &[String], profdata_file: &Path, report_dir: &Path) {
164 eprintln!("=== Generating HTML coverage report ===");
165 if report_dir.exists() {
166 fs::remove_dir_all(report_dir).expect("failed to clean report dir");
167 }
168
169 let mut cmd = Command::new(llvm_cov);
170 cmd.arg("show")
171 .arg("--format=html")
172 .arg(format!("--output-dir={}", report_dir.display()))
173 .arg("--ignore-filename-regex=/.cargo/registry")
174 .arg("--ignore-filename-regex=/rustc/")
175 .arg("--ignore-filename-regex=/.rustup/")
176 .arg(format!("--instr-profile={}", profdata_file.display()))
177 .arg("--show-line-counts-or-regions")
178 .arg("--show-instantiations")
179 .arg("--show-region-summary")
180 .arg("--show-branch-summary");
181
182 cmd.arg(&binaries[0]);
183 for b in &binaries[1..] {
184 cmd.arg("--object").arg(b);
185 }
186
187 if has_command("rustfilt") {
188 cmd.arg("-Xdemangler=rustfilt");
189 }
190
191 let status = cmd.status().expect("failed to run llvm-cov");
192 if !status.success() {
193 eprintln!("llvm-cov show failed with {status}");
194 std::process::exit(1);
195 }
196
197 eprintln!(
198 "=== Coverage report written to {}/index.html ===",
199 report_dir.display()
200 );
201}
202
203fn find_repo_root() -> PathBuf {
204 let mut dir = env::current_dir().expect("failed to get cwd");

Callers 1

mainFunction · 0.85

Calls 7

has_commandFunction · 0.85
existsMethod · 0.80
statusMethod · 0.80
newFunction · 0.50
expectMethod · 0.45
argMethod · 0.45
successMethod · 0.45

Tested by

no test coverage detected