Allow Skipping Benchmark Errors (#9699)

* introduce benchmark skip

* fmt

* Update lib.rs

* fix up
This commit is contained in:
Shawn Tabrizi
2021-09-06 19:25:20 -04:00
committed by GitHub
parent 522e77e243
commit 5d78dbf27f
2 changed files with 58 additions and 17 deletions
+7 -4
View File
@@ -119,14 +119,16 @@ impl BenchmarkResult {
}
/// Possible errors returned from the benchmarking pipeline.
///
/// * Stop: The benchmarking pipeline should stop and return the inner string.
/// * WeightOverride: The benchmarking pipeline is allowed to fail here, and we should use the
/// included weight instead.
#[derive(Clone, PartialEq, Debug)]
pub enum BenchmarkError {
/// The benchmarking pipeline should stop and return the inner string.
Stop(&'static str),
/// The benchmarking pipeline is allowed to fail here, and we should use the
/// included weight instead.
Override(BenchmarkResult),
/// The benchmarking pipeline is allowed to fail here, and we should simply
/// skip processing these results.
Skip,
}
impl From<BenchmarkError> for &'static str {
@@ -134,6 +136,7 @@ impl From<BenchmarkError> for &'static str {
match e {
BenchmarkError::Stop(s) => s,
BenchmarkError::Override(_) => "benchmark override",
BenchmarkError::Skip => "benchmark skip",
}
}
}