Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Activate RCC long path support during setup #442

Merged
merged 2 commits into from
Nov 17, 2023
Merged
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
1 change: 1 addition & 0 deletions v2/robotmk/src/bin/scheduler/results.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ impl WriteSection for SchedulerPhase {
#[derive(Serialize)]
pub struct RCCSetupFailures {
pub telemetry_disabling: Vec<String>,
pub long_path_support: Vec<String>,
pub shared_holotree: Vec<String>,
pub holotree_init: Vec<String>,
}
Expand Down
100 changes: 67 additions & 33 deletions v2/robotmk/src/bin/scheduler/setup/rcc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ fn rcc_setup_working_directory(working_directory: &Utf8Path) -> Utf8PathBuf {
fn rcc_setup(global_config: &GlobalConfig, rcc_suites: Vec<Suite>) -> Result<Vec<Suite>> {
let mut rcc_setup_failures = RCCSetupFailures {
telemetry_disabling: vec![],
long_path_support: vec![],
shared_holotree: vec![],
holotree_init: vec![],
};
Expand All @@ -64,11 +65,24 @@ fn rcc_setup(global_config: &GlobalConfig, rcc_suites: Vec<Suite>) -> Result<Vec
failed_suites.into_iter().map(|suite| suite.name).collect();
if !rcc_setup_failures.telemetry_disabling.is_empty() {
error!(
"Dropping the following suites due RCC telemetry disabling failure: {}",
"Dropping the following suites due to RCC telemetry disabling failure: {}",
rcc_setup_failures.telemetry_disabling.join(", ")
);
}

debug!("Enabling support for long paths");
let (sucessful_suites, failed_suites) =
enable_long_path_support(global_config, sucessful_suites)
.context("Enabling support for long paths failed")?;
rcc_setup_failures.long_path_support =
failed_suites.into_iter().map(|suite| suite.name).collect();
if !rcc_setup_failures.long_path_support.is_empty() {
error!(
"Dropping the following suites due to long path support enabling failure: {}",
rcc_setup_failures.long_path_support.join(", ")
);
}

debug!("Initializing shared holotree");
let (sucessful_suites, failed_suites) = shared_holotree_init(global_config, sucessful_suites)
.context("Shared holotree initialization failed")?;
Expand Down Expand Up @@ -115,46 +129,42 @@ fn disable_rcc_telemetry(
"--do-not-track".into(),
],
},
"rcc_telemetry_disabling",
"telemetry_disabling",
)
}

fn enable_long_path_support(
global_config: &GlobalConfig,
suites: Vec<Suite>,
) -> Result<(Vec<Suite>, Vec<Suite>)> {
run_command_spec_once_in_current_session(
global_config,
suites,
&CommandSpec {
executable: global_config.rcc_binary_path.to_string(),
arguments: vec!["configure".into(), "longpaths".into(), "--enable".into()],
},
"long_path_support_enabling",
)
}

fn shared_holotree_init(
global_config: &GlobalConfig,
suites: Vec<Suite>,
) -> Result<(Vec<Suite>, Vec<Suite>)> {
Ok(
if run_command_spec_in_session(
&Session::Current(CurrentSession {}),
&RunSpec {
id: "rcc_shared_holotree_init",
command_spec: &CommandSpec {
executable: global_config.rcc_binary_path.to_string(),
arguments: vec![
"holotree".into(),
"shared".into(),
"--enable".into(),
"--once".into(),
],
},
base_path: &rcc_setup_working_directory(&global_config.working_directory)
.join("shared_holotree_init"),
timeout: 120,
termination_flag: &global_config.termination_flag,
},
)? {
(suites, vec![])
} else {
error!(
"Shared holotree initialization failed for the following suites which will now be dropped: {}",
suites
.iter()
.map(|suite| suite.name.as_str())
.collect::<Vec<&str>>()
.join(", ")
);
(vec![], suites)
run_command_spec_once_in_current_session(
global_config,
suites,
&CommandSpec {
executable: global_config.rcc_binary_path.to_string(),
arguments: vec![
"holotree".into(),
"shared".into(),
"--enable".into(),
"--once".into(),
],
},
"shared_holotree_init",
)
}

Expand All @@ -173,6 +183,30 @@ fn holotree_init(
)
}

fn run_command_spec_once_in_current_session(
global_config: &GlobalConfig,
suites: Vec<Suite>,
command_spec: &CommandSpec,
id: &str,
) -> Result<(Vec<Suite>, Vec<Suite>)> {
Ok(
if run_command_spec_in_session(
&Session::Current(CurrentSession {}),
&RunSpec {
id: &format!("robotmk_{id}"),
command_spec,
base_path: &rcc_setup_working_directory(&global_config.working_directory).join(id),
timeout: 120,
termination_flag: &global_config.termination_flag,
},
)? {
(suites, vec![])
} else {
(vec![], suites)
},
)
}

fn run_command_spec_per_session(
global_config: &GlobalConfig,
suites: Vec<Suite>,
Expand Down
Loading