Files
codex/codex-rs/exec-server/tests/file_system_windows.rs
T
Adam Perry @ OpenAI cc97839068 [codex] add cross-platform filesystem adapter coverage (#27454)
## Why

The exec-server's existing filesystem tests only run on `#[cfg(unix)]`.
We should be running the applicable ones on Windows, and also include
the basic filesystem operations that will be modified by migrating to
`PathUri`.

## What

Split platform-neutral local/remote tests into a shared Unix/Windows
suite while keeping the existing `AbsolutePathBuf` API, and add Windows
junction canonicalization coverage.
2026-06-11 17:53:18 +00:00

56 lines
1.6 KiB
Rust

#![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
}