diff --git a/Cargo.toml b/Cargo.toml index 533ea4c9e878..384312864d41 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -678,6 +678,7 @@ cfg-expr = { version = "0.15.5" } cfg-if = { version = "1.0" } chain-spec-builder = { path = "substrate/bin/utils/chain-spec-builder", default-features = false, package = "staging-chain-spec-builder" } chain-spec-guide-runtime = { path = "docs/sdk/src/reference_docs/chain_spec_runtime" } +frame-omni-bencher-guide = { path = "docs/sdk/src/reference_docs/frame-omni-bencher" } chrono = { version = "0.4.31" } cid = { version = "0.9.0" } clap = { version = "4.5.13" } diff --git a/docs/sdk/Cargo.toml b/docs/sdk/Cargo.toml index 0c39367eeed3..232c7a7055e6 100644 --- a/docs/sdk/Cargo.toml +++ b/docs/sdk/Cargo.toml @@ -126,6 +126,7 @@ pallet-xcm = { workspace = true } # runtime guides chain-spec-guide-runtime = { workspace = true, default-features = true } +frame-omni-bencher-guide = { workspace = true, default-features = true } # Templates minimal-template-runtime = { workspace = true, default-features = true } diff --git a/docs/sdk/src/reference_docs/frame_omni_bencher/Cargo.toml b/docs/sdk/src/reference_docs/frame_omni_bencher/Cargo.toml new file mode 100644 index 000000000000..2754b3509797 --- /dev/null +++ b/docs/sdk/src/reference_docs/frame_omni_bencher/Cargo.toml @@ -0,0 +1,13 @@ +[package] +name = "frame-omni-bencher-guide" +description = "A frame-omni-bencher guide" +version = "0.0.0" +license = "MIT-0" +authors.workspace = true +homepage.workspace = true +repository.workspace = true +edition.workspace = true +publish = false + +[dependencies] +docify = { workspace = true } \ No newline at end of file diff --git a/docs/sdk/src/reference_docs/frame_omni_bencher/tests.rs b/docs/sdk/src/reference_docs/frame_omni_bencher/tests.rs new file mode 100644 index 000000000000..ebb668f1e284 --- /dev/null +++ b/docs/sdk/src/reference_docs/frame_omni_bencher/tests.rs @@ -0,0 +1,55 @@ +use std::{process::Command, str}; + +const WASM_FILE_PATH: &str = + "../../../../../target/release/wbuild/westend-runtime/westend-runtime-compact-compressed.wasm"; + +const FRAME_OMNI_BENCHER_PATH: &str = "../../../../../target/release/frame-omni-bencher"; + + +fn install_frame_omni_bencher() -> &'static str { + let _ = std::process::Command::new("cargo") + .arg("build") + .arg("-p") + .arg("frame-omni-bencher") + .arg("--release") + .status() + .expect("Failed to execute command"); + WASM_FILE_PATH +} + +fn build_westend_runtime() -> &'static str { + let _ = std::process::Command{"cargo"} + .arg("build") + .arg("--release") + .arg("-p") + .arg("westend-runtime") + .arg("--features") + .arg("runtime-benchmarks") + .arg("--release") + .status() + .expect("Failed to execute command"); + WASM_FILE_PATH +} + +fn pallet_utility_bench(wasm_file_path: &'static str, frame_omni_bencher_path: &'static str) { + + let _ = std::process::Command::new(frame_omni_bencher_path) + .arg("v1") + .arg("benchmark") + .arg("pallet") + .arg("--runtime") + .arg(wasm_file_path) + .arg("--pallet") + .arg("pallet-utility") + .arg("--extrinsic") + .arg("") + .expect("Failed to execute"); +} + +#[test] +#[docify::export] +fn test_pallet_utility_bench() { + let output_2 = Command::new(install_frame_omni_bencher()); + let output_1 = Command::new(build_westend_runtime()); + let _ = Command::new(pallet_utility_bench(output_1, output_2)); +} \ No newline at end of file