Skip to content

Commit 24d5443

Browse files
committed
uefi-raw: add ABI test for IpAddress
1 parent 291d701 commit 24d5443

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

uefi-raw/src/net.rs

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -382,14 +382,6 @@ mod tests {
382382
}
383383
}
384384

385-
/// Tests that all bytes are initialized and that the Debug print doesn't
386-
/// produce errors, when Miri executes this.
387-
#[test]
388-
fn test_ip_address_debug_memory_safe() {
389-
let uefi_addr = IpAddress::new_v6(TEST_IPV6);
390-
std::eprintln!("{uefi_addr:#?}");
391-
}
392-
393385
/// Tests the expected flow of types in a higher-level UEFI API.
394386
#[test]
395387
fn test_uefi_flow() {
@@ -430,4 +422,16 @@ mod tests {
430422
let expected = [42, 42, 42, 42, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 42, 42];
431423
assert_eq!(ipv6_addr.octets(), expected);
432424
}
425+
426+
#[test]
427+
fn test_efi_ip_address_abi() {
428+
#[repr(C, packed)]
429+
struct PackedHelper<T>(T);
430+
431+
assert_eq!(align_of::<IpAddress>(), 4);
432+
assert_eq!(size_of::<IpAddress>(), 16);
433+
434+
assert_eq!(align_of::<PackedHelper<IpAddress>>(), 1);
435+
assert_eq!(size_of::<PackedHelper<IpAddress>>(), 16);
436+
}
433437
}

0 commit comments

Comments
 (0)