tests: Add lib/spd_cache-test test case

Signed-off-by: Jakub Czapiga <jacz@semihalf.com>
Change-Id: Ic9a1420e49e1e80d180117c931e630e54c90cd75
Reviewed-on: https://review.coreboot.org/c/coreboot/+/52938
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Paul Fagerburg <pfagerburg@chromium.org>
diff --git a/tests/lib/Makefile.inc b/tests/lib/Makefile.inc
index c76870b..0792776 100644
--- a/tests/lib/Makefile.inc
+++ b/tests/lib/Makefile.inc
@@ -28,6 +28,8 @@
 tests-y += dimm_info_util-test
 tests-y += coreboot_table-test
 tests-y += rtc-test
+tests-y += spd_cache-ddr3-test
+tests-y += spd_cache-ddr4-test
 
 string-test-srcs += tests/lib/string-test.c
 string-test-srcs += src/lib/string.c
@@ -144,3 +146,24 @@
 rtc-test-srcs += tests/lib/rtc-test.c
 rtc-test-srcs += src/lib/rtc.c
 
+spd_cache-ddr3-test-srcs += tests/lib/spd_cache-test.c
+spd_cache-ddr3-test-srcs += tests/stubs/console.c
+spd_cache-ddr3-test-srcs += src/lib/spd_cache.c
+spd_cache-ddr3-test-srcs += src/lib/crc_byte.c
+spd_cache-ddr3-test-srcs += src/commonlib/region.c
+spd_cache-ddr3-test-mocks += fmap_locate_area_as_rdev
+spd_cache-ddr3-test-config += CONFIG_SPD_CACHE_FMAP_NAME=\"RW_SPD_CACHE\" \
+				CONFIG_DIMM_MAX=4 CONFIG_DIMM_SPD_SIZE=256 \
+				CONFIG_BOOT_DEVICE_MEMORY_MAPPED=1
+spd_cache-ddr3-test-cflags += -D__TEST_SPD_CACHE_DDR=3
+
+spd_cache-ddr4-test-srcs += tests/lib/spd_cache-test.c
+spd_cache-ddr4-test-srcs += tests/stubs/console.c
+spd_cache-ddr4-test-srcs += src/lib/spd_cache.c
+spd_cache-ddr4-test-srcs += src/lib/crc_byte.c
+spd_cache-ddr4-test-srcs += src/commonlib/region.c
+spd_cache-ddr4-test-mocks += fmap_locate_area_as_rdev
+spd_cache-ddr4-test-config += CONFIG_SPD_CACHE_FMAP_NAME=\"RW_SPD_CACHE\" \
+				CONFIG_DIMM_MAX=4 CONFIG_DIMM_SPD_SIZE=512 \
+				CONFIG_BOOT_DEVICE_MEMORY_MAPPED=1
+spd_cache-ddr4-test-cflags += -D__TEST_SPD_CACHE_DDR=4