Skip to content

Commit

Permalink
pass re_cache_enabled to TestDiscoveryEnd
Browse files Browse the repository at this point in the history
Summary: we wanna track which tests has re cache enabled/disabled

Reviewed By: IanChilds

Differential Revision: D65820851

fbshipit-source-id: 66d810eeadeca945a79216451d833298f01eb276
  • Loading branch information
perehonchuk authored and facebook-github-bot committed Nov 16, 2024
1 parent 3e999bc commit a2b2fe3
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 5 deletions.
7 changes: 7 additions & 0 deletions app/buck2_core/src/execution_types/executor_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -301,4 +301,11 @@ impl CommandExecutorConfig {
},
})
}

pub fn re_cache_enabled(&self) -> bool {
match &self.executor {
Executor::Local(_) => false,
Executor::RemoteEnabled(options) => options.remote_cache_enabled,
}
}
}
1 change: 1 addition & 0 deletions app/buck2_data/data.proto
Original file line number Diff line number Diff line change
Expand Up @@ -1619,6 +1619,7 @@ message TestDiscoveryStart {
message TestDiscoveryEnd {
string suite_name = 1;
CommandExecution command_report = 2;
bool re_cache_enabled = 3;
}

message TestRunStart {
Expand Down
14 changes: 9 additions & 5 deletions app/buck2_test/src/orchestrator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ impl<'a> BuckTestOrchestrator<'a> {
} = key;
let fs = dice.get_artifact_fs().await?;
let test_info = Self::get_test_info(dice, &test_target).await?;
let test_executor = Self::get_test_executor(
let (test_executor, re_cache_enabled) = Self::get_test_executor(
dice,
&test_target,
&test_info,
Expand Down Expand Up @@ -448,6 +448,7 @@ impl<'a> BuckTestOrchestrator<'a> {
&test_executor,
execution_request,
liveliness_observer.dupe(),
re_cache_enabled,
)
.boxed()
.await?;
Expand Down Expand Up @@ -759,7 +760,7 @@ impl<'a> TestOrchestrator for BuckTestOrchestrator<'a> {
.await?;

// Tests are not run, so there is no executor override.
let executor = Self::get_test_executor(
let (executor, _) = Self::get_test_executor(
self.dice.dupe().deref_mut(),
&test_target,
&test_info,
Expand Down Expand Up @@ -894,6 +895,7 @@ impl<'b> BuckTestOrchestrator<'b> {
executor: &CommandExecutor,
request: CommandExecutionRequest,
liveliness_observer: Arc<dyn LivelinessObserver>,
re_cache_enabled: bool,
) -> Result<ExecuteData, ExecuteError> {
let events = dice.per_transaction_data().get_dispatcher().dupe();
let manager = CommandExecutionManager::new(
Expand Down Expand Up @@ -960,6 +962,7 @@ impl<'b> BuckTestOrchestrator<'b> {
.to_command_execution_proto(true, true, false)
.await,
),
re_cache_enabled,
};
((result, cached), end)
})
Expand Down Expand Up @@ -1207,7 +1210,7 @@ impl<'b> BuckTestOrchestrator<'b> {
executor_override: Option<Arc<ExecutorConfigOverride>>,
fs: &ArtifactFs,
stage: &TestStage,
) -> anyhow::Result<CommandExecutor> {
) -> anyhow::Result<(CommandExecutor, bool)> {
// NOTE: get_providers() implicitly calls this already but it's not the end of the world
// since this will get cached in DICE.
let node = dice
Expand Down Expand Up @@ -1237,9 +1240,10 @@ impl<'b> BuckTestOrchestrator<'b> {
&stage,
)?;

Self::get_command_executor(dice, fs, &executor_config, stage)
let executor = Self::get_command_executor(dice, fs, &executor_config, stage)
.await
.context("Error constructing CommandExecutor")
.context("Error constructing CommandExecutor")?;
Ok((executor, executor_config.re_cache_enabled()))
}

async fn expand_test_executable<'a>(
Expand Down

0 comments on commit a2b2fe3

Please sign in to comment.