From ec4d83727a8aa68eb83a8ac7a600e75fdb48a778 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABtan=20Harter?= Date: Sat, 23 Mar 2019 18:03:44 +0100 Subject: [PATCH] Makefile.include: add a 'test/available' target This allows querying the build system if there are test available. Before, one should rely on 'info-debug-variable-TESTS' to print the list of test files. But was not reliable as sometime the build system printed messages anyway. BOARD=esp32-wroom-32 make --silent --no-print-directory \ -C examples/hello-world/ info-debug-variable-TESTS ESP32_SDK_DIR should be defined as /path/to/esp-idf directory ESP32_SDK_DIR is set by default to /opt/esp/esp-idf # empty line here Now the return code can be trusted. --- Makefile.include | 6 +++++- tests/README.md | 7 +++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/Makefile.include b/Makefile.include index 74cd9dd089..59ccb38dc6 100644 --- a/Makefile.include +++ b/Makefile.include @@ -569,7 +569,7 @@ reset: $(call check_cmd,$(RESET),Reset program) $(RESET) $(RESET_FLAGS) -.PHONY: test +.PHONY: test test/available TESTS ?= $(foreach file,$(wildcard $(APPDIR)/tests/*),\ $(shell test -f $(file) -a -x $(file) && echo $(file))) test: $(TEST_DEPS) @@ -577,6 +577,10 @@ test: $(TEST_DEPS) $$t || exit 1; \ done +test/available: + $(Q)test -n "$(strip $(TESTS))" + + # Default OBJDUMPFLAGS for platforms which do not specify it: OBJDUMPFLAGS ?= -S -D -h diff --git a/tests/README.md b/tests/README.md index a760cd1769..e0e3b1f5f9 100644 --- a/tests/README.md +++ b/tests/README.md @@ -20,3 +20,10 @@ testing. From the test application directory run: BOARD= make flash test + + +An automated way of knowing if a test is available is to execute the +'test/available' target from the test application directory. +It executes without error if tests run by 'make test' are present. + + make test/available