From e3de19b52e1cc195c60067070569ddd4f2ddf87c Mon Sep 17 00:00:00 2001 From: enricobuehler Date: Mon, 15 Jun 2026 07:49:01 +0000 Subject: [PATCH] test(host): make two host tests portable to Windows MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The Windows host test suite hit two pre-existing portability failures (the autonomous Windows bring-up never ran `cargo test` on the VM): - `vdisplay::detect_active_session_*` asserted a non-empty XDG runtime dir — a Linux concept with no Windows equivalent. Gate just that assertion to Linux (keep the call so the fn stays used → no dead_code). - `mgmt::openapi_document_is_complete_and_checked_in` did a byte compare against the checked-in spec, which git may check out CRLF on Windows while serde_json emits LF. Compare content with `\r` stripped. Host suite now 73/73 on x86_64-pc-windows-msvc; Linux unchanged (78 ok). Co-Authored-By: Claude Opus 4.8 (1M context) --- crates/punktfunk-host/src/mgmt.rs | 6 ++++-- crates/punktfunk-host/src/vdisplay.rs | 2 ++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/crates/punktfunk-host/src/mgmt.rs b/crates/punktfunk-host/src/mgmt.rs index 29a8523..edd34c8 100644 --- a/crates/punktfunk-host/src/mgmt.rs +++ b/crates/punktfunk-host/src/mgmt.rs @@ -1588,9 +1588,11 @@ mod tests { ); let checked_in = include_str!("../../../docs/api/openapi.json"); + // Compare content, not line-ending style: the generated `json` is LF (serde_json), but git + // may check the file out CRLF on Windows. assert_eq!( - json.trim(), - checked_in.trim(), + json.trim().replace('\r', ""), + checked_in.trim().replace('\r', ""), "docs/api/openapi.json is stale — regenerate with: \ cargo run -p punktfunk-host -- openapi > docs/api/openapi.json" ); diff --git a/crates/punktfunk-host/src/vdisplay.rs b/crates/punktfunk-host/src/vdisplay.rs index e53a06c..56b21a0 100644 --- a/crates/punktfunk-host/src/vdisplay.rs +++ b/crates/punktfunk-host/src/vdisplay.rs @@ -638,6 +638,8 @@ mod tests { // A pure probe of /proc + the runtime dir: it must not panic and must return promptly on // any box (CI has no graphical session → ActiveKind::None, with the runtime-dir anchor). let a = detect_active_session(); + // The runtime-dir anchor is a Linux (XDG) concept; Windows has no equivalent. + #[cfg(target_os = "linux")] assert!(!a.env.xdg_runtime_dir.is_empty()); // Wayland sockets are only resolved for the Wayland-protocol desktops. if matches!(