]> granicus.if.org Git - esp-idf/commitdiff
add build all unit tests in project.mk and update doc
authorantti <antti@espressif.com>
Wed, 23 Nov 2016 03:42:12 +0000 (11:42 +0800)
committerantti <antti@espressif.com>
Wed, 23 Nov 2016 03:42:12 +0000 (11:42 +0800)
make/project.mk
tools/unit-test-app/README.md

index 0dfce4368a94be4c6052c70b5f81ae8a018dcf9a..181152f11847435e7d41378e7baece88b6a77dd5 100644 (file)
@@ -94,10 +94,16 @@ COMPONENT_PATHS += $(abspath $(SRCDIRS))
 # A component is buildable if it has a component.mk makefile in it
 COMPONENT_PATHS_BUILDABLE := $(foreach cp,$(COMPONENT_PATHS),$(if $(wildcard $(cp)/component.mk),$(cp)))
 
-# If TEST_COMPONENTS is set on the command line, create variables for building unit tests
+# If TESTS_ALL set to 1, set TEST_COMPONENTS to all components
+ifeq ($(TESTS_ALL),1)
+TEST_COMPONENTS := $(COMPONENTS)
+endif
+
+# If TEST_COMPONENTS is set, create variables for building unit tests
 ifdef TEST_COMPONENTS
-TEST_COMPONENT_PATHS := $(foreach comp,$(TEST_COMPONENTS),$(IDF_PATH)/components/$(comp)/test)
-TEST_COMPONENT_NAMES := $(foreach comp,$(TEST_COMPONENTS),$(comp)_test)
+override TEST_COMPONENTS := $(foreach comp,$(TEST_COMPONENTS),$(wildcard $(IDF_PATH)/components/$(comp)/test))
+TEST_COMPONENT_PATHS := $(TEST_COMPONENTS)
+TEST_COMPONENT_NAMES :=  $(foreach comp,$(TEST_COMPONENTS),$(lastword $(subst /, ,$(dir $(comp))))_test)
 endif
 
 # Initialise project-wide variables which can be added to by
index cf45ce287bc4543042f598dbeb82277a48a93ce3..eff3e12f4abba6bcc7c11b87a4b2c7b1a679ce20 100644 (file)
@@ -8,5 +8,5 @@ ESP-IDF unit tests are run using Unit Test App. The app can be built with the un
 * Set IDF_PATH environment variable to point to the path to the esp-idf top-level directory.
 * Change into `tools/unit-test-app` directory
 * `make menuconfig` to configure the Unit Test App.
-* `make TEST_COMPONENTS=` with `TEST_COMPONENTS` set to names of the components to be included in the test app.
+* `make TEST_COMPONENTS=` with `TEST_COMPONENTS` set to names of the components to be included in the test app. Or `make TESTS_ALL=1` to build the test app with all the tests for components having `test` subdirectory.
 * Follow the printed instructions to flash, or run `make flash`.