referrerpolicy=no-referrer-when-downgrade

Function substrate_cli_test_utils::build_substrate

source ·
pub fn build_substrate(args: &[&str])
Expand description

Builds the Substrate project using the provided arguments.

This function reads the CARGO_MANIFEST_DIR environment variable to find the root workspace directory. It then runs the cargo b command in the root directory with the specified arguments.

This can be useful for building the Substrate binary with a desired set of features prior to using the binary in a CLI test.

§Arguments

  • args: &[&str] - A slice of string references representing the arguments to pass to the cargo b command.

§Panics

This function will panic if:

  • The CARGO_MANIFEST_DIR environment variable is not set.
  • The root workspace directory cannot be determined.
  • The ‘cargo b’ command fails to execute.
  • The ‘cargo b’ command returns a non-successful status.

§Examples

build_substrate(&["--features=try-runtime"]);