From 13ffd805266615044b9c1730eeced1a05f33a604 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 6 Jun 2026 09:02:51 +0000 Subject: [PATCH 1/3] Initial plan From 9865f14d0cf052f8aa2f8e09aa46e391a6add444 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 6 Jun 2026 09:10:51 +0000 Subject: [PATCH 2/3] Handle mkntfs fallback in NTFS test helper --- src/arch/dualboot/test_utils.rs | 38 +++++++++++++++++++++++++++------ 1 file changed, 31 insertions(+), 7 deletions(-) diff --git a/src/arch/dualboot/test_utils.rs b/src/arch/dualboot/test_utils.rs index 7e8c641f..9fc62983 100644 --- a/src/arch/dualboot/test_utils.rs +++ b/src/arch/dualboot/test_utils.rs @@ -1,6 +1,8 @@ #[cfg(test)] use std::io::Write; #[cfg(test)] +use std::io::{ErrorKind, Result as IoResult}; +#[cfg(test)] use std::process::Command; #[cfg(test)] use tempfile::NamedTempFile; @@ -69,13 +71,35 @@ impl TestDisk { /// Format as NTFS pub fn format_ntfs(&self) { - let status = Command::new("mkfs.ntfs") - .arg("-F") - .arg("-Q") // Quick format - .arg(self.path_str()) - .status() - .expect("Failed to run mkfs.ntfs"); - assert!(status.success(), "mkfs.ntfs failed"); + let status = run_ntfs_formatter(self.path_str()).expect("Failed to run NTFS formatter"); + assert!(status.success(), "NTFS formatter failed"); + } +} + +#[cfg(test)] +fn run_ntfs_formatter(path: &str) -> IoResult { + let mut not_found = None; + for formatter in ["mkfs.ntfs", "mkntfs"] { + match Command::new(formatter).arg("-F").arg("-Q").arg(path).status() { + Ok(status) => return Ok(status), + Err(err) if err.kind() == ErrorKind::NotFound => { + not_found = Some(err); + } + Err(err) => return Err(err), + } + } + Err(not_found.expect("Formatter list is non-empty")) +} + +#[cfg(test)] +mod tests { + use super::run_ntfs_formatter; + + #[test] + fn ntfs_formatter_is_available() { + let disk = super::TestDisk::new(16); + let status = run_ntfs_formatter(disk.path_str()).expect("No NTFS formatter found"); + assert!(status.success(), "NTFS formatter failed"); } } From 9deb979a3fbc43915a190ed19e53f70790123635 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 6 Jun 2026 09:15:05 +0000 Subject: [PATCH 3/3] Improve NTFS formatter missing-command error message --- src/arch/dualboot/test_utils.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/arch/dualboot/test_utils.rs b/src/arch/dualboot/test_utils.rs index 9fc62983..af3c75aa 100644 --- a/src/arch/dualboot/test_utils.rs +++ b/src/arch/dualboot/test_utils.rs @@ -88,7 +88,14 @@ fn run_ntfs_formatter(path: &str) -> IoResult { Err(err) => return Err(err), } } - Err(not_found.expect("Formatter list is non-empty")) + Err( + not_found.unwrap_or_else(|| { + std::io::Error::new( + ErrorKind::NotFound, + "No NTFS formatter found (tried mkfs.ntfs and mkntfs)", + ) + }), + ) } #[cfg(test)]