From 8027adaf81ffa776d041cb18b90c1b250e70d9f1 Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Tue, 20 Nov 2018 00:49:38 +0800 Subject: [PATCH] esp32, mbedtls: check component name when enabling test flags Otherwise flags get enabled even when building tests for other components. --- components/esp32/CMakeLists.txt | 2 +- components/esp32/Makefile.projbuild | 2 +- components/mbedtls/CMakeLists.txt | 5 +++++ components/mbedtls/Makefile.projbuild | 2 +- 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/components/esp32/CMakeLists.txt b/components/esp32/CMakeLists.txt index 880278508..ae69d7575 100644 --- a/components/esp32/CMakeLists.txt +++ b/components/esp32/CMakeLists.txt @@ -158,7 +158,7 @@ else() endif() # Enable dynamic esp_timer overflow value if building unit tests - if(NOT "${BUILD_TEST_COMPONENTS}" EQUAL "") + if(esp32_test IN_LIST BUILD_TEST_COMPONENTS) add_definitions(-DESP_TIMER_DYNAMIC_OVERFLOW_VAL) endif() endif() diff --git a/components/esp32/Makefile.projbuild b/components/esp32/Makefile.projbuild index a17591ff0..5f819ae8a 100644 --- a/components/esp32/Makefile.projbuild +++ b/components/esp32/Makefile.projbuild @@ -39,7 +39,7 @@ CXXFLAGS+=-mfix-esp32-psram-cache-issue endif # Enable dynamic esp_timer overflow value if building unit tests -ifneq ("$(TEST_COMPONENTS_LIST)","") +ifneq ("$(filter esp32,$(TEST_COMPONENTS_LIST))","") CPPFLAGS += -DESP_TIMER_DYNAMIC_OVERFLOW_VAL endif ESP32_LINKER_SCRIPT_TEMPLATE := $(COMPONENT_PATH)/ld/esp32.common.ld.in diff --git a/components/mbedtls/CMakeLists.txt b/components/mbedtls/CMakeLists.txt index ab4185ede..cb8ba6085 100644 --- a/components/mbedtls/CMakeLists.txt +++ b/components/mbedtls/CMakeLists.txt @@ -94,3 +94,8 @@ register_component() target_compile_definitions(mbedtls PUBLIC -DMBEDTLS_CONFIG_FILE="mbedtls/esp_config.h" ) + +# Catch usage of deprecated mbedTLS functions when building tests +if(mbedtls_test IN_LIST BUILD_TEST_COMPONENTS) + add_definitions(-DMBEDTLS_DEPRECATED_WARNING) +endif() diff --git a/components/mbedtls/Makefile.projbuild b/components/mbedtls/Makefile.projbuild index cf49f9a1d..9bfba1693 100644 --- a/components/mbedtls/Makefile.projbuild +++ b/components/mbedtls/Makefile.projbuild @@ -3,6 +3,6 @@ CPPFLAGS += -DMBEDTLS_CONFIG_FILE='"mbedtls/esp_config.h"' # Catch usage of deprecated mbedTLS functions when building tests -ifneq ("$(TEST_COMPONENTS_LIST)","") +ifneq ("$(filter mbedtls,$(TEST_COMPONENTS_LIST))","") CPPFLAGS += -DMBEDTLS_DEPRECATED_WARNING endif