Skip to content

Commit 1f7cd1b

Browse files
committed
uefi-raw: add ABI test for IpAddress
1 parent 0b7392c commit 1f7cd1b

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
@@ -387,14 +387,6 @@ mod tests {
387387
}
388388
}
389389

390-
/// Tests that all bytes are initialized and that the Debug print doesn't
391-
/// produce errors, when Miri executes this.
392-
#[test]
393-
fn test_ip_address_debug_memory_safe() {
394-
let uefi_addr = IpAddress::new_v6(TEST_IPV6);
395-
std::eprintln!("{uefi_addr:#?}");
396-
}
397-
398390
/// Tests the expected flow of types in a higher-level UEFI API.
399391
#[test]
400392
fn test_uefi_flow() {
@@ -435,4 +427,16 @@ mod tests {
435427
let expected = [42, 42, 42, 42, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 42, 42];
436428
assert_eq!(ipv6_addr.octets(), expected);
437429
}
430+
431+
#[test]
432+
fn test_efi_ip_address_abi() {
433+
#[repr(C, packed)]
434+
struct PackedHelper<T>(T);
435+
436+
assert_eq!(align_of::<IpAddress>(), 4);
437+
assert_eq!(size_of::<IpAddress>(), 16);
438+
439+
assert_eq!(align_of::<PackedHelper<IpAddress>>(), 1);
440+
assert_eq!(size_of::<PackedHelper<IpAddress>>(), 16);
441+
}
438442
}

0 commit comments

Comments
 (0)