From bec14ad8eeadafee0ec08627eafa80307918aae0 Mon Sep 17 00:00:00 2001 From: Konstantin Kondrashov Date: Thu, 28 Jun 2018 14:54:15 +0500 Subject: [PATCH] build: Add TEST_EXCLUDE_COMPONENTS To exclude during the build process of unit tests some components. --- docs/en/api-guides/build-system.rst | 1 + docs/en/api-guides/unit-tests.rst | 1 + make/project.mk | 11 ++++++----- tools/unit-test-app/Makefile | 2 ++ 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/docs/en/api-guides/build-system.rst b/docs/en/api-guides/build-system.rst index e638a36d0..61680b4e1 100644 --- a/docs/en/api-guides/build-system.rst +++ b/docs/en/api-guides/build-system.rst @@ -124,6 +124,7 @@ These variables all have default values that can be overridden for custom behavi - ``EXTRA_COMPONENT_DIRS``: Optional list of additional directories to search for components. - ``COMPONENTS``: A list of component names to build into the project. Defaults to all components found in the COMPONENT_DIRS directories. - ``EXCLUDE_COMPONENTS``: Optional list of component names to exclude during the build process. Note that this decreases build time, but not binary size. +- ``TEST_EXCLUDE_COMPONENTS``: Optional list of component names to exclude during the build process of unit tests. Any paths in these Makefile variables should be absolute paths. You can convert relative paths using ``$(PROJECT_PATH)/xxx``, ``$(IDF_PATH)/xxx``, or use the Make function ``$(abspath xxx)``. diff --git a/docs/en/api-guides/unit-tests.rst b/docs/en/api-guides/unit-tests.rst index b6b1ff342..b9cfaa39d 100644 --- a/docs/en/api-guides/unit-tests.rst +++ b/docs/en/api-guides/unit-tests.rst @@ -120,6 +120,7 @@ Change into tools/unit-test-app directory to configure and build it: * `make TESTS_ALL=1` - build unit test app with tests for each component having tests in the ``test`` subdirectory. * `make TEST_COMPONENTS='xxx'` - build unit test app with tests for specific components. +* `make TESTS_ALL=1 TEST_EXCLUDE_COMPONENTS='xxx'` - build unit test app with all unit tests, except for unit tests of some components. (For instance: `make TESTS_ALL=1 TEST_EXCLUDE_COMPONENTS='ulp mbedtls'` - build all unit tests exludes ulp and mbedtls components). When the build finishes, it will print instructions for flashing the chip. You can simply run ``make flash`` to flash all build output. diff --git a/make/project.mk b/make/project.mk index 10556b191..bf8494672 100644 --- a/make/project.mk +++ b/make/project.mk @@ -168,12 +168,13 @@ COMPONENT_PATHS := $(foreach comp,$(COMPONENTS),$(firstword $(foreach cd,$(COMPO export COMPONENT_PATHS TEST_COMPONENTS ?= +TEST_EXCLUDE_COMPONENTS ?= TESTS_ALL ?= # If TESTS_ALL set to 1, set TEST_COMPONENTS_LIST to all components. # Otherwise, use the list supplied in TEST_COMPONENTS. ifeq ($(TESTS_ALL),1) -TEST_COMPONENTS_LIST := $(COMPONENTS) +TEST_COMPONENTS_LIST := $(filter-out $(TEST_EXCLUDE_COMPONENTS), $(COMPONENTS)) else TEST_COMPONENTS_LIST := $(TEST_COMPONENTS) endif @@ -534,11 +535,11 @@ list-components: $(info COMPONENT_DIRS (components searched for here)) $(foreach cd,$(COMPONENT_DIRS),$(info $(cd))) $(info $(call dequote,$(SEPARATOR))) - $(info COMPONENTS (list of component names)) - $(info $(COMPONENTS)) + $(info TEST_COMPONENTS (list of test component names)) + $(info $(TEST_COMPONENTS_LIST)) $(info $(call dequote,$(SEPARATOR))) - $(info EXCLUDE_COMPONENTS (list of excluded names)) - $(info $(if $(EXCLUDE_COMPONENTS),$(EXCLUDE_COMPONENTS),(none provided))) + $(info TEST_EXCLUDE_COMPONENTS (list of test excluded names)) + $(info $(if $(EXCLUDE_COMPONENTS) || $(TEST_EXCLUDE_COMPONENTS),$(EXCLUDE_COMPONENTS) $(TEST_EXCLUDE_COMPONENTS),(none provided))) $(info $(call dequote,$(SEPARATOR))) $(info COMPONENT_PATHS (paths to all components):) $(foreach cp,$(COMPONENT_PATHS),$(info $(cp))) diff --git a/tools/unit-test-app/Makefile b/tools/unit-test-app/Makefile index a7b3c45ff..293764399 100644 --- a/tools/unit-test-app/Makefile +++ b/tools/unit-test-app/Makefile @@ -69,6 +69,7 @@ $(BINARIES_DIR)/%/$(PROJECT_NAME).bin: configs/% # of tests to build for given configuration. # Build all tests if this option is not present. test_components=`sed -n 's/^TEST_COMPONENTS=\(.*\)/\1/p' configs/$*`; \ + test_exclude_components=`sed -n 's/^TEST_EXCLUDE_COMPONENTS=\(.*\)/\1/p' configs/$*`; \ tests_all=`test -n "$${test_components}"; echo $${?}`; \ exclude_components=`sed -n 's/^EXCLUDE_COMPONENTS=\(.*\)/\1/p' configs/$*`; \ $(MAKE) defconfig list-components all \ @@ -76,6 +77,7 @@ $(BINARIES_DIR)/%/$(PROJECT_NAME).bin: configs/% SDKCONFIG=$(BUILDS_DIR)/$*/sdkconfig \ SDKCONFIG_DEFAULTS=$(BUILDS_DIR)/$*/sdkconfig.defaults \ TEST_COMPONENTS="$${test_components}" \ + TEST_EXCLUDE_COMPONENTS="$${test_exclude_components}" \ TESTS_ALL=$${tests_all} \ EXCLUDE_COMPONENTS="$${exclude_components}" $(MAKE) print_flash_cmd \