Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
24cf315
Create a macro which automates creation of benchmark test suites.
coriolinus Feb 11, 2021
0209e4d
bump impl_version
coriolinus Feb 11, 2021
df14bba
allow unused on test_bench_by_name
coriolinus Feb 11, 2021
dacbe67
use proper doctest ignore attribute
coriolinus Feb 11, 2021
47c795f
Explicitly hand the Module to the test suite
coriolinus Feb 12, 2021
4b3be35
explicitly import what we need into `mod tests`
coriolinus Feb 12, 2021
9577ee7
bench_module is `ident` not `tt`
coriolinus Feb 12, 2021
a6cf5d4
allow end users to specify arguments for new_test_ext
coriolinus Feb 12, 2021
ebf64f0
enable explicitly specifying the path to the benchmarks invocation
coriolinus Feb 12, 2021
e0444d8
Revert "bump impl_version"
coriolinus Feb 12, 2021
cb6a33d
list failing benchmark tests and the errors which caused the failure
coriolinus Feb 12, 2021
fd71312
harden benchmark tests against internal panics
coriolinus Feb 12, 2021
7169e83
suppress warning about ignored profiles
coriolinus Feb 15, 2021
c382fb2
impl_benchmark_test_suite for assets
coriolinus Feb 15, 2021
bd39a02
impl_benchmark_test_suite for balances
coriolinus Feb 15, 2021
ebcf6d8
impl_benchmark_test_suite for bounties
coriolinus Feb 15, 2021
e0839c2
impl_benchmark_test_suite for Collective
coriolinus Feb 15, 2021
5e45e40
impl_benchmark_test_suite for Contracts
coriolinus Feb 15, 2021
5c9f586
impl_benchmark_test_suite for Democracy
coriolinus Feb 15, 2021
2730e07
don't impl_benchmark_test_suite for Elections-Phragmen
coriolinus Feb 15, 2021
4206191
impl_benchmark_test_suite for Identity
coriolinus Feb 15, 2021
9889fc9
impl_benchmark_test_suite for ImOnline
coriolinus Feb 15, 2021
10079b5
impl_benchmark_test_suite for indices
coriolinus Feb 15, 2021
ffa7693
impl_benchmark_test_suite for lottery
coriolinus Feb 15, 2021
01964c6
impl_benchmark_test_suite for merkle-mountain-range
coriolinus Feb 15, 2021
3ef76f3
impl_benchmark_test_suite for Multisig
coriolinus Feb 15, 2021
deb140f
impl_benchmark_test_suite for offences
coriolinus Feb 15, 2021
c154611
impl_benchmark_test_suite for Proxy
coriolinus Feb 15, 2021
f4cdd67
impl_benchmark_test_suite for scheduler
coriolinus Feb 15, 2021
a350c64
impl_benchmark_test_suite for session
coriolinus Feb 15, 2021
6efac34
impl_benchmark_test_suite for staking
coriolinus Feb 15, 2021
3e14cd2
impl_benchmark_test_suite for system
coriolinus Feb 15, 2021
681deaf
impl_benchmark_test_suite for timestamp
coriolinus Feb 15, 2021
4e03f34
impl_benchmark_test_suite for tips
coriolinus Feb 15, 2021
82f2a0d
impl_benchmark_test_suite for treasury
coriolinus Feb 15, 2021
7fcb460
impl_benchmark_test_suite for utility
coriolinus Feb 15, 2021
db62d9f
impl_benchmark_test_suite for vesting
coriolinus Feb 15, 2021
5341906
fix wrong module name in impl_benchmark_test_suite in Offences
coriolinus Feb 15, 2021
1732671
address line length nits
coriolinus Feb 15, 2021
f1859ee
enable optional keyword argument: exec_name
coriolinus Feb 15, 2021
f3d2f8f
get rid of dead code
coriolinus Feb 15, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
120 changes: 2 additions & 118 deletions frame/assets/src/benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
use super::*;
use sp_runtime::traits::Bounded;
use frame_system::RawOrigin as SystemOrigin;
use frame_benchmarking::{benchmarks, account, whitelisted_caller};
use frame_benchmarking::{benchmarks, account, whitelisted_caller, impl_benchmark_test_suite};
use frame_support::traits::Get;

use crate::Module as Assets;
Expand Down Expand Up @@ -233,120 +233,4 @@ benchmarks! {
}
}

