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:
ucoverandShawn Tabrizi authored and GitHub committed 2021-10-01 08:17:26 +00:00
1 parent a31ab1fc37
commit f8ce186496
39 files changed
+499 -173

No files matched your search

@@ -20,7 +20,7 @@
#![cfg_attr(not(feature = "std"), no_std)]
use codec::Encode;
use frame_benchmarking::{benchmarks, impl_benchmark_test_suite, whitelisted_caller};
use frame_benchmarking::{benchmarks, whitelisted_caller};
use frame_support::{storage, traits::Get, weights::DispatchClass};
use frame_system::{Call, DigestItemOf, Pallet as System, RawOrigin};
use sp_core::{storage::well_known_keys, ChangesTrieConfiguration};
@@ -140,6 +140,6 @@ benchmarks! {
verify {
assert_eq!(storage::unhashed::get_raw(&last_key), None);
}
}
impl_benchmark_test_suite!(Pallet, crate::mock::new_test_ext(), crate::mock::Test);
impl_benchmark_test_suite!(Pallet, crate::mock::new_test_ext(), crate::mock::Test);
}