Skip to content

Commit 45352ad

Browse files
committed
Add a few more #[no_coverage] attributes
1 parent e3a5419 commit 45352ad

File tree

6 files changed

+32
-20
lines changed

6 files changed

+32
-20
lines changed

fuzzcheck/src/code_coverage_sensor/llvm_coverage.rs

Lines changed: 24 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -475,29 +475,34 @@ pub fn filter_covfun(
475475
records: Vec<RawFunctionCounters>,
476476
prf_names: HashMap<i64, String>,
477477
covmap: &CovMap,
478-
keep: impl Fn(&Path) -> bool,
478+
keep: impl Fn(&Path, &str) -> bool,
479479
) -> Vec<PartialFunctionRecord> {
480480
records
481481
.into_iter()
482-
.filter_map(|function_counters| {
483-
let filenames = &covmap[&function_counters.header.hash_translation_unit];
484-
let mut filepaths = Vec::new();
485-
for idx in function_counters.file_id_mapping.filename_indices.iter() {
486-
let filename = &filenames[*idx];
487-
let filepath = Path::new(filename).to_path_buf();
488-
if !keep(&filepath) {
489-
return None;
482+
.filter_map(
483+
#[no_coverage]
484+
|function_counters| {
485+
let name_function = prf_names[&function_counters.header.id.name_md5].clone();
486+
let name_function = rustc_demangle::demangle(&name_function).to_string();
487+
488+
let filenames = &covmap[&function_counters.header.hash_translation_unit];
489+
let mut filepaths = Vec::new();
490+
for idx in function_counters.file_id_mapping.filename_indices.iter() {
491+
let filename = &filenames[*idx];
492+
let filepath = Path::new(filename).to_path_buf();
493+
if !keep(&filepath, name_function.as_str()) {
494+
return None;
495+
}
496+
filepaths.push(filepath);
490497
}
491-
filepaths.push(filepath);
492-
}
493-
let name_function = prf_names[&function_counters.header.id.name_md5].clone();
494-
495-
Some(PartialFunctionRecord {
496-
name_function,
497-
filenames: filepaths,
498-
counters: function_counters,
499-
})
500-
})
498+
499+
Some(PartialFunctionRecord {
500+
name_function,
501+
filenames: filepaths,
502+
counters: function_counters,
503+
})
504+
},
505+
)
501506
.collect()
502507
}
503508

fuzzcheck/src/mutators/alternation.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,8 @@ where
223223
.collect()
224224
}
225225

226+
#[doc(hidden)]
227+
#[no_coverage]
226228
fn global_search_space_complexity(&self) -> f64 {
227229
self.search_space_complexity
228230
}

fuzzcheck/src/mutators/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ impl<T> CrossoverStep<T>
103103
where
104104
T: 'static,
105105
{
106+
#[no_coverage]
106107
pub fn get_next_subvalue<'a>(
107108
&mut self,
108109
subvalue_provider: &'a dyn SubValueProvider,

fuzzcheck/src/mutators/mutations/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ where
5858
Value: Clone + 'static,
5959
M: Mutator<Value>,
6060
{
61+
#[no_coverage]
6162
fn revert(self, _mutator: &M, _value: &mut Value, _cache: &mut M::Cache) {}
6263
}
6364
impl<Value, M> Mutation<Value, M> for NoMutation

fuzzcheck/src/sensors_and_pools/simplest_to_activate_counter_pool.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -634,6 +634,7 @@ impl<O> CompatibleWithObservations<O> for SimplestToActivateCounterPool
634634
where
635635
for<'a> &'a O: IntoIterator<Item = &'a (usize, u64)>,
636636
{
637+
#[no_coverage]
637638
fn process(&mut self, input_id: PoolStorageIndex, observations: &O, complexity: f64) -> Vec<CorpusDelta> {
638639
let mut state = UniqueCoveragePoolObservationState::default();
639640

fuzzcheck/src/sensors_and_pools/test_failure_pool.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,9 @@ impl SaveToStatsFolder for TestFailurePool {
144144
if #[cfg(feature = "serde_json_serializer")]
145145
{
146146
let path = PathBuf::new().join("test_failures.json");
147-
let content = serde_json::to_string(&self.inputs.iter().map(|tf| (tf.error.id, tf.error.display.clone()) ).collect::<Vec<_>>()).unwrap();
147+
let content = serde_json::to_string(&self.inputs.iter().map(
148+
#[no_coverage]
149+
|tf| (tf.error.id, tf.error.display.clone()) ).collect::<Vec<_>>()).unwrap();
148150
vec![(path, content.into_bytes())]
149151
} else {
150152
vec![]

0 commit comments

Comments
 (0)