xref: /aosp_15_r20/external/coreboot/tests/lib/Makefile.mk (revision b9411a12aaaa7e1e6a6fb7c5e057f44ee179a49c)
1# SPDX-License-Identifier: GPL-2.0-only
2
3tests-y += lib-test
4tests-y += string-test
5tests-y += b64_decode-test
6tests-y += hexstrtobin-test
7tests-y += imd-test
8tests-y += timestamp-test
9tests-y += edid-test
10tests-y += cbmem_console-romstage-test
11tests-y += cbmem_console-ramstage-test
12tests-y += fmap-test
13tests-y += imd_cbmem-romstage-test
14tests-y += imd_cbmem-ramstage-test
15tests-y += region_file-test
16tests-y += stack-test
17tests-y += memset-test
18tests-y += memcmp-test
19tests-y += memchr-test
20tests-y += memcpy-test
21tests-y += malloc-test
22tests-y += memmove-test
23tests-y += crc_byte-test
24tests-y += memrange-test
25tests-y += uuid-test
26tests-y += bootmem-test
27tests-y += dimm_info_util-test
28tests-y += coreboot_table-test
29tests-y += rtc-test
30tests-y += spd_cache-ddr3-test
31tests-y += spd_cache-ddr4-test
32tests-y += cbmem_stage_cache-test
33tests-y += libgcc-test
34tests-y += cbfs-verification-no-sha512-test
35tests-y += cbfs-verification-has-sha512-test
36tests-y += cbfs-no-verification-no-sha512-test
37tests-y += cbfs-no-verification-has-sha512-test
38tests-y += cbfs-lookup-no-mcache-test
39tests-y += cbfs-lookup-has-mcache-test
40tests-y += lzma-test
41tests-y += ux_locales-test
42
43lib-test-srcs += tests/lib/lib-test.c
44
45string-test-srcs += tests/lib/string-test.c
46string-test-srcs += src/lib/string.c
47
48b64_decode-test-srcs += tests/lib/b64_decode-test.c
49b64_decode-test-srcs += tests/stubs/console.c
50b64_decode-test-srcs += src/lib/b64_decode.c
51
52hexstrtobin-test-srcs += tests/lib/hexstrtobin-test.c
53hexstrtobin-test-srcs += src/lib/hexstrtobin.c
54
55imd-test-srcs += tests/lib/imd-test.c
56imd-test-srcs += tests/stubs/console.c
57imd-test-srcs += src/lib/imd.c
58
59timestamp-test-srcs += tests/lib/timestamp-test.c
60timestamp-test-srcs += tests/stubs/timestamp.c
61timestamp-test-srcs += tests/stubs/console.c
62timestamp-test-stage := romstage
63
64edid-test-srcs += tests/lib/edid-test.c
65edid-test-srcs += src/lib/edid.c
66edid-test-srcs += tests/stubs/console.c
67
68cbmem_console-romstage-test-stage := romstage
69cbmem_console-romstage-test-srcs += tests/lib/cbmem_console-test.c
70cbmem_console-romstage-test-srcs += tests/stubs/console.c
71
72cbmem_console-ramstage-test-stage := ramstage
73cbmem_console-ramstage-test-srcs += tests/lib/cbmem_console-test.c
74cbmem_console-ramstage-test-srcs += tests/stubs/console.c
75
76fmap-test-srcs += tests/lib/fmap-test.c
77fmap-test-srcs += src/lib/fmap.c
78fmap-test-srcs += tests/stubs/console.c
79fmap-test-srcs += src/lib/boot_device.c
80fmap-test-srcs += src/commonlib/region.c
81fmap-test-cflags += -I tests/include/tests/lib/fmap
82
83imd_cbmem-ramstage-test-stage := ramstage
84imd_cbmem-ramstage-test-srcs += tests/lib/imd_cbmem-test.c
85imd_cbmem-ramstage-test-srcs += tests/stubs/console.c
86imd_cbmem-ramstage-test-srcs += src/lib/imd.c
87imd_cbmem-ramstage-test-mocks += cbmem_top_chipset
88
89imd_cbmem-romstage-test-stage := romstage
90imd_cbmem-romstage-test-srcs += tests/lib/imd_cbmem-test.c
91imd_cbmem-romstage-test-srcs += tests/stubs/console.c
92imd_cbmem-romstage-test-srcs += src/lib/imd.c
93imd_cbmem-romstage-test-mocks += cbmem_top_chipset
94
95region_file-test-srcs += tests/lib/region_file-test.c
96region_file-test-srcs += src/commonlib/region.c
97region_file-test-srcs += tests/stubs/console.c
98
99stack-test-srcs += tests/lib/stack-test.c
100stack-test-srcs += src/lib/stack.c
101stack-test-srcs += tests/stubs/console.c
102
103memset-test-srcs += tests/lib/memset-test.c
104memset-test-srcs += src/lib/memset.c
105
106memcmp-test-srcs += tests/lib/memcmp-test.c
107
108memchr-test-srcs += tests/lib/memchr-test.c
109memchr-test-srcs += src/lib/memchr.c
110
111memcpy-test-srcs += tests/lib/memcpy-test.c
112
113malloc-test-srcs += tests/lib/malloc-test.c
114malloc-test-srcs += tests/stubs/console.c
115
116memmove-test-srcs += tests/lib/memmove-test.c
117
118crc_byte-test-srcs += tests/lib/crc_byte-test.c
119crc_byte-test-srcs += src/lib/crc_byte.c
120
121memrange-test-srcs += tests/lib/memrange-test.c
122memrange-test-srcs += src/lib/memrange.c
123memrange-test-srcs += tests/stubs/console.c
124memrange-test-srcs += src/device/device_util.c
125
126uuid-test-srcs += tests/lib/uuid-test.c
127uuid-test-srcs += src/lib/hexstrtobin.c
128uuid-test-srcs += src/lib/uuid.c
129
130bootmem-test-srcs += tests/lib/bootmem-test.c
131bootmem-test-srcs += tests/stubs/console.c
132bootmem-test-srcs += src/device/device_util.c
133bootmem-test-srcs += src/lib/bootmem.c
134bootmem-test-srcs += src/lib/memrange.c
135
136dimm_info_util-test-srcs += tests/lib/dimm_info_util-test.c
137dimm_info_util-test-srcs += src/device/dram/spd.c
138dimm_info_util-test-srcs += src/lib/dimm_info_util.c
139dimm_info_util-test-srcs += tests/stubs/console.c
140
141coreboot_table-test-srcs += tests/lib/coreboot_table-test.c
142coreboot_table-test-srcs += tests/stubs/console.c
143coreboot_table-test-srcs += src/commonlib/bsd/ipchksum.c
144coreboot_table-test-srcs += src/lib/coreboot_table.c
145coreboot_table-test-srcs += src/lib/imd_cbmem.c
146coreboot_table-test-srcs += src/lib/imd.c
147coreboot_table-test-cflags += -I tests/include/tests/lib/fmap
148coreboot_table-test-mocks += cbmem_top_chipset
149
150rtc-test-srcs += tests/lib/rtc-test.c
151rtc-test-srcs += src/lib/rtc.c
152
153spd_cache-ddr3-test-srcs += tests/lib/spd_cache-test.c
154spd_cache-ddr3-test-srcs += tests/stubs/console.c
155spd_cache-ddr3-test-srcs += src/lib/spd_cache.c
156spd_cache-ddr3-test-srcs += src/lib/crc_byte.c
157spd_cache-ddr3-test-srcs += src/commonlib/region.c
158spd_cache-ddr3-test-mocks += fmap_locate_area_as_rdev
159spd_cache-ddr3-test-config += CONFIG_SPD_CACHE_FMAP_NAME=\"RW_SPD_CACHE\" \
160				CONFIG_DIMM_MAX=4 CONFIG_DIMM_SPD_SIZE=256 \
161				CONFIG_BOOT_DEVICE_MEMORY_MAPPED=1
162spd_cache-ddr3-test-cflags += -D__TEST_SPD_CACHE_DDR=3
163
164spd_cache-ddr4-test-srcs += tests/lib/spd_cache-test.c
165spd_cache-ddr4-test-srcs += tests/stubs/console.c
166spd_cache-ddr4-test-srcs += src/lib/spd_cache.c
167spd_cache-ddr4-test-srcs += src/lib/crc_byte.c
168spd_cache-ddr4-test-srcs += src/commonlib/region.c
169spd_cache-ddr4-test-mocks += fmap_locate_area_as_rdev
170spd_cache-ddr4-test-config += CONFIG_SPD_CACHE_FMAP_NAME=\"RW_SPD_CACHE\" \
171				CONFIG_DIMM_MAX=4 CONFIG_DIMM_SPD_SIZE=512 \
172				CONFIG_BOOT_DEVICE_MEMORY_MAPPED=1
173spd_cache-ddr4-test-cflags += -D__TEST_SPD_CACHE_DDR=4
174
175cbmem_stage_cache-test-srcs += tests/lib/cbmem_stage_cache-test.c
176cbmem_stage_cache-test-srcs += tests/stubs/console.c
177cbmem_stage_cache-test-srcs += src/lib/cbmem_stage_cache.c
178cbmem_stage_cache-test-srcs += src/lib/imd_cbmem.c
179cbmem_stage_cache-test-srcs += src/lib/imd.c
180cbmem_stage_cache-test-config += CONFIG_CBMEM_STAGE_CACHE=1
181
182libgcc-test-srcs += tests/lib/libgcc-test.c
183
184# CBFS varification tests are compiled with CONFIG_CBFS_VERIFICATION
185# and VB2_SUPPORT_SHA512 set and unset. Code should work with and without
186# verification and with hash structure of different sizes.
187cbfs-verification-no-sha512-test-stage := bootblock
188cbfs-verification-no-sha512-test-srcs := tests/lib/cbfs-verification-test.c \
189					tests/stubs/console.c \
190					tests/stubs/die.c \
191					tests/mock/cbfs_file_mock.c \
192					src/lib/cbfs.c \
193					src/commonlib/bsd/cbfs_private.c \
194					src/commonlib/mem_pool.c \
195					src/commonlib/region.c
196cbfs-verification-no-sha512-test-mocks += cbfs_get_boot_device cbfs_lookup
197cbfs-verification-no-sha512-test-config += CONFIG_COLLECT_TIMESTAMPS=0 \
198					CONFIG_CBFS_VERIFICATION=1 \
199					CONFIG_NO_CBFS_MCACHE=1 \
200					VB2_SUPPORT_SHA512=0
201
202$(call copy-test,cbfs-verification-no-sha512-test,cbfs-verification-has-sha512-test)
203cbfs-verification-has-sha512-test-config += VB2_SUPPORT_SHA512=1
204
205$(call copy-test,cbfs-verification-no-sha512-test,cbfs-no-verification-no-sha512-test)
206cbfs-no-verification-no-sha512-test-config += CONFIG_CBFS_VERIFICATION=0
207
208$(call copy-test,cbfs-verification-no-sha512-test,cbfs-no-verification-has-sha512-test)
209cbfs-no-verification-has-sha512-test-config += CONFIG_CBFS_VERIFICATION=0 \
210						VB2_SUPPORT_SHA512=1
211
212cbfs-lookup-no-mcache-test-srcs = tests/lib/cbfs-lookup-test.c \
213				tests/stubs/console.c \
214				tests/stubs/die.c \
215				tests/mock/cbfs_file_mock.c \
216				src/lib/cbfs.c \
217				src/commonlib/bsd/cbfs_private.c \
218				src/commonlib/bsd/cbfs_mcache.c \
219				src/commonlib/mem_pool.c \
220				src/commonlib/region.c
221cbfs-lookup-no-mcache-test-mocks += cbfs_get_boot_device \
222					cbfs_lookup \
223					cbfs_mcache_lookup \
224					mem_pool_alloc \
225					mem_pool_free
226cbfs-lookup-no-mcache-test-config += CONFIG_ARCH_X86=0 \
227				CONFIG_COLLECT_TIMESTAMPS=0 \
228				CONFIG_NO_CBFS_MCACHE=1
229
230$(call copy-test,cbfs-lookup-no-mcache-test,cbfs-lookup-has-mcache-test)
231cbfs-lookup-has-mcache-test-config += CONFIG_NO_CBFS_MCACHE=0
232
233lzma-test-srcs += tests/lib/lzma-test.c
234lzma-test-srcs += tests/stubs/console.c
235lzma-test-srcs += src/lib/lzma.c
236lzma-test-srcs += src/lib/lzmadecode.c
237lzma-test-syssrcs += tests/helpers/file.c
238
239ux_locales-test-srcs += tests/lib/ux_locales-test.c
240ux_locales-test-srcs += tests/stubs/console.c
241ux_locales-test-srcs += src/lib/ux_locales.c
242ux_locales-test-mocks += _cbfs_alloc \
243			cbfs_unmap \
244			vb2api_get_locale_id \
245			vboot_get_context
246ux_locales-test-config += CONFIG_VBOOT=1
247