Fixed basic benchmarking functionality
This commit is contained in:
parent
8764d37d76
commit
f55419e8fb
|
@ -450,16 +450,29 @@ impl PropertyTest {
|
|||
match prng.sample(&self.fuzzer.program) {
|
||||
Ok(Some((new_prng, value))) => {
|
||||
prng = new_prng;
|
||||
let mut eval_result = self.eval(&value, plutus_version);
|
||||
match self.eval(&value, plutus_version) {
|
||||
mut eval_result => {
|
||||
results.push(BenchmarkResult {
|
||||
test: self.clone(),
|
||||
cost: eval_result.cost(),
|
||||
success: true,
|
||||
traces: eval_result.logs().to_vec(),
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
Ok(None) => {
|
||||
break;
|
||||
}
|
||||
Err(e) => {
|
||||
results.push(BenchmarkResult {
|
||||
test: self.clone(),
|
||||
cost: eval_result.cost(),
|
||||
success: !eval_result.failed(false),
|
||||
traces: eval_result.logs().to_vec(),
|
||||
cost: ExBudget::default(),
|
||||
success: false,
|
||||
traces: vec![format!("Fuzzer error: {}", e)],
|
||||
});
|
||||
break;
|
||||
}
|
||||
Ok(None) => {}
|
||||
Err(_) => break,
|
||||
}
|
||||
remaining -= 1;
|
||||
}
|
||||
|
|
|
@ -477,22 +477,11 @@ where
|
|||
let tests = self.collect_tests(false, match_tests, exact_match, options.tracing)?;
|
||||
|
||||
if !tests.is_empty() {
|
||||
self.event_listener.handle_event(Event::RunningTests);
|
||||
self.event_listener.handle_event(Event::RunningBenchmarks);
|
||||
}
|
||||
|
||||
let tests = self.run_benchmarks(tests, seed, property_max_success);
|
||||
|
||||
self.checks_count = if tests.is_empty() {
|
||||
None
|
||||
} else {
|
||||
Some(tests.iter().fold(0, |acc, test| {
|
||||
acc + match test {
|
||||
TestResult::PropertyTestResult(r) => r.iterations,
|
||||
_ => 1,
|
||||
}
|
||||
}))
|
||||
};
|
||||
|
||||
let errors: Vec<Error> = tests
|
||||
.iter()
|
||||
.filter_map(|e| {
|
||||
|
|
|
@ -8,7 +8,7 @@ use std::{
|
|||
};
|
||||
|
||||
#[derive(clap::Args)]
|
||||
/// Type-check an Aiken project
|
||||
/// Benchmark an Aiken project
|
||||
pub struct Args {
|
||||
/// Path to project
|
||||
directory: Option<PathBuf>,
|
||||
|
@ -33,7 +33,6 @@ pub struct Args {
|
|||
exact_match: bool,
|
||||
|
||||
/// Environment to use for benchmarking
|
||||
#[clap(short, long)]
|
||||
env: Option<String>,
|
||||
|
||||
/// Output file for benchmark results
|
||||
|
|
Loading…
Reference in New Issue