From 708d96279514344ea9b3cacec5b85c80b6fefec9 Mon Sep 17 00:00:00 2001 From: Bowgo Tsai Date: Mon, 25 Jan 2021 16:19:03 +0800 Subject: [PATCH] libfs_avb: Fix unit test failures There more output lines of `avbtool` now, adjusts the expected output of `avbtool info_image --image test.img` in the test cases. Bug: 178215452 Test: atest libfs_avb_test Test: atest libfs_avb_internal_test Change-Id: I924d6d97ef0a4c19c93017c2491bf251dfc51cae --- fs_mgr/libfs_avb/tests/avb_util_test.cpp | 12 ++++++++++++ fs_mgr/libfs_avb/tests/basic_test.cpp | 10 ++++++++++ fs_mgr/libfs_avb/tests/fs_avb_util_test.cpp | 2 ++ 3 files changed, 24 insertions(+) diff --git a/fs_mgr/libfs_avb/tests/avb_util_test.cpp b/fs_mgr/libfs_avb/tests/avb_util_test.cpp index 784eb9cf9..18275665c 100644 --- a/fs_mgr/libfs_avb/tests/avb_util_test.cpp +++ b/fs_mgr/libfs_avb/tests/avb_util_test.cpp @@ -216,9 +216,11 @@ TEST_F(AvbUtilTest, GetAvbFooter) { "Header Block: 256 bytes\n" "Authentication Block: 1088 bytes\n" "Auxiliary Block: 2304 bytes\n" + "Public key (sha1): 5227b569de003adc7f8ec3fc03e05dfbd969abad\n" "Algorithm: SHA512_RSA8192\n" "Rollback Index: 20\n" "Flags: 0\n" + "Rollback Index Location: 0\n" "Release String: 'unit test'\n" "Descriptors:\n" " Hashtree descriptor:\n" @@ -346,9 +348,11 @@ TEST_F(AvbUtilTest, GetVBMetaHeader) { "Header Block: 256 bytes\n" "Authentication Block: 576 bytes\n" "Auxiliary Block: 1216 bytes\n" + "Public key (sha1): 2597c218aae470a130f61162feaae70afd97f011\n" "Algorithm: SHA256_RSA4096\n" "Rollback Index: 10\n" "Flags: 0\n" + "Rollback Index Location: 0\n" "Release String: 'unit test'\n" "Descriptors:\n" " Hash descriptor:\n" @@ -639,9 +643,11 @@ TEST_F(AvbUtilTest, VerifyVBMetaDataWithoutFooter) { "Header Block: 256 bytes\n" "Authentication Block: 1088 bytes\n" "Auxiliary Block: 3840 bytes\n" + "Public key (sha1): 5227b569de003adc7f8ec3fc03e05dfbd969abad\n" "Algorithm: SHA256_RSA8192\n" "Rollback Index: 0\n" "Flags: 0\n" + "Rollback Index Location: 0\n" "Release String: 'unit test'\n" "Descriptors:\n" " Chain Partition descriptor:\n" @@ -854,9 +860,11 @@ TEST_F(AvbUtilTest, GetChainPartitionInfo) { "Header Block: 256 bytes\n" "Authentication Block: 1088 bytes\n" "Auxiliary Block: 3840 bytes\n" + "Public key (sha1): 5227b569de003adc7f8ec3fc03e05dfbd969abad\n" "Algorithm: SHA256_RSA8192\n" "Rollback Index: 0\n" "Flags: 0\n" + "Rollback Index Location: 0\n" "Release String: 'unit test'\n" "Descriptors:\n" " Chain Partition descriptor:\n" @@ -886,9 +894,11 @@ TEST_F(AvbUtilTest, GetChainPartitionInfo) { "Header Block: 256 bytes\n" "Authentication Block: 576 bytes\n" "Auxiliary Block: 2176 bytes\n" + "Public key (sha1): 2597c218aae470a130f61162feaae70afd97f011\n" "Algorithm: SHA256_RSA4096\n" "Rollback Index: 0\n" "Flags: 0\n" + "Rollback Index Location: 0\n" "Release String: 'unit test'\n" "Descriptors:\n" " Chain Partition descriptor:\n" @@ -936,9 +946,11 @@ TEST_F(AvbUtilTest, GetChainPartitionInfoNone) { "Header Block: 256 bytes\n" "Authentication Block: 320 bytes\n" "Auxiliary Block: 960 bytes\n" + "Public key (sha1): cdbb77177f731920bbe0a0f94f84d9038ae0617d\n" "Algorithm: SHA256_RSA2048\n" "Rollback Index: 0\n" "Flags: 0\n" + "Rollback Index Location: 0\n" "Release String: 'unit test'\n" "Descriptors:\n" " Hash descriptor:\n" diff --git a/fs_mgr/libfs_avb/tests/basic_test.cpp b/fs_mgr/libfs_avb/tests/basic_test.cpp index 5a1cd0dd8..1c47c0758 100644 --- a/fs_mgr/libfs_avb/tests/basic_test.cpp +++ b/fs_mgr/libfs_avb/tests/basic_test.cpp @@ -59,9 +59,11 @@ TEST_F(BaseFsAvbTest, GenerateVBMetaImage) { "Header Block: 256 bytes\n" "Authentication Block: 320 bytes\n" "Auxiliary Block: 576 bytes\n" + "Public key (sha1): cdbb77177f731920bbe0a0f94f84d9038ae0617d\n" "Algorithm: SHA256_RSA2048\n" "Rollback Index: 0\n" "Flags: 0\n" + "Rollback Index Location: 0\n" "Release String: 'unit test'\n" "Descriptors:\n" " (none)\n", @@ -89,9 +91,11 @@ TEST_F(BaseFsAvbTest, AddHashFooter) { "Header Block: 256 bytes\n" "Authentication Block: 576 bytes\n" "Auxiliary Block: 1216 bytes\n" + "Public key (sha1): 2597c218aae470a130f61162feaae70afd97f011\n" "Algorithm: SHA256_RSA4096\n" "Rollback Index: 10\n" "Flags: 0\n" + "Rollback Index Location: 0\n" "Release String: 'unit test'\n" "Descriptors:\n" " Hash descriptor:\n" @@ -126,9 +130,11 @@ TEST_F(BaseFsAvbTest, AddHashtreeFooter) { "Header Block: 256 bytes\n" "Authentication Block: 1088 bytes\n" "Auxiliary Block: 2304 bytes\n" + "Public key (sha1): 5227b569de003adc7f8ec3fc03e05dfbd969abad\n" "Algorithm: SHA512_RSA8192\n" "Rollback Index: 20\n" "Flags: 0\n" + "Rollback Index Location: 0\n" "Release String: 'unit test'\n" "Descriptors:\n" " Hashtree descriptor:\n" @@ -180,9 +186,11 @@ TEST_F(BaseFsAvbTest, GenerateVBMetaImageWithDescriptors) { "Header Block: 256 bytes\n" "Authentication Block: 320 bytes\n" "Auxiliary Block: 960 bytes\n" + "Public key (sha1): cdbb77177f731920bbe0a0f94f84d9038ae0617d\n" "Algorithm: SHA256_RSA2048\n" "Rollback Index: 0\n" "Flags: 0\n" + "Rollback Index Location: 0\n" "Release String: 'unit test'\n" "Descriptors:\n" " Hash descriptor:\n" @@ -249,9 +257,11 @@ TEST_F(BaseFsAvbTest, GenerateVBMetaImageWithChainDescriptors) { "Header Block: 256 bytes\n" "Authentication Block: 1088 bytes\n" "Auxiliary Block: 3840 bytes\n" + "Public key (sha1): 5227b569de003adc7f8ec3fc03e05dfbd969abad\n" "Algorithm: SHA256_RSA8192\n" "Rollback Index: 0\n" "Flags: 0\n" + "Rollback Index Location: 0\n" "Release String: 'unit test'\n" "Descriptors:\n" " Chain Partition descriptor:\n" diff --git a/fs_mgr/libfs_avb/tests/fs_avb_util_test.cpp b/fs_mgr/libfs_avb/tests/fs_avb_util_test.cpp index 7c340099e..5ec1e90eb 100644 --- a/fs_mgr/libfs_avb/tests/fs_avb_util_test.cpp +++ b/fs_mgr/libfs_avb/tests/fs_avb_util_test.cpp @@ -57,9 +57,11 @@ TEST_F(PublicFsAvbUtilTest, GetHashtreeDescriptor) { "Header Block: 256 bytes\n" "Authentication Block: 576 bytes\n" "Auxiliary Block: 1280 bytes\n" + "Public key (sha1): 2597c218aae470a130f61162feaae70afd97f011\n" "Algorithm: SHA512_RSA4096\n" "Rollback Index: 20\n" "Flags: 0\n" + "Rollback Index Location: 0\n" "Release String: 'unit test'\n" "Descriptors:\n" " Hashtree descriptor:\n"