diff options
Diffstat (limited to 'subplot/benchmark.rs')
-rw-r--r-- | subplot/benchmark.rs | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/subplot/benchmark.rs b/subplot/benchmark.rs index 566ce30..082e02b 100644 --- a/subplot/benchmark.rs +++ b/subplot/benchmark.rs @@ -72,3 +72,20 @@ fn read_json_file(filename: &Path) -> anyhow::Result<Value> { let file = File::open(filename)?; Ok(serde_json::from_reader(&file)?) } + +#[step] +#[context(Datadir)] +#[context(SubplotContext)] +fn file_is_at_least_this_long(context: &ScenarioContext, filename: &str, number: u64) { + context.with( + |context: &Datadir| { + let filename = context.canonicalise_filename(&filename)?; + let meta = std::fs::metadata(&filename)?; + if meta.len() < number { + panic!("file is {} bytes, wanted at least {} bytes", meta.len(), number); + } + Ok(()) + }, + false, + )?; +} |