#[cfg(test)]
mod tests {
use super::*;
use crate::tests::{new_test_ext, Test};

#[test]
fn create() {
new_test_ext().execute_with(|| {
assert!(test_benchmark_create::<Test>().is_ok());
});
}

#[test]
fn force_create() {
new_test_ext().execute_with(|| {
assert!(test_benchmark_force_create::<Test>().is_ok());
});
}

#[test]
fn destroy() {
new_test_ext().execute_with(|| {
assert!(test_benchmark_destroy::<Test>().is_ok());
});
}

#[test]
fn force_destroy() {
new_test_ext().execute_with(|| {
assert!(test_benchmark_force_destroy::<Test>().is_ok());
});
}

#[test]
fn mint() {
new_test_ext().execute_with(|| {
assert!(test_benchmark_mint::<Test>().is_ok());
});
}

#[test]
fn burn() {
new_test_ext().execute_with(|| {
assert!(test_benchmark_burn::<Test>().is_ok());
});
}

#[test]
fn transfer() {
new_test_ext().execute_with(|| {
assert!(test_benchmark_transfer::<Test>().is_ok());
});
}

#[test]
fn force_transfer() {
new_test_ext().execute_with(|| {
assert!(test_benchmark_force_transfer::<Test>().is_ok());
});
}

#[test]
fn freeze() {
new_test_ext().execute_with(|| {
assert!(test_benchmark_freeze::<Test>().is_ok());
});
}

#[test]
fn thaw() {
new_test_ext().execute_with(|| {
assert!(test_benchmark_thaw::<Test>().is_ok());
});
}

#[test]
fn freeze_asset() {
new_test_ext().execute_with(|| {
assert!(test_benchmark_freeze_asset::<Test>().is_ok());
});
}

#[test]
fn thaw_asset() {
new_test_ext().execute_with(|| {
assert!(test_benchmark_thaw_asset::<Test>().is_ok());
});
}

#[test]
fn transfer_ownership() {
new_test_ext().execute_with(|| {
assert!(test_benchmark_transfer_ownership::<Test>().is_ok());
});
}

#[test]
fn set_team() {
new_test_ext().execute_with(|| {
assert!(test_benchmark_set_team::<Test>().is_ok());
});
}

#[test]
fn set_max_zombies() {
new_test_ext().execute_with(|| {
assert!(test_benchmark_set_max_zombies::<Test>().is_ok());
});
}

#[test]
fn set_metadata() {
new_test_ext().execute_with(|| {
assert!(test_benchmark_set_metadata::<Test>().is_ok());
});
}
}
impl_benchmark_test_suite!(Assets, crate::tests::new_test_ext(), crate::tests::Test);
55 changes: 6 additions & 49 deletions frame/balances/src/benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
use super::*;

use frame_system::RawOrigin;
use frame_benchmarking::{benchmarks, account, whitelisted_caller};
use frame_benchmarking::{benchmarks, account, whitelisted_caller, impl_benchmark_test_suite};
use sp_runtime::traits::Bounded;

use crate::Module as Balances;
Expand Down Expand Up @@ -144,51 +144,8 @@ benchmarks! {
}
}

#[cfg(test)]
mod tests {
use super::*;
use crate::tests_composite::{ExtBuilder, Test};
use frame_support::assert_ok;

#[test]
fn transfer() {
ExtBuilder::default().build().execute_with(|| {
assert_ok!(test_benchmark_transfer::<Test>());
});
}

#[test]
fn transfer_best_case() {
ExtBuilder::default().build().execute_with(|| {
assert_ok!(test_benchmark_transfer_best_case::<Test>());
});
}

#[test]
fn transfer_keep_alive() {
ExtBuilder::default().build().execute_with(|| {
assert_ok!(test_benchmark_transfer_keep_alive::<Test>());
});
}

#[test]
fn transfer_set_balance_creating() {
ExtBuilder::default().build().execute_with(|| {
assert_ok!(test_benchmark_set_balance_creating::<Test>());
});
}

#[test]
fn transfer_set_balance_killing() {
ExtBuilder::default().build().execute_with(|| {
assert_ok!(test_benchmark_set_balance_killing::<Test>());
});
}

#[test]
fn force_transfer() {
ExtBuilder::default().build().execute_with(|| {
assert_ok!(test_benchmark_force_transfer::<Test>());
});
}
}
impl_benchmark_test_suite!(
Balances,
crate::tests_composite::ExtBuilder::default().build(),
crate::tests_composite::Test,
);
Loading