[host,test] Fix broken test in host tools. When trying to test out a new change I found that this test was actually broken on master; it's a pretty straightforward fix. The test was assuming the identifier field is at the start of the manifest; filling in the identifier field's actual offset fixed the test. Signed-off-by: Jade Philipoom <jadep@google.com>
diff --git a/sw/host/rom_ext_image_tools/signer/image/src/image.rs b/sw/host/rom_ext_image_tools/signer/image/src/image.rs index 24e98d1..75c6771 100644 --- a/sw/host/rom_ext_image_tools/signer/image/src/image.rs +++ b/sw/host/rom_ext_image_tools/signer/image/src/image.rs
@@ -89,6 +89,7 @@ #[cfg(test)] mod tests { use super::*; + use memoffset::offset_of; #[test] fn test_set_manifest_field() -> Result<(), ImageError> { @@ -98,7 +99,10 @@ let identifier: u32 = 0x01020304; image.manifest.identifier = identifier; for i in 0..4 { - assert_eq!(manifest_buffer[i], identifier.to_le_bytes()[i]); + assert_eq!( + manifest_buffer[offset_of!(Manifest, identifier) + i], + identifier.to_le_bytes()[i] + ); } Ok(()) }