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

Function merge_profraw

scripts/coverage.rs:127–161  ·  view source on GitHub ↗
(llvm_profdata: &Path, profraw_dir: &Path, profdata_file: &Path)

Source from the content-addressed store, hash-verified

125}
126
127fn merge_profraw(llvm_profdata: &Path, profraw_dir: &Path, profdata_file: &Path) {
128 eprintln!("=== Merging profraw files ===");
129 let profraw_files: Vec<_> = fs::read_dir(profraw_dir)
130 .expect("failed to read profraw dir")
131 .filter_map(|e| {
132 let path = e.ok()?.path();
133 if path.extension().is_some_and(|ext| ext == "profraw") {
134 Some(path)
135 } else {
136 None
137 }
138 })
139 .collect();
140
141 if profraw_files.is_empty() {
142 eprintln!(
143 "error: no .profraw files found in {}",
144 profraw_dir.display()
145 );
146 std::process::exit(1);
147 }
148 eprintln!(" merging {} profraw files", profraw_files.len());
149
150 let mut cmd = Command::new(llvm_profdata);
151 cmd.arg("merge").arg("-sparse");
152 for f in &profraw_files {
153 cmd.arg(f);
154 }
155 cmd.arg("-o").arg(profdata_file);
156 let status = cmd.status().expect("failed to run llvm-profdata");
157 if !status.success() {
158 eprintln!("llvm-profdata merge failed with {status}");
159 std::process::exit(1);
160 }
161}
162
163fn generate_report(llvm_cov: &Path, binaries: &[String], profdata_file: &Path, report_dir: &Path) {
164 eprintln!("=== Generating HTML coverage report ===");

Callers 1

mainFunction · 0.85

Calls 10

read_dirFunction · 0.85
collectMethod · 0.80
statusMethod · 0.80
newFunction · 0.50
expectMethod · 0.45
pathMethod · 0.45
okMethod · 0.45
is_emptyMethod · 0.45
argMethod · 0.45
successMethod · 0.45

Tested by

no test coverage detected