From 0bc0396f80a8ee6926f1a6ca68cd71585501f697 Mon Sep 17 00:00:00 2001 From: l0ng-ai <24760907+l0ng-ai@users.noreply.github.com> Date: Wed, 4 Nov 2026 16:57:30 +0800 Subject: [PATCH] test(sdk): only use a subst drive that shows the test's own directory The two mapped-drive tests run in parallel processes and could race for the same free drive letter, then see the other test's directory. Mark the target and accept a drive only when the marker shows through it. --- crates/ide-sdk/src/discover.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/crates/ide-sdk/src/discover.rs b/crates/ide-sdk/src/discover.rs index c0de0540..e18b2dae 100644 --- a/crates/ide-sdk/src/discover.rs +++ b/crates/ide-sdk/src/discover.rs @@ -659,6 +659,10 @@ mod maven_path_tests { impl Subst { fn new(target: &Path) -> Self { + // Tests run in parallel and may race for the same free letter; only a drive that + // shows this target's marker is ours. + let marker = format!("{}.subst", target.file_name().unwrap().to_string_lossy()); + std::fs::write(target.join(&marker), "").unwrap(); for letter in (b'D'..=b'Z').rev() { let name = format!("{}:", char::from(letter)); let root = PathBuf::from(format!("{name}\\")); @@ -666,7 +670,7 @@ mod maven_path_tests { continue; } let output = Command::new("subst").arg(&name).arg(target).output().unwrap(); - if output.status.success() { + if output.status.success() && root.join(&marker).exists() { return Self { name, root }; } }