#![cfg(windows)] mod common; #[path = "file_system/shared.rs"] mod shared; #[path = "file_system/support.rs"] mod support; use std::path::Path; use std::process::Command; use anyhow::Result; use test_case::test_case; use crate::support::FileSystemImplementation; fn create_directory_junction(target: &Path, alias: &Path) -> Result<()> { let output = Command::new("cmd") .args(["/C", "mklink", "/J"]) .arg(alias) .arg(target) .output()?; if !output.status.success() { anyhow::bail!( "mklink /J failed: stdout={} stderr={}", String::from_utf8_lossy(&output.stdout).trim(), String::from_utf8_lossy(&output.stderr).trim() ); } Ok(()) } #[test_case(FileSystemImplementation::Local ; "local")] #[test_case(FileSystemImplementation::Remote ; "remote")] #[tokio::test(flavor = "multi_thread", worker_threads = 2)] async fn file_system_canonicalize_resolves_directory_junction( implementation: FileSystemImplementation, ) -> Result<()> { shared::assert_canonicalize_resolves_directory_alias(implementation, create_directory_junction) .await } #[test_case(FileSystemImplementation::Local ; "local")] #[test_case(FileSystemImplementation::Remote ; "remote")] #[tokio::test(flavor = "multi_thread", worker_threads = 2)] async fn file_system_sandboxed_canonicalize_resolves_directory_junction( implementation: FileSystemImplementation, ) -> Result<()> { shared::assert_sandboxed_canonicalize_resolves_directory_alias( implementation, create_directory_junction, ) .await }