OLD | NEW |
1 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 1 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 TOP ?= ../ | |
6 CC ?= gcc | |
7 CFLAGS ?= -Wall -DNDEBUG -O3 -Werror | |
8 INCLUDES += -I./include \ | 5 INCLUDES += -I./include \ |
9 -I$(FWDIR)/lib/include \ | 6 -I$(FWDIR)/lib/include \ |
10 -I$(FWDIR)/lib/cgptlib/include \ | 7 -I$(FWDIR)/lib/cgptlib/include \ |
11 -I$(FWDIR)/lib/cryptolib/include \ | 8 -I$(FWDIR)/lib/cryptolib/include \ |
12 -I../host/include \ | 9 -I../host/include \ |
13 -I../misclibs/include \ | 10 -I../misclibs/include \ |
14 -I../vboot_firmware/lib/include\ | 11 -I../vboot_firmware/lib/include\ |
15 -I../vfirmware/include\ | 12 -I../vfirmware/include\ |
16 -I../vkernel/include | 13 -I../vkernel/include |
17 IMAGE_LIBS = $(TOP)/vfirmware/firmware_image.o \ | 14 IMAGE_LIBS = $(BUILD)/vfirmware/firmware_image.o \ |
18 » » $(TOP)/vkernel/kernel_image.o | 15 » » $(BUILD)/vkernel/kernel_image.o |
19 UTIL_LIBS = $(TOP)/misclibs/file_keys.o $(TOP)/misclibs/signature_digest.o | 16 UTIL_LIBS = $(BUILD)/misclibs/file_keys.o $(BUILD)/misclibs/signature_digest.o |
20 LIBS = $(IMAGE_LIBS) $(UTIL_LIBS) $(HOSTLIB) $(FWLIB) -lcrypto | 17 LIBS = $(IMAGE_LIBS) $(UTIL_LIBS) $(HOSTLIB) $(FWLIB) -lcrypto |
| 18 BUILD_ROOT = ${BUILD}/tests |
21 | 19 |
22 TEST_BINS = big_firmware_tests \ | 20 TEST_NAMES = big_firmware_tests \ |
23 big_kernel_tests \ | 21 big_kernel_tests \ |
24 cgptlib_test \ | 22 cgptlib_test \ |
25 firmware_image_tests \ | 23 firmware_image_tests \ |
26 firmware_rollback_tests \ | 24 firmware_rollback_tests \ |
27 firmware_splicing_tests \ | 25 firmware_splicing_tests \ |
28 firmware_verify_benchmark \ | 26 firmware_verify_benchmark \ |
29 kernel_image_tests \ | 27 kernel_image_tests \ |
30 kernel_rollback_tests \ | 28 kernel_rollback_tests \ |
31 kernel_splicing_tests \ | 29 kernel_splicing_tests \ |
32 kernel_verify_benchmark \ | 30 kernel_verify_benchmark \ |
33 rsa_padding_test \ | 31 rsa_padding_test \ |
34 rsa_verify_benchmark \ | 32 rsa_verify_benchmark \ |
35 sha_benchmark \ | 33 sha_benchmark \ |
36 sha_tests \ | 34 sha_tests \ |
37 vboot_common_tests \ | 35 vboot_common_tests \ |
38 vboot_common2_tests \ | 36 vboot_common2_tests \ |
39 vboot_common3_tests \ | 37 vboot_common3_tests \ |
40 verify_firmware_fuzz_driver \ | 38 verify_firmware_fuzz_driver \ |
41 verify_kernel_fuzz_driver | 39 verify_kernel_fuzz_driver |
| 40 TEST_BINS = $(addprefix ${BUILD_ROOT}/,$(TEST_NAMES)) |
| 41 ALL_DEPS = $(addsuffix .d,${TEST_BINS}) |
42 | 42 |
43 all: $(TEST_BINS) | 43 ifneq (${RUNTESTS},) |
| 44 EXTRA_TARGET = runtests |
| 45 endif |
44 | 46 |
45 big_firmware_tests: big_firmware_tests.c rollback_index_mock.c test_common.c | 47 all: $(TEST_BINS) ${EXTRA_TARGET} |
| 48 |
| 49 ${BUILD_ROOT}/big_firmware_tests: big_firmware_tests.c \ |
| 50 » rollback_index_mock.c test_common.c |
46 $(CC) $(CFLAGS) $(INCLUDES) $^ -o $@ $(LIBS) | 51 $(CC) $(CFLAGS) $(INCLUDES) $^ -o $@ $(LIBS) |
47 | 52 |
48 big_kernel_tests: big_kernel_tests.c rollback_index_mock.c test_common.c | 53 ${BUILD_ROOT}/big_kernel_tests: big_kernel_tests.c rollback_index_mock.c \ |
49 » $(CC) $(CFLAGS) $(INCLUDES) $^ -o $@ $(LIBS) | |
50 | |
51 cgptlib_test: cgptlib_test.c crc32_test.c | |
52 » $(CC) $(CFLAGS) -ansi $(INCLUDES) $^ -o $@ $(LIBS) | |
53 | |
54 firmware_image_tests: firmware_image_tests.c rollback_index_mock.c test_common.c | |
55 » $(CC) $(CFLAGS) $(INCLUDES) $^ -o $@ $(LIBS) | |
56 | |
57 firmware_rollback_tests: firmware_rollback_tests.c rollback_index_mock.c \ | |
58 test_common.c | 54 test_common.c |
59 $(CC) $(CFLAGS) $(INCLUDES) $^ -o $@ $(LIBS) | 55 $(CC) $(CFLAGS) $(INCLUDES) $^ -o $@ $(LIBS) |
60 | 56 |
61 firmware_splicing_tests: firmware_splicing_tests.c rollback_index_mock.c \ | 57 ${BUILD_ROOT}/cgptlib_test: cgptlib_test.c crc32_test.c |
| 58 » $(CC) $(CFLAGS) -ansi $(INCLUDES) $^ -o $@ $(LIBS) |
| 59 |
| 60 ${BUILD_ROOT}/firmware_image_tests: firmware_image_tests.c \ |
| 61 » rollback_index_mock.c test_common.c |
| 62 » $(CC) $(CFLAGS) $(INCLUDES) $^ -o $@ $(LIBS) |
| 63 |
| 64 ${BUILD_ROOT}/firmware_rollback_tests: firmware_rollback_tests.c \ |
| 65 » rollback_index_mock.c test_common.c |
| 66 » $(CC) $(CFLAGS) $(INCLUDES) $^ -o $@ $(LIBS) |
| 67 |
| 68 ${BUILD_ROOT}/firmware_splicing_tests: firmware_splicing_tests.c \ |
| 69 » rollback_index_mock.c test_common.c |
| 70 » $(CC) $(CFLAGS) $(INCLUDES) $^ -o $@ $(LIBS) |
| 71 |
| 72 ${BUILD_ROOT}/firmware_verify_benchmark: firmware_verify_benchmark.c \ |
| 73 » timer_utils.c rollback_index_mock.c test_common.c |
| 74 » $(CC) $(CFLAGS) $(INCLUDES) $^ -o $@ -lrt $(LIBS) |
| 75 |
| 76 ${BUILD_ROOT}/kernel_image_tests: kernel_image_tests.c rollback_index_mock.c \ |
62 test_common.c | 77 test_common.c |
63 $(CC) $(CFLAGS) $(INCLUDES) $^ -o $@ $(LIBS) | 78 $(CC) $(CFLAGS) $(INCLUDES) $^ -o $@ $(LIBS) |
64 | 79 |
65 firmware_verify_benchmark: firmware_verify_benchmark.c timer_utils.c \ | 80 ${BUILD_ROOT}/kernel_rollback_tests: kernel_rollback_tests.c \ |
| 81 » rollback_index_mock.c test_common.c |
| 82 » $(CC) $(CFLAGS) $(INCLUDES) $^ -o $@ $(LIBS) |
| 83 |
| 84 ${BUILD_ROOT}/kernel_splicing_tests: kernel_splicing_tests.c \ |
| 85 » rollback_index_mock.c test_common.c |
| 86 » $(CC) $(CFLAGS) $(INCLUDES) $^ -o $@ $(LIBS) |
| 87 |
| 88 ${BUILD_ROOT}/kernel_verify_benchmark: kernel_verify_benchmark.c timer_utils.c \ |
66 rollback_index_mock.c test_common.c | 89 rollback_index_mock.c test_common.c |
67 $(CC) $(CFLAGS) $(INCLUDES) $^ -o $@ -lrt $(LIBS) | 90 $(CC) $(CFLAGS) $(INCLUDES) $^ -o $@ -lrt $(LIBS) |
68 | 91 |
69 kernel_image_tests: kernel_image_tests.c rollback_index_mock.c test_common.c | 92 ${BUILD_ROOT}/rsa_padding_test: rsa_padding_test.c |
70 » $(CC) $(CFLAGS) $(INCLUDES) $^ -o $@ $(LIBS) | |
71 | |
72 kernel_rollback_tests: kernel_rollback_tests.c rollback_index_mock.c \ | |
73 » test_common.c | |
74 » $(CC) $(CFLAGS) $(INCLUDES) $^ -o $@ $(LIBS) | |
75 | |
76 kernel_splicing_tests: kernel_splicing_tests.c rollback_index_mock.c \ | |
77 » test_common.c | |
78 » $(CC) $(CFLAGS) $(INCLUDES) $^ -o $@ $(LIBS) | |
79 | |
80 kernel_verify_benchmark: kernel_verify_benchmark.c timer_utils.c \ | |
81 » rollback_index_mock.c test_common.c | |
82 » $(CC) $(CFLAGS) $(INCLUDES) $^ -o $@ -lrt $(LIBS) | |
83 | |
84 rsa_padding_test: rsa_padding_test.c | |
85 $(CC) $(CFLAGS) $(INCLUDES) $^ -o $@ $(UTIL_LIBS) $(FWLIB) \ | 93 $(CC) $(CFLAGS) $(INCLUDES) $^ -o $@ $(UTIL_LIBS) $(FWLIB) \ |
86 -lcrypto | 94 -lcrypto |
87 | 95 |
88 rsa_verify_benchmark: rsa_verify_benchmark.c timer_utils.c | 96 ${BUILD_ROOT}/rsa_verify_benchmark: rsa_verify_benchmark.c timer_utils.c |
89 $(CC) $(CFLAGS) $(INCLUDES) $^ -o $@ -lrt $(UTIL_LIBS) $(FWLIB) \ | 97 $(CC) $(CFLAGS) $(INCLUDES) $^ -o $@ -lrt $(UTIL_LIBS) $(FWLIB) \ |
90 -lcrypto | 98 -lcrypto |
91 | 99 |
92 sha_benchmark:» sha_benchmark.c timer_utils.c | 100 ${BUILD_ROOT}/sha_benchmark:» sha_benchmark.c timer_utils.c |
93 $(CC) $(CFLAGS) $(INCLUDES) $^ -o $@ -lrt $(FWLIB) | 101 $(CC) $(CFLAGS) $(INCLUDES) $^ -o $@ -lrt $(FWLIB) |
94 | 102 |
95 sha_tests: sha_tests.c | 103 ${BUILD_ROOT}/sha_tests: sha_tests.c |
96 $(CC) $(CFLAGS) $(INCLUDES) $^ -o $@ $(FWLIB) | 104 $(CC) $(CFLAGS) $(INCLUDES) $^ -o $@ $(FWLIB) |
97 | 105 |
98 vboot_common_tests: vboot_common_tests.c rollback_index_mock.c test_common.c | 106 ${BUILD_ROOT}/vboot_common_tests: vboot_common_tests.c \ |
| 107 » rollback_index_mock.c test_common.c |
99 $(CC) $(CFLAGS) $(INCLUDES) $^ -o $@ $(LIBS) | 108 $(CC) $(CFLAGS) $(INCLUDES) $^ -o $@ $(LIBS) |
100 | 109 |
101 vboot_common2_tests: vboot_common2_tests.c test_common.c $(HOSTLIB) $(FWLIB) | 110 ${BUILD_ROOT}/vboot_common2_tests: vboot_common2_tests.c \ |
| 111 » test_common.c $(HOSTLIB) $(FWLIB) |
102 $(CC) $(CFLAGS) $(INCLUDES) $^ -o $@ $(LIBS) | 112 $(CC) $(CFLAGS) $(INCLUDES) $^ -o $@ $(LIBS) |
103 | 113 |
104 vboot_common3_tests: vboot_common3_tests.c test_common.c $(HOSTLIB) $(FWLIB) | 114 ${BUILD_ROOT}/vboot_common3_tests: vboot_common3_tests.c \ |
| 115 » test_common.c $(HOSTLIB) $(FWLIB) |
105 $(CC) $(CFLAGS) $(INCLUDES) $^ -o $@ $(LIBS) | 116 $(CC) $(CFLAGS) $(INCLUDES) $^ -o $@ $(LIBS) |
106 | 117 |
107 verify_firmware_fuzz_driver: verify_firmware_fuzz_driver.c \ | 118 ${BUILD_ROOT}/verify_firmware_fuzz_driver: verify_firmware_fuzz_driver.c \ |
108 rollback_index_mock.c | 119 rollback_index_mock.c |
109 $(CC) $(CFLAGS) $(INCLUDES) $^ -o $@ $(LIBS) | 120 $(CC) $(CFLAGS) $(INCLUDES) $^ -o $@ $(LIBS) |
110 | 121 |
111 verify_kernel_fuzz_driver: verify_kernel_fuzz_driver.c rollback_index_mock.c | 122 ${BUILD_ROOT}/verify_kernel_fuzz_driver: verify_kernel_fuzz_driver.c \ |
| 123 » rollback_index_mock.c |
112 $(CC) $(CFLAGS) $(INCLUDES) $^ -o $@ $(LIBS) | 124 $(CC) $(CFLAGS) $(INCLUDES) $^ -o $@ $(LIBS) |
113 | 125 |
114 runtests: | 126 runtests: |
| 127 ./gen_test_keys.sh |
115 # Crypto tests | 128 # Crypto tests |
116 ./run_rsa_tests.sh | 129 ./run_rsa_tests.sh |
117 » ./sha_tests | 130 » ${BUILD_ROOT}/sha_tests |
118 ./run_vbutil_tests.sh | 131 ./run_vbutil_tests.sh |
119 ./run_vboot_common_tests.sh | 132 ./run_vboot_common_tests.sh |
120 ./run_image_verification_tests.sh | 133 ./run_image_verification_tests.sh |
121 # Splicing tests | 134 # Splicing tests |
122 » ./firmware_splicing_tests | 135 » ${BUILD_ROOT}/firmware_splicing_tests |
123 » ./kernel_splicing_tests» | 136 » ${BUILD_ROOT}/kernel_splicing_tests |
124 # Rollback Tests | 137 # Rollback Tests |
125 » ./firmware_rollback_tests | 138 » ${BUILD_ROOT}/firmware_rollback_tests |
126 » ./kernel_rollback_tests | 139 » ${BUILD_ROOT}/kernel_rollback_tests |
127 # Helper Library Tests | 140 # Helper Library Tests |
128 » ./cgptlib_test | 141 » ${BUILD_ROOT}/cgptlib_test |
129 # Tool tests | 142 # Tool tests |
130 » ./run_cgpt_tests.sh | 143 » ./run_cgpt_tests.sh ${BUILD}/cgpt/cgpt |
131 | |
132 clean: | |
133 » rm -f $(TEST_BINS) | |
134 » rm -f testkeys/*.vbpubk | |
135 » rm -f testkeys/*.keyblock | |
OLD | NEW |