Test each benchmark case in own #[test] (#9860)

* Generate one #[test] fn per bench case.

* Update benchmark macro syntax in frame pallets.

* Explain new benchmark macro syntax in example pallet.

* support with and without a semicolon

* update pallets to use individual tests

* migrate staking too

* migrate more pallets

* fix up democracy and use individual tests

* Fix comment

* Put println message in panic

* Remove `another_set_dummy` from doc

`another_set_dummy` is not present in the benchmarking.rs (anymore).

* Update doc for benchmarks macro

* Update doc for impl_benchmark_test_suite macro

Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>
This commit is contained in:
ucover
2021-10-01 10:17:26 +02:00
committed by GitHub
parent a31ab1fc37
commit f8ce186496
39 changed files with 499 additions and 173 deletions
@@ -24,7 +24,7 @@ mod mock;
use sp_std::{prelude::*, vec};
use frame_benchmarking::{benchmarks, impl_benchmark_test_suite};
use frame_benchmarking::benchmarks;
use frame_support::{
codec::Decode,
traits::{KeyOwnerProofSystem, OnInitialize},
@@ -115,6 +115,8 @@ benchmarks! {
verify {
assert!(Historical::<T>::check_proof(key, key_owner_proof2).is_some());
}
impl_benchmark_test_suite!(Pallet, crate::mock::new_test_ext(), crate::mock::Test, extra = false);
}
/// Sets up the benchmark for checking a membership proof. It creates the given
@@ -161,5 +163,3 @@ fn check_membership_proof_setup<T: Config>(
(key, Historical::<T>::prove(key).unwrap())
}
impl_benchmark_test_suite!(Pallet, crate::mock::new_test_ext(), crate::mock::Test, extra = false);