mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 09:57:56 +00:00
Use temporary db for benchmarking (#12254)
* Use temporary db for benchmarking If no db option was given benchmarks shall use temporary database. Otherwise the test can use locally stored database which maybe out-of-date causing test to fail. * nicer syntax * explanatory comment added * Update utils/frame/benchmarking-cli/src/lib.rs Co-authored-by: Bastian Köcher <info@kchr.de>
This commit is contained in:
committed by
GitHub
parent
5f248e9b94
commit
986d20b352
@@ -30,6 +30,7 @@ pub use extrinsic::{ExtrinsicBuilder, ExtrinsicCmd, ExtrinsicFactory};
|
||||
pub use machine::{MachineCmd, Requirements, SUBSTRATE_REFERENCE_HARDWARE};
|
||||
pub use overhead::OverheadCmd;
|
||||
pub use pallet::PalletCmd;
|
||||
pub use sc_service::BasePath;
|
||||
pub use storage::StorageCmd;
|
||||
|
||||
use sc_cli::{CliConfiguration, DatabaseParams, ImportParams, PruningParams, Result, SharedParams};
|
||||
@@ -87,6 +88,19 @@ impl CliConfiguration for BenchmarkCmd {
|
||||
}
|
||||
}
|
||||
|
||||
fn base_path(&self) -> Result<Option<BasePath>> {
|
||||
let inner = unwrap_cmd! {
|
||||
self, cmd, cmd.base_path()
|
||||
};
|
||||
|
||||
// If the base path was not provided, benchmark command shall use temporary path. Otherwise
|
||||
// we may end up using shared path, which may be inappropriate for benchmarking.
|
||||
match inner {
|
||||
Ok(None) => Some(BasePath::new_temp_dir()).transpose().map_err(|e| e.into()),
|
||||
e => e,
|
||||
}
|
||||
}
|
||||
|
||||
fn pruning_params(&self) -> Option<&PruningParams> {
|
||||
unwrap_cmd! {
|
||||
self, cmd, cmd.pruning_params()
|
||||
|
||||
Reference in New Issue
Block a user