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) {
|
match prng.sample(&self.fuzzer.program) {
|
||||||
Ok(Some((new_prng, value))) => {
|
Ok(Some((new_prng, value))) => {
|
||||||
prng = new_prng;
|
prng = new_prng;
|
||||||
let mut eval_result = self.eval(&value, plutus_version);
|
match self.eval(&value, plutus_version) {
|
||||||
|
mut eval_result => {
|
||||||
results.push(BenchmarkResult {
|
results.push(BenchmarkResult {
|
||||||
test: self.clone(),
|
test: self.clone(),
|
||||||
cost: eval_result.cost(),
|
cost: eval_result.cost(),
|
||||||
success: !eval_result.failed(false),
|
success: true,
|
||||||
traces: eval_result.logs().to_vec(),
|
traces: eval_result.logs().to_vec(),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
Ok(None) => {}
|
}
|
||||||
Err(_) => break,
|
}
|
||||||
|
Ok(None) => {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
Err(e) => {
|
||||||
|
results.push(BenchmarkResult {
|
||||||
|
test: self.clone(),
|
||||||
|
cost: ExBudget::default(),
|
||||||
|
success: false,
|
||||||
|
traces: vec![format!("Fuzzer error: {}", e)],
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
remaining -= 1;
|
remaining -= 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -477,22 +477,11 @@ where
|
||||||
let tests = self.collect_tests(false, match_tests, exact_match, options.tracing)?;
|
let tests = self.collect_tests(false, match_tests, exact_match, options.tracing)?;
|
||||||
|
|
||||||
if !tests.is_empty() {
|
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);
|
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
|
let errors: Vec<Error> = tests
|
||||||
.iter()
|
.iter()
|
||||||
.filter_map(|e| {
|
.filter_map(|e| {
|
||||||
|
|
|
@ -8,7 +8,7 @@ use std::{
|
||||||
};
|
};
|
||||||
|
|
||||||
#[derive(clap::Args)]
|
#[derive(clap::Args)]
|
||||||
/// Type-check an Aiken project
|
/// Benchmark an Aiken project
|
||||||
pub struct Args {
|
pub struct Args {
|
||||||
/// Path to project
|
/// Path to project
|
||||||
directory: Option<PathBuf>,
|
directory: Option<PathBuf>,
|
||||||
|
@ -33,7 +33,6 @@ pub struct Args {
|
||||||
exact_match: bool,
|
exact_match: bool,
|
||||||
|
|
||||||
/// Environment to use for benchmarking
|
/// Environment to use for benchmarking
|
||||||
#[clap(short, long)]
|
|
||||||
env: Option<String>,
|
env: Option<String>,
|
||||||
|
|
||||||
/// Output file for benchmark results
|
/// Output file for benchmark results
|
||||||
|
|
Loading…
Reference in New Issue