Skip to content
Open
Show file tree
Hide file tree
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
23 changes: 19 additions & 4 deletions app/buck2_client/src/commands/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,6 @@ If include patterns are present, regardless of whether exclude patterns are pres
build_default_info: bool,

/// Do not build DefaultInfo provider (this is the default)
#[allow(unused)]
#[clap(long, group = "default-info")]
skip_default_info: bool,

Expand All @@ -168,7 +167,6 @@ If include patterns are present, regardless of whether exclude patterns are pres
build_run_info: bool,

/// Do not build RunInfo provider (this is the default)
#[allow(unused)]
#[clap(long, group = "run-info")]
skip_run_info: bool,

Expand Down Expand Up @@ -205,6 +203,23 @@ impl StreamingCommand for TestCommand {
events_ctx: &mut EventsCtx,
) -> ExitResult {
let context = ctx.client_context(matches, &self)?;

let build_default_info = if self.skip_default_info {
false
} else if self.build_default_info {
true
} else {
ctx.test_builds_targets()?
};

let build_run_info = if self.skip_run_info {
false
} else if self.build_run_info {
true
} else {
ctx.test_builds_targets()?
};

let response = buckd
.with_flushing()
.test(
Expand All @@ -228,8 +243,8 @@ impl StreamingCommand for TestCommand {
}),
timeout: self.timeout_options.overall_timeout()?,
ignore_tests_attribute: self.ignore_tests_attribute,
build_default_info: self.build_default_info,
build_run_info: self.build_run_info,
build_default_info,
build_run_info,
},
events_ctx,
ctx.console_interaction_stream(&self.common_opts.console_opts),
Expand Down
8 changes: 8 additions & 0 deletions app/buck2_client_ctx/src/client_ctx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,14 @@ impl<'a> ClientCommandContext<'a> {
.log_download_method
.clone())
}

pub fn test_builds_targets(&self) -> buck2_error::Result<bool> {
Ok(self
.immediate_config
.daemon_startup_config()?
.test_builds_targets
.clone())
Comment on lines +302 to +303
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
.test_builds_targets
.clone())
.test_builds_targets)

}
}

/// Provides a common interface for buck subcommands that use event subscribers for logging.
Expand Down
8 changes: 8 additions & 0 deletions app/buck2_common/src/init.rs
Original file line number Diff line number Diff line change
Expand Up @@ -437,6 +437,7 @@ pub struct DaemonStartupConfig {
pub resource_control: ResourceControlConfig,
pub log_download_method: LogDownloadMethod,
pub health_check_config: HealthCheckConfig,
pub test_builds_targets: bool,
}

impl DaemonStartupConfig {
Expand Down Expand Up @@ -512,6 +513,12 @@ impl DaemonStartupConfig {
resource_control: ResourceControlConfig::from_config(config)?,
log_download_method,
health_check_config: HealthCheckConfig::from_config(config)?,
test_builds_targets: config
.parse(BuckconfigKeyRef {
section: "buck2",
property: "test_builds_targets",
})?
.unwrap_or(false),
})
}

Expand Down Expand Up @@ -539,6 +546,7 @@ impl DaemonStartupConfig {
LogDownloadMethod::None
},
health_check_config: HealthCheckConfig::default(),
test_builds_targets: false,
}
}
}
Loading