Skip to content

Build the test suite on Windows by gating Unix-only tests - #1

Open
Tyagiquamar wants to merge 1 commit into
openprose:mainfrom
Tyagiquamar:fix/windows-test-build
Open

Build the test suite on Windows by gating Unix-only tests#1
Tyagiquamar wants to merge 1 commit into
openprose:mainfrom
Tyagiquamar:fix/windows-test-build

Conversation

@Tyagiquamar

Copy link
Copy Markdown

Problem

cargo test fails to compile on Windows. Three files use Unix-only APIs unconditionally:

  • src/spec_identity.rs — the unit-test module imports std::os::unix::fs and runs two symlink-escape tests (unix_fs::symlink).
  • tests/spec_identity_tests.rs — same import plus two symlink tests.
  • tests/adapter_tests.rs — imports std::os::unix::fs::PermissionsExt (for set_mode(0o755) on fake host shims) in three dogfood tests that also execute bash scripts.

On Windows the build stops at error[E0432]: unresolved import std::os::unix, so no test binary builds at all — including all platform-independent tests.

Provenance: found by running cargo test on Windows; the repo's local CI gate has only been exercised on Unix so far. No matching issue exists.

Fix

Gate exactly the Unix-dependent imports, helpers, and tests behind #[cfg(unix)]:

  • The two symlink tests per file depend on unix_fs::symlink; the three adapter dogfood tests create executable bash shims via PermissionsExt. All are inherently POSIX-only.
  • Shared non-Unix helper machinery that becomes unused when those tests are gated out (HOST_MEDIATED_DOGFOOD, host_mediated_dogfood_guard, json/fs/Path/tempdir imports) is gated with them, so both platforms compile warning-free.
  • Everything else — 108 lib unit tests and all platform-independent integration tests — now builds and runs on Windows unchanged. On Unix, compilation is byte-for-byte identical (#[cfg(unix)] is a no-op there).

Testing

Windows (x86_64-pc-windows-gnu, Rust 1.98):

  • Before: error[E0432]: unresolved import std::os::unix — no test binaries built.
  • After: cargo test → all green: 108 unit + 65 integration tests pass, 0 failed, no warnings.
  • cargo fmt --check clean; cargo clippy --all-targets --all-features -- -D warnings clean.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant