Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ pub fn consumer(
guess_directory: bool,
binary_path: Option<&Path>,
ignore_parsing_error: bool,
num_threads: usize,
) {
let mut gcov_type = GcovType::Unknown;

Expand Down Expand Up @@ -290,6 +291,7 @@ pub fn consumer(
profraw_paths.as_slice(),
binary_path.as_ref().unwrap(),
working_dir,
num_threads,
) {
Ok(lcovs) => {
let mut new_results: Vec<(String, CovResult)> = Vec::new();
Expand Down
10 changes: 9 additions & 1 deletion src/llvm_tools.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,16 +81,20 @@ pub fn llvm_profiles_to_lcov(
profile_paths: &[PathBuf],
binary_path: &Path,
working_dir: &Path,
num_threads: usize,
) -> Result<Vec<Vec<u8>>, String> {
let profdata_path = working_dir.join("grcov.profdata");

let num_threads = num_threads.to_string();
let args = vec![
"merge".as_ref(),
"-f".as_ref(),
"-".as_ref(),
"-sparse".as_ref(),
"-o".as_ref(),
profdata_path.as_ref(),
"--num-threads".as_ref(),
num_threads.as_ref(),
];

let stdin_paths: String = profile_paths.iter().fold("".into(), |mut a, x| {
Expand Down Expand Up @@ -301,6 +305,7 @@ mod tests {
&[tmp_path.join("default.profraw")],
&PathBuf::from("src"), // There is no binary file in src
tmp_path,
1,
);
assert!(lcovs.is_ok());
let lcovs = lcovs.unwrap();
Expand All @@ -317,6 +322,7 @@ mod tests {
&[tmp_path.join("default.profraw")],
&tmp_path.join(binary_path),
tmp_path,
1,
);
assert!(lcovs.is_ok(), "Error: {}", lcovs.unwrap_err());
let lcovs = lcovs.unwrap();
Expand Down Expand Up @@ -349,7 +355,8 @@ mod tests {

assert_eq!(status.unwrap().code().unwrap(), 0);

let lcovs = llvm_profiles_to_lcov(&[profdata_path], &tmp_path.join(binary_path), tmp_path);
let lcovs =
llvm_profiles_to_lcov(&[profdata_path], &tmp_path.join(binary_path), tmp_path, 1);

assert!(lcovs.is_ok(), "Error: {}", lcovs.unwrap_err());
let lcovs = lcovs.unwrap();
Expand Down Expand Up @@ -396,6 +403,7 @@ mod tests {
&[path_with, path_without],
&tmp_path.join(bin_path),
tmp_path,
1,
);

assert!(lcovs.is_ok(), "Error: {}", lcovs.unwrap_err());
Expand Down
1 change: 1 addition & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -465,6 +465,7 @@ fn main() {
guess_directory,
binary_path.as_deref(),
ignore_parsing_error,
num_threads,
);
})
.unwrap();
Expand Down
Loading