summaryrefslogtreecommitdiff
path: root/tests/mock
diff options
context:
space:
mode:
authorJakub Czapiga <jacz@semihalf.com>2021-07-27 17:04:11 +0200
committerJulius Werner <jwerner@chromium.org>2021-09-14 23:35:38 +0000
commitb20aa094cc3e83abd106c5e7ef93ed6cde3e7cd7 (patch)
tree5a80e3b33a5f3ff4763a9d93b07862b3b912e513 /tests/mock
parent4095291808b04544346432ca675e6fbfbb7ed11c (diff)
tests: Add lib/cbfs-lookup-test test case
Signed-off-by: Jakub Czapiga <jacz@semihalf.com> Change-Id: I2ebebba1468c19661741de8a8456605b1c5f56b6 Reviewed-on: https://review.coreboot.org/c/coreboot/+/56813 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Julius Werner <jwerner@chromium.org>
Diffstat (limited to 'tests/mock')
-rw-r--r--tests/mock/cbfs_file_mock.c57
1 files changed, 54 insertions, 3 deletions
diff --git a/tests/mock/cbfs_file_mock.c b/tests/mock/cbfs_file_mock.c
index a4feb618f7..2be89b06b3 100644
--- a/tests/mock/cbfs_file_mock.c
+++ b/tests/mock/cbfs_file_mock.c
@@ -6,9 +6,9 @@ TEST_REGION(cbfs_cache, TEST_CBFS_CACHE_SIZE);
const u8 test_data_1[TEST_DATA_1_SIZE] = { TEST_DATA_1 };
const u8 test_data_2[TEST_DATA_2_SIZE] = { TEST_DATA_2 };
-const u8 test_data_int_1[TEST_DATA_INT_1_SIZE] = { BE64(TEST_DATA_INT_1) };
-const u8 test_data_int_2[TEST_DATA_INT_2_SIZE] = { BE64(TEST_DATA_INT_2) };
-const u8 test_data_int_3[TEST_DATA_INT_3_SIZE] = { BE64(TEST_DATA_INT_3) };
+const u8 test_data_int_1[TEST_DATA_INT_1_SIZE] = { LE64(TEST_DATA_INT_1) };
+const u8 test_data_int_2[TEST_DATA_INT_2_SIZE] = { LE64(TEST_DATA_INT_2) };
+const u8 test_data_int_3[TEST_DATA_INT_3_SIZE] = { LE64(TEST_DATA_INT_3) };
const u8 good_hash[VB2_SHA256_DIGEST_SIZE] = { TEST_SHA256 };
const u8 bad_hash[VB2_SHA256_DIGEST_SIZE] = { INVALID_SHA256 };
@@ -44,3 +44,54 @@ const struct cbfs_test_file file_broken_hash = {
TEST_DATA_1,
},
};
+
+
+const struct cbfs_test_file test_file_1 = {
+ .header = HEADER_INITIALIZER(CBFS_TYPE_RAW, 0, TEST_DATA_1_SIZE),
+ .filename = TEST_DATA_1_FILENAME,
+ .attrs_and_data = {
+ TEST_DATA_1,
+ },
+};
+
+const struct cbfs_test_file test_file_2 = {
+ .header = HEADER_INITIALIZER(CBFS_TYPE_RAW, sizeof(struct cbfs_file_attr_compression),
+ TEST_DATA_2_SIZE),
+ .filename = TEST_DATA_2_FILENAME,
+ .attrs_and_data = {
+ BE32(CBFS_FILE_ATTR_TAG_COMPRESSION),
+ BE32(sizeof(struct cbfs_file_attr_compression)),
+ BE32(CBFS_COMPRESS_LZMA),
+ BE32(TEST_DATA_2_SIZE),
+ TEST_DATA_2,
+ },
+};
+
+const struct cbfs_test_file test_file_int_1 = {
+ .header = HEADER_INITIALIZER(CBFS_TYPE_RAW, 0, TEST_DATA_INT_1_SIZE),
+ .filename = TEST_DATA_INT_1_FILENAME,
+ .attrs_and_data = {
+ LE64(TEST_DATA_INT_1),
+ },
+};
+
+const struct cbfs_test_file test_file_int_2 = {
+ .header = HEADER_INITIALIZER(CBFS_TYPE_RAW, 0, TEST_DATA_INT_2_SIZE),
+ .filename = TEST_DATA_INT_2_FILENAME,
+ .attrs_and_data = {
+ LE64(TEST_DATA_INT_2),
+ },
+};
+
+const struct cbfs_test_file test_file_int_3 = {
+ .header = HEADER_INITIALIZER(CBFS_TYPE_RAW, sizeof(struct cbfs_file_attr_compression),
+ TEST_DATA_INT_3_SIZE),
+ .filename = TEST_DATA_INT_3_FILENAME,
+ .attrs_and_data = {
+ BE32(CBFS_FILE_ATTR_TAG_COMPRESSION),
+ BE32(sizeof(struct cbfs_file_attr_compression)),
+ BE32(CBFS_COMPRESS_LZ4),
+ BE32(TEST_DATA_INT_3_SIZE),
+ LE64(TEST_DATA_INT_3),
+ },
+};