build: Add TEST_EXCLUDE_COMPONENTS

To exclude during the build process of unit tests some components.
This commit is contained in:
Konstantin Kondrashov 2018-06-28 14:54:15 +05:00
parent 82047ff181
commit bec14ad8ee
4 changed files with 10 additions and 5 deletions

View File

@ -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)``.

View File

@ -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.

View File

@ -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)))

View File

@ -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 \