Skip to content

Commit acb5d11

Browse files
committed
uefi-raw: add ABI test for IpAddress
1 parent 4e98e9e commit acb5d11

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
@@ -390,14 +390,6 @@ mod tests {
390390
}
391391
}
392392

393-
/// Tests that all bytes are initialized and that the Debug print doesn't
394-
/// produce errors, when Miri executes this.
395-
#[test]
396-
fn test_ip_address_debug_memory_safe() {
397-
let uefi_addr = IpAddress::new_v6(TEST_IPV6);
398-
std::eprintln!("{uefi_addr:#?}");
399-
}
400-
401393
/// Tests the expected flow of types in a higher-level UEFI API.
402394
#[test]
403395
fn test_uefi_flow() {
@@ -438,4 +430,16 @@ mod tests {
438430
let expected = [42, 42, 42, 42, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 42, 42];
439431
assert_eq!(ipv6_addr.octets(), expected);
440432
}
433+
434+
#[test]
435+
fn test_efi_ip_address_abi() {
436+
#[repr(C, packed)]
437+
struct PackedHelper<T>(T);
438+
439+
assert_eq!(align_of::<IpAddress>(), 4);
440+
assert_eq!(size_of::<IpAddress>(), 16);
441+
442+
assert_eq!(align_of::<PackedHelper<IpAddress>>(), 1);
443+
assert_eq!(size_of::<PackedHelper<IpAddress>>(), 16);
444+
}
441445
}

0 commit comments

Comments
 (0)