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
@@ -23,9 +23,7 @@ use crate::Pallet as Collective;
use sp_runtime::traits::Bounded;
use sp_std::mem::size_of;
use frame_benchmarking::{
account, benchmarks_instance_pallet, impl_benchmark_test_suite, whitelisted_caller,
};
use frame_benchmarking::{account, benchmarks_instance_pallet, whitelisted_caller};
use frame_system::{Call as SystemCall, Pallet as System, RawOrigin as SystemOrigin};
const SEED: u32 = 0;
@@ -638,6 +636,6 @@ benchmarks_instance_pallet! {
assert_eq!(Collective::<T, I>::proposals().len(), (p - 1) as usize);
assert_last_event::<T, I>(Event::Disapproved(last_hash).into());
}
}
impl_benchmark_test_suite!(Collective, crate::tests::new_test_ext(), crate::tests::Test);
impl_benchmark_test_suite!(Collective, crate::tests::new_test_ext(), crate::tests::Test);
}