Update benchmark tests with filtering
This commit is contained in:
+9
-3
@@ -77,7 +77,7 @@ pub fn run_functional_tests_with_optimization(enabled: bool) -> Vec<TestResult>
|
||||
results
|
||||
}
|
||||
|
||||
pub fn run_benchmarks(update: bool) -> Vec<BenchmarkResult> {
|
||||
pub fn run_benchmarks(update: bool, filter: Option<&str>) -> Vec<BenchmarkResult> {
|
||||
let mut results = Vec::new();
|
||||
let entries = fs::read_dir("examples").unwrap();
|
||||
let is_release = !cfg!(debug_assertions);
|
||||
@@ -90,8 +90,14 @@ pub fn run_benchmarks(update: bool) -> Vec<BenchmarkResult> {
|
||||
continue;
|
||||
}
|
||||
|
||||
let content = fs::read_to_string(&path).unwrap();
|
||||
let name = path.file_name().unwrap().to_string_lossy().to_string();
|
||||
if let Some(f) = filter
|
||||
&& name != f
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
let content = fs::read_to_string(&path).unwrap();
|
||||
|
||||
let baseline_match = baseline_re.captures(&content);
|
||||
let repeat_match = repeat_re.captures(&content);
|
||||
@@ -311,7 +317,7 @@ mod tests {
|
||||
#[cfg(not(debug_assertions))]
|
||||
fn benchmark_regression_test() {
|
||||
use super::*;
|
||||
let results = run_benchmarks(false);
|
||||
let results = run_benchmarks(false, None);
|
||||
let failures: Vec<_> = results.iter().filter(|r| r.status == "FAILED").collect();
|
||||
|
||||
if !failures.is_empty() {
|
||||
|
||||
Reference in New Issue
Block a user