Skip to content

Commit

Permalink
add BenchmarkError::Weightless (#873)
Browse files Browse the repository at this point in the history
* add BenchmarkError::Weightless

* Update benchmarking/src/lib.rs

Co-authored-by: zjb0807 <[email protected]>

Co-authored-by: zjb0807 <[email protected]>
  • Loading branch information
insipx and zjb0807 authored Jan 16, 2023
1 parent ddbb6be commit 0811818
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions benchmarking/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1180,6 +1180,14 @@ macro_rules! impl_benchmark_test_suite {
$crate::str::from_utf8(benchmark_name)
.expect("benchmark name is always a valid string!"),
);
},
$crate::BenchmarkError::Weightless => {
// This is considered a success condition.
$crate::log::error!(
"WARNING: benchmark error weightless skipped - {}",
$crate::str::from_utf8(benchmark_name)
.expect("benchmark name is always a valid string!"),
);
}
}
},
Expand Down Expand Up @@ -1314,6 +1322,17 @@ macro_rules! add_benchmark {
.expect("benchmark name is always a valid string!")
);
None
},
Err($crate::BenchmarkError::Weightless) => {
$crate::log::error!(
"WARNING: benchmark weightless skipped - {}",
$crate::str::from_utf8(benchmark)
.expect("benchmark name is always a valid string!")
);
Some(vec![$crate::BenchmarkResult {
components: selected_components.clone(),
.. Default::default()
}])
}
};

Expand Down

0 comments on commit 0811818

Please sign in to comment.