Skip to content

Commit

Permalink
Refactor blaze_supports_procmap_query() slightly
Browse files Browse the repository at this point in the history
The recently introduced blaze_supports_procmap_query() function is
reporting low coverage numbers, because we can't test error reporting of
the PROCMAP_QUERY ioctl easily. Refactor it so that pretty much all
lines are unconditionally executed.

Signed-off-by: Daniel Müller <[email protected]>
  • Loading branch information
d-e-s-o committed Aug 14, 2024
1 parent 3e15b94 commit 5b9eecb
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions capi/src/helper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,13 @@ use crate::set_last_err;
/// this error.
#[no_mangle]
pub extern "C" fn blaze_supports_procmap_query() -> bool {
match is_procmap_query_supported() {
Ok(supported) => {
let () = set_last_err(blaze_err::BLAZE_ERR_OK);
supported
}
Err(err) => {
let () = set_last_err(err.kind().into());
false
}
}
let result = is_procmap_query_supported();
let err = result
.as_ref()
.map(|_| blaze_err::BLAZE_ERR_OK)
.unwrap_or_else(|err| err.kind().into());
let () = set_last_err(err);
result.unwrap_or(false)
}


Expand Down

0 comments on commit 5b9eecb

Please sign in to comment.