Re-add deprecated --execution arg on benchmark pallet (#14567)

* Add DeferGuard::new

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Re-add deprecated 'execution' arg to benchmark pallet cmd.

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Extend tests

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Remove from tests

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

---------

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
This commit is contained in:
Oliver Tale-Yazdi
2023-07-13 19:41:56 +02:00
committed by GitHub
parent c4e880c155
commit ee0be2bab7
7 changed files with 34 additions and 7 deletions
@@ -34,16 +34,20 @@ fn benchmark_pallet_works() {
}
fn benchmark_pallet(steps: u32, repeat: u32, should_work: bool) {
let output = Command::new(cargo_bin("substrate"))
let status = Command::new(cargo_bin("substrate"))
.args(["benchmark", "pallet", "--dev"])
// Use the `addition` benchmark since is the fastest.
.args(["--pallet", "frame-benchmarking", "--extrinsic", "addition"])
.args(["--steps", &format!("{}", steps), "--repeat", &format!("{}", repeat)])
.output()
.args([
"--wasm-execution=compiled",
"--no-storage-info",
"--no-median-slopes",
"--no-min-squares",
"--heap-pages=4096",
])
.status()
.unwrap();
if output.status.success() != should_work {
let log = String::from_utf8_lossy(&output.stderr).to_string();
panic!("Test failed:\n{}", log);
}
assert_eq!(status.success(), should_work);
}