From 88e6bf0fba9eb4e67dce0052987f58fcfaa2ca5c Mon Sep 17 00:00:00 2001 From: skylartaylor Date: Thu, 26 Nov 2026 11:05:59 +0100 Subject: [PATCH] nightly-tests: give the launcher fixture the platform's absolute profile root `launcher_argv` started a nightly with `/nightly-data/profiles/gridcraft`. Rust needs a prefix and a root for an absolute path on Windows, so that spelling is relative there, `launch_profile::parse` refuses it, and every test that builds argv with it fails on windows-latest - which runs this suite. `launcher_root()` now returns the platform's spelling (`C:\NightlyData\profiles\gridcraft` on Windows, `/nightly-data/profiles/gridcraft` elsewhere), and a new case refuses the other platform's spelling so the fixture cannot drift back to a POSIX-only literal. --- apps/gridcraft/src/main.rs | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/apps/gridcraft/src/main.rs b/apps/gridcraft/src/main.rs index 3b78114a8..d0c71fd2e 100644 --- a/apps/gridcraft/src/main.rs +++ b/apps/gridcraft/src/main.rs @@ -659,9 +659,16 @@ mod launch_separator_tests { use super::*; use crate::build_flavor::BuildFlavor; + /// The profile root a Launcher run is started with: absolute for the platform the test runs on. + /// `launch_profile::parse` refuses a root that is relative there, and a POSIX path has no drive + /// or UNC prefix, so it is not absolute on Windows - where CI runs these tests too. + fn launcher_root() -> &'static str { + if cfg!(windows) { r"C:\NightlyData\profiles\gridcraft" } else { "/nightly-data/profiles/gridcraft" } + } + /// The argv the Launcher starts a nightly with, extended by `tail`, as the start then reads it. fn launcher_argv(tail: &[&str]) -> Vec { - let mut argv: Vec = ["--launch-profile", "nightly-v1", "--profile-root", "/nightly-data/profiles/gridcraft", "--"] + let mut argv: Vec = ["--launch-profile", "nightly-v1", "--profile-root", launcher_root(), "--"] .iter() .map(std::ffi::OsString::from) .collect(); @@ -669,6 +676,16 @@ mod launch_separator_tests { launch_profile::parse(argv).unwrap().args.iter().map(|a| a.to_string_lossy().into_owned()).collect() } + #[test] + fn the_other_platforms_root_spelling_is_refused_as_relative() { + let foreign = if cfg!(windows) { "/nightly-data/profiles/gridcraft" } else { r"C:\NightlyData\profiles\gridcraft" }; + let argv: Vec = ["--launch-profile", "nightly-v1", "--profile-root", foreign, "--"] + .iter() + .map(std::ffi::OsString::from) + .collect(); + assert!(launch_profile::parse(argv).is_err(), "a root that is not absolute on this platform must be refused"); + } + #[test] fn the_launchers_separator_is_never_a_file() { let parsed = desktop_args(&launcher_argv(&[]), None, None);