diff --git a/crates/alkane-flash/src/sd_media.rs b/crates/alkane-flash/src/sd_media.rs index 3668976b..ce84e603 100644 --- a/crates/alkane-flash/src/sd_media.rs +++ b/crates/alkane-flash/src/sd_media.rs @@ -705,6 +705,12 @@ mod tests { /// Build a fake vendor SD-recovery package (nested like the real one) and /// assemble a stock-recovery card image from it, then read the card back /// with `mdir`/`mtype` and confirm the layout and content survived. + /// + /// Host-tool test: unix only. On a Windows target (incl. the Wine CI run) + /// the card-building tools are unix binaries that a Windows process cannot + /// exec, and `find_tool` would see them as present in the shared container + /// filesystem, so these are cfg'd out rather than skipped at runtime. + #[cfg(unix)] #[test] fn builds_a_stock_recovery_card_from_a_vendor_package() { // Skip cleanly if the host lacks the tools (keeps CI green where the @@ -789,12 +795,14 @@ mod tests { assert_eq!(sanitize_label("ANTMINER"), "ANTMINER"); } + #[cfg(unix)] fn have_tools(tools: &[&str]) -> bool { tools.iter().all(|t| find_tool(t).is_ok()) } /// A minimal gzipped newc cpio containing `etc/` + a probe file, to stand in /// for an afw rootfs in the installer-initramfs tests. + #[cfg(unix)] fn fake_cpio_gz(dir: &Path) -> Vec { fs::create_dir_all(dir.join("etc/init.d")).unwrap(); fs::write(dir.join("probe"), b"hello-rootfs").unwrap(); @@ -824,10 +832,12 @@ mod tests { gz.wait_with_output().unwrap().stdout } + #[cfg(unix)] fn uimage_magic(bytes: &[u8]) -> bool { bytes.len() >= 4 && bytes[0..4] == [0x27, 0x05, 0x19, 0x56] } + #[cfg(unix)] fn mtype_bytes(img: &Path, card_path: &str) -> Vec { let tmp = tempdir::TempHold::new().unwrap(); let rc = tmp.path().join("rc"); @@ -849,6 +859,7 @@ mod tests { .stdout } + #[cfg(unix)] #[test] fn injects_install_hook_into_initramfs() { if !have_tools(&["cpio", "gzip", "gunzip", "find"]) { @@ -892,6 +903,7 @@ mod tests { assert!(ex.join("probe").is_file(), "original rootfs content lost"); } + #[cfg(unix)] #[test] fn builds_a_zynq_simpleboot_card() { if !have_tools(&["sfdisk", "mkfs.vfat", "mcopy", "mmd", "mdir", "mtype"]) { @@ -913,6 +925,7 @@ mod tests { assert_eq!(mtype_bytes(&out, "devicetree.dtb"), b"ALKANE-FDT"); } + #[cfg(unix)] #[test] fn builds_a_zynq_installer_card() { if !have_tools(&[