tests: Replace manual losetup with create_loop_device() call

Use the ioctl based create_loop_device() helper instead of
shelling out to losetup in the file backed 4K alignment test.

Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
This commit is contained in:
Anatol Belski
2026-04-17 09:23:12 +02:00
committed by Rob Bradford
parent 4772235952
commit e38f00644d

View File

@@ -3529,12 +3529,7 @@ mod common_parallel {
"truncate failed"
);
let loop_dev = exec_host_command_output(&format!(
"losetup --find --show --sector-size 4096 {}",
fs_img_path.to_str().unwrap()
));
assert!(loop_dev.status.success(), "losetup failed");
let loop_dev_path = String::from_utf8_lossy(&loop_dev.stdout).trim().to_string();
let loop_dev_path = create_loop_device(fs_img_path.to_str().unwrap(), 4096, 5);
assert!(
exec_host_command_output(&format!("mkfs.ext4 -q {loop_dev_path}"))