Gaurav Shah | 322536d | 2010-01-28 15:01:23 -0800 | [diff] [blame] | 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 |
| 3 | # found in the LICENSE file. |
| 4 | |
Gaurav Shah | fc70d72 | 2010-03-31 13:26:55 -0700 | [diff] [blame] | 5 | INCLUDES += -I./include \ |
Randall Spangler | d183644 | 2010-06-10 09:59:04 -0700 | [diff] [blame] | 6 | -I$(FWDIR)/lib/include \ |
Randall Spangler | 3003c1d | 2010-05-27 09:20:11 -0700 | [diff] [blame] | 7 | -I$(FWDIR)/lib/cgptlib/include \ |
Bill Richardson | 0b8f35c | 2010-05-26 09:18:38 -0700 | [diff] [blame] | 8 | -I$(FWDIR)/lib/cryptolib/include \ |
Randall Spangler | 620c38c | 2010-06-17 14:45:22 -0700 | [diff] [blame] | 9 | -I$(HOSTDIR)/include |
vbendeb | 70e9509 | 2010-06-14 15:41:27 -0700 | [diff] [blame] | 10 | BUILD_ROOT = ${BUILD}/tests |
Gaurav Shah | e3ef9c9 | 2010-02-10 23:07:02 -0800 | [diff] [blame] | 11 | |
Randall Spangler | 620c38c | 2010-06-17 14:45:22 -0700 | [diff] [blame] | 12 | TEST_NAMES = cgptlib_test \ |
Luigi Semenzato | 416f681 | 2010-07-08 12:12:12 -0700 | [diff] [blame] | 13 | rsa_padding_test \ |
| 14 | rsa_verify_benchmark \ |
| 15 | sha_benchmark \ |
| 16 | sha_tests \ |
| 17 | vboot_common_tests \ |
| 18 | vboot_common2_tests \ |
| 19 | vboot_common3_tests \ |
| 20 | |
vbendeb | 70e9509 | 2010-06-14 15:41:27 -0700 | [diff] [blame] | 21 | TEST_BINS = $(addprefix ${BUILD_ROOT}/,$(TEST_NAMES)) |
vbendeb | cae179a | 2010-06-16 13:56:58 -0700 | [diff] [blame] | 22 | |
| 23 | TEST_LIB = ${BUILD_ROOT}/test.a |
| 24 | TEST_LIB_SRCS = rollback_index_mock.c test_common.c timer_utils.c crc32_test.c |
| 25 | TEST_LIB_OBJS = $(TEST_LIB_SRCS:%.c=${BUILD_ROOT}/%.o) |
| 26 | ALL_DEPS = $(addsuffix .d,${TEST_BINS} ${TEST_LIB_OBJS}) |
| 27 | CFLAGS += -MMD -MF $@.d |
| 28 | |
Randall Spangler | 620c38c | 2010-06-17 14:45:22 -0700 | [diff] [blame] | 29 | LIBS := ${TEST_LIB} $(HOSTLIB) $(FWLIB) |
vbendeb | cae179a | 2010-06-16 13:56:58 -0700 | [diff] [blame] | 30 | |
vbendeb | f7a45cc | 2010-06-21 08:44:16 -0700 | [diff] [blame] | 31 | ifneq (${RUNTESTS},) |
| 32 | EXTRA_TARGET = runtests |
| 33 | endif |
| 34 | |
Luigi Semenzato | 18b814d | 2010-07-08 17:17:02 -0700 | [diff] [blame^] | 35 | all: $(TEST_BINS) ${EXTRA_TARGET} |
| 36 | |
| 37 | rbtest: $(BUILD_ROOT)/rollback_index_test |
vbendeb | cae179a | 2010-06-16 13:56:58 -0700 | [diff] [blame] | 38 | |
| 39 | ${TEST_LIB}: ${TEST_LIB_OBJS} |
| 40 | rm -f $@ |
| 41 | ar qc $@ $^ |
| 42 | |
Luigi Semenzato | 416f681 | 2010-07-08 12:12:12 -0700 | [diff] [blame] | 43 | ${BUILD_ROOT}/rollback_index_test.o : rollback_index_test.c |
| 44 | $(CC) $(CFLAGS) -I/usr/include $(INCLUDES) -MMD -MF $@.d -c -o $@ $< |
| 45 | |
| 46 | ${BUILD_ROOT}/rollback_index_test: rollback_index_test.c ${HOSTLIB} ${FWLIB} |
| 47 | $(CC) $(CFLAGS) -I/usr/include $(INCLUDES) $< -o $@ \ |
| 48 | -ltlcl ${HOSTLIB} ${FWLIB} -lcrypto -lrt |
| 49 | |
vbendeb | cae179a | 2010-06-16 13:56:58 -0700 | [diff] [blame] | 50 | ${BUILD_ROOT}/%.o : %.c |
| 51 | $(CC) $(CFLAGS) $(INCLUDES) -MMD -MF $@.d -c -o $@ $< |
| 52 | |
| 53 | ${BUILD_ROOT}/%: %.c ${LIBS} |
| 54 | $(CC) $(CFLAGS) $(INCLUDES) $< ${LIBS} -o $@ -lcrypto -lrt |
Gaurav Shah | ed9c96a | 2010-03-30 18:56:07 -0700 | [diff] [blame] | 55 | |
Randall Spangler | 620c38c | 2010-06-17 14:45:22 -0700 | [diff] [blame] | 56 | # TODO: port these tests to new API, if not already eqivalent |
| 57 | # functionality in other tests |
| 58 | # |
Randall Spangler | d471f2a | 2010-06-16 12:05:10 -0700 | [diff] [blame] | 59 | # big_firmware_tests |
| 60 | # firmware_image_tests |
| 61 | # firmware_rollback_tests |
| 62 | # firmware_splicing_tests |
| 63 | # firmware_verify_benchmark |
| 64 | # verify_firmware_fuzz_driver |
Randall Spangler | 620c38c | 2010-06-17 14:45:22 -0700 | [diff] [blame] | 65 | # |
| 66 | # big_kernel_tests |
Luigi Semenzato | 416f681 | 2010-07-08 12:12:12 -0700 | [diff] [blame] | 67 | # kernel_image_tests |
| 68 | # kernel_rollback_tests |
| 69 | # kernel_splicing_tests |
| 70 | # kernel_verify_benchmark |
Randall Spangler | 620c38c | 2010-06-17 14:45:22 -0700 | [diff] [blame] | 71 | # verify_kernel_fuzz_driver |
Randall Spangler | d471f2a | 2010-06-16 12:05:10 -0700 | [diff] [blame] | 72 | |
Randall Spangler | 620c38c | 2010-06-17 14:45:22 -0700 | [diff] [blame] | 73 | # Generate test keys |
| 74 | genkeys: |
vbendeb | 70e9509 | 2010-06-14 15:41:27 -0700 | [diff] [blame] | 75 | ./gen_test_keys.sh |
Randall Spangler | 620c38c | 2010-06-17 14:45:22 -0700 | [diff] [blame] | 76 | |
| 77 | # Run cgpt tests |
| 78 | runcgpttests: |
vbendeb | 70e9509 | 2010-06-14 15:41:27 -0700 | [diff] [blame] | 79 | ${BUILD_ROOT}/cgptlib_test |
vbendeb | 70e9509 | 2010-06-14 15:41:27 -0700 | [diff] [blame] | 80 | ./run_cgpt_tests.sh ${BUILD}/cgpt/cgpt |
vbendeb | cae179a | 2010-06-16 13:56:58 -0700 | [diff] [blame] | 81 | |
Randall Spangler | 620c38c | 2010-06-17 14:45:22 -0700 | [diff] [blame] | 82 | # Run crypto tests |
| 83 | runcryptotests: |
| 84 | ./run_rsa_tests.sh |
| 85 | ${BUILD_ROOT}/sha_tests |
| 86 | ./run_vboot_common_tests.sh |
| 87 | |
| 88 | # Run other misc tests |
| 89 | runmisctests: |
| 90 | ./run_vbutil_tests.sh |
| 91 | |
| 92 | |
| 93 | runtests: genkeys runcgpttests runcryptotests runmisctests |
| 94 | |
| 95 | # TODO: tests to run when ported to new API |
| 96 | # ./run_image_verification_tests.sh |
| 97 | # # Splicing tests |
| 98 | # ${BUILD_ROOT}/firmware_splicing_tests |
| 99 | # ${BUILD_ROOT}/kernel_splicing_tests |
| 100 | # # Rollback Tests |
| 101 | # ${BUILD_ROOT}/firmware_rollback_tests |
| 102 | # ${BUILD_ROOT}/kernel_rollback_tests |
| 103 | |
Luigi Semenzato | 18b814d | 2010-07-08 17:17:02 -0700 | [diff] [blame^] | 104 | install-rbtest: $(BUILD_ROOT)/rollback_index_test |
| 105 | mkdir -p $(DESTDIR) |
| 106 | cp -f $(BUILD_ROOT)/rollback_index_test $(DESTDIR) |
Luigi Semenzato | 416f681 | 2010-07-08 12:12:12 -0700 | [diff] [blame] | 107 | |
Randall Spangler | 620c38c | 2010-06-17 14:45:22 -0700 | [diff] [blame] | 108 | -include ${ALL_DEPS} |