Depend on all test headers when building tests

There were explicit dependencies on header files for some test suites,
dating back from when only a few test suites depended on anything in
tests/include. The noted dependencies were still correct, but now that
tests/include is more populated, they were only the tip of the
iceberg. Just keep it simple and depend on all the headers.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
This commit is contained in:
Gilles Peskine 2021-01-20 19:47:23 +01:00
parent 2146211204
commit e1d51bd99d

View file

@ -84,7 +84,7 @@ MBEDTLS_TEST_OBJS=$(patsubst %.c,%.o,$(wildcard src/*.c src/drivers/*.c))
mbedtls_test: $(MBEDTLS_TEST_OBJS) mbedtls_test: $(MBEDTLS_TEST_OBJS)
TEST_OBJS_DEPS = TEST_OBJS_DEPS = $(wildcard include/test/*.h include/test/*/*.h)
ifdef RECORD_PSA_STATUS_COVERAGE_LOG ifdef RECORD_PSA_STATUS_COVERAGE_LOG
TEST_OBJS_DEPS += include/test/instrument_record_status.h TEST_OBJS_DEPS += include/test/instrument_record_status.h
endif endif
@ -130,12 +130,6 @@ $(BINARIES): %$(EXEXT): %.c $(MBEDLIBS) $(TEST_OBJS_DEPS) $(MBEDTLS_TEST_OBJS)
echo " CC $<" echo " CC $<"
$(CC) $(LOCAL_CFLAGS) $(CFLAGS) $< $(MBEDTLS_TEST_OBJS) $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ $(CC) $(LOCAL_CFLAGS) $(CFLAGS) $< $(MBEDTLS_TEST_OBJS) $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
# Some test suites require additional header files.
$(filter test_suite_psa_crypto%, $(BINARIES)): include/test/psa_crypto_helpers.h
$(addprefix embedded_,$(filter test_suite_psa_crypto%, $(APPS))): embedded_%: TESTS/mbedtls/%/psa_crypto_helpers.h
$(filter test_suite_psa_%, $(BINARIES)): include/test/psa_helpers.h
$(addprefix embedded_,$(filter test_suite_psa_%, $(APPS))): embedded_%: TESTS/mbedtls/%/psa_helpers.h
clean: clean:
ifndef WINDOWS ifndef WINDOWS
rm -rf $(BINARIES) *.c *.datax TESTS rm -rf $(BINARIES) *.c *.datax TESTS
@ -192,6 +186,7 @@ endif
endef endef
$(foreach app, $(APPS), $(foreach file, $(notdir $(wildcard include/test/*.h)), \ $(foreach app, $(APPS), $(foreach file, $(notdir $(wildcard include/test/*.h)), \
$(eval $(call copy_header_to_target,$(app),$(file))))) $(eval $(call copy_header_to_target,$(app),$(file)))))
$(addprefix embedded_,$(filter test_suite_psa_%, $(APPS))): embedded_%: $(patsubst TESTS/mbedtls/%, include/test/%, $(wildcard include/test/*. include/test/*/*.h))
ifdef RECORD_PSA_STATUS_COVERAGE_LOG ifdef RECORD_PSA_STATUS_COVERAGE_LOG
include/test/instrument_record_status.h: ../include/psa/crypto.h Makefile include/test/instrument_record_status.h: ../include/psa/crypto.h Makefile