mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
block: Test write_unaligned closure error propagation
Add a write side counterpart to read_unaligned_propagates_closure_error. The test drives write_unaligned with a gather closure that returns an error and checks that write_unaligned surfaces it unchanged. Assisted-by: Claude:Opus-4.8 Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
This commit is contained in:
committed by
Rob Bradford
parent
9e441eb899
commit
30fdf384ec
@@ -484,4 +484,16 @@ mod tests {
|
||||
.unwrap_err();
|
||||
assert_eq!(err.kind(), io::ErrorKind::InvalidInput);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn write_unaligned_propagates_closure_error() {
|
||||
let file = pattern_file(8192);
|
||||
let aligned_file = forced(file.as_file().try_clone().unwrap(), 512);
|
||||
let err = aligned_file
|
||||
.write_unaligned(100, 200, |_| {
|
||||
Err(io::Error::new(io::ErrorKind::InvalidInput, "boom"))
|
||||
})
|
||||
.unwrap_err();
|
||||
assert_eq!(err.kind(), io::ErrorKind::InvalidInput);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user