Skip to content
This repository has been archived by the owner on Jan 13, 2025. It is now read-only.

Add cargo-bpf-test --no-run flag, matching cargo-test (bp #15907) #15916

Merged
merged 1 commit into from
Mar 16, 2021
Merged
Changes from all commits
Commits
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
13 changes: 13 additions & 0 deletions sdk/cargo-test-bpf/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ struct Config {
features: Vec<String>,
test_name: Option<String>,
no_default_features: bool,
no_run: bool,
offline: bool,
verbose: bool,
workspace: bool,
Expand All @@ -34,6 +35,7 @@ impl Default for Config {
features: vec![],
test_name: None,
no_default_features: false,
no_run: false,
offline: false,
verbose: false,
workspace: false,
Expand Down Expand Up @@ -109,6 +111,10 @@ fn test_bpf_package(config: &Config, target_directory: &Path, package: &cargo_me
cargo_args.push(test_name);
}

if config.no_run {
cargo_args.push("--no-run");
}

// If the program crate declares the "test-bpf" feature, pass it along to the tests so they can
// distinguish between `cargo test` and `cargo test-bpf`
if set_test_bpf_feature {
Expand Down Expand Up @@ -215,6 +221,12 @@ fn main() {
.takes_value(true)
.help("Place final BPF build artifacts in this directory"),
)
.arg(
Arg::with_name("no_run")
.long("no-run")
.takes_value(false)
.help("Compile, but don't run tests"),
)
.arg(
Arg::with_name("offline")
.long("offline")
Expand Down Expand Up @@ -255,6 +267,7 @@ fn main() {
.unwrap_or_else(Vec::new),
test_name: value_t!(matches, "test", String).ok(),
no_default_features: matches.is_present("no_default_features"),
no_run: matches.is_present("no_run"),
offline: matches.is_present("offline"),
verbose: matches.is_present("verbose"),
workspace: matches.is_present("workspace"),
Expand Down