Skip to content

Commit 6030628

Browse files
committed
Add support for --features flag in test command
1 parent 6664bf0 commit 6030628

File tree

3 files changed

+16
-0
lines changed

3 files changed

+16
-0
lines changed

crates/tracel-xtask-macros/src/lib.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,14 @@ fn get_additional_cmd_args_map() -> HashMap<&'static str, proc_macro2::TokenStre
259259
required = false
260260
)]
261261
pub threads: Option<u16>,
262+
#[doc = r"Comma-separated list of features to enable during tests."]
263+
#[arg(
264+
long,
265+
value_name = "FEATURE,FEATURE,...",
266+
value_delimiter = ',',
267+
required = false
268+
)]
269+
pub features: Option<Vec<String>>,
262270
},
263271
),
264272
(
@@ -478,6 +486,7 @@ fn generate_command_args_tryinto(args: TokenStream, input: TokenStream) -> Token
478486
// we can use an inventory (see TODO at the top of the file)
479487
if ident_str != "target"
480488
&& (ident_str == "exclude"
489+
|| ident_str == "features"
481490
|| ident_str == "only"
482491
|| ident_str == "ignore_audit"
483492
|| ident_str == "jobs"

crates/tracel-xtask/src/commands/test.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ pub fn handle_command(args: TestCmdArgs) -> anyhow::Result<()> {
3232
only: args.only.clone(),
3333
threads: args.threads,
3434
jobs: args.jobs,
35+
features: args.features.clone(),
3536
})
3637
}),
3738
}
@@ -42,6 +43,11 @@ fn push_optional_args(cmd_args: &mut Vec<String>, args: &TestCmdArgs) {
4243
if let Some(jobs) = &args.jobs {
4344
cmd_args.extend(vec!["--jobs".to_string(), jobs.to_string()]);
4445
};
46+
if let Some(features) = &args.features {
47+
if !features.is_empty() {
48+
cmd_args.extend(vec!["--features".to_string(), features.join(",")]);
49+
}
50+
}
4551
// test harness options
4652
cmd_args.extend(vec!["--".to_string(), "--color=always".to_string()]);
4753
if let Some(threads) = &args.threads {

crates/tracel-xtask/src/commands/validate.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ pub fn handle_command(args: ValidateCmdArgs) -> anyhow::Result<()> {
3838
threads: None,
3939
jobs: None,
4040
command: Some(TestSubCommand::All),
41+
features: None,
4142
})?;
4243

4344
Ok(())

0 commit comments

Comments
 (0)