MCPcopy Create free account
hub / github.com/Dstack-TEE/dstack / boot_option_round_trip_sample

Function boot_option_round_trip_sample

dstack-mr/src/uefi_var.rs:107–118  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

105
106 #[test]
107 fn boot_option_round_trip_sample() {
108 // Trivial sanity check: a load option with one MEDIA_FV_FILE node and
109 // an empty description should serialise to a 4 (Attrs) + 2 (FpLen) +
110 // 2 (NUL) + (4 + 16) (FV_FILE) + 4 (END) = 32 byte blob, and
111 // round-tripping the descriptive string survives.
112 let blob = boot_option_bytes(1, "", &[fv_file_node(&[0; 16]), END_OF_DEVICE_PATH], &[]);
113 assert_eq!(blob.len(), 4 + 2 + 2 + 20 + 4);
114 assert_eq!(&blob[0..4], &[0x01, 0x00, 0x00, 0x00]);
115 assert_eq!(&blob[4..6], &[0x18, 0x00]); // FilePathListLength = 24
116 // Description is just a NUL terminator (two bytes of 0).
117 assert_eq!(&blob[6..8], &[0x00, 0x00]);
118 }
119
120 #[test]
121 fn boot_order_encodes_u16_le_entries() {

Callers

nothing calls this directly

Calls 2

boot_option_bytesFunction · 0.85
fv_file_nodeFunction · 0.85

Tested by

no test coverage detected