1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-01-17 10:32:44 +01:00

make: add capability to check config for test-with-config

This commit is contained in:
Martine Lenders 2021-09-01 16:43:18 +02:00
parent db16cafe04
commit 0b230605a4
No known key found for this signature in database
GPG Key ID: 2134D77A5336DD80

View File

@ -40,17 +40,36 @@ test-as-root/available:
$(Q)test -n "$(strip $(TESTS_AS_ROOT))"
# Tests that require specific configuration
.PHONY: test-with-config test-with-config/available
TESTS_WITH_CONFIG ?= $(foreach file,$(wildcard $(APPDIR)/tests-with-config/*[^~]),\
.PHONY: test-with-config test-with-config/available test-with-config/check-config
# Scripts for tests that require specific configuration (with automatic
# configuration checks filtered out)
TESTS_WITH_CONFIG ?= $(filter-out $(APPDIR)/tests-with-config/check-config%,\
$(foreach file,$(wildcard $(APPDIR)/tests-with-config/*[^~]),\
$(shell test -f $(file) -a -x $(file) && echo $(file)))\
)
# Scripts that provide an automatic configuration check
# for tests with specific configuration
CHECK_CONFIG ?= $(foreach file,$(wildcard $(APPDIR)/tests-with-config/check-config*[^~]),\
$(shell test -f $(file) -a -x $(file) && echo $(file)))
test-with-config: $(TEST_DEPS)
test-with-config: test-with-config/check-config $(TEST_DEPS)
$(Q) for t in $(TESTS_WITH_CONFIG); do \
$$t || exit 1; \
done
test-with-config/available:
$(Q)test -n "$(strip $(TESTS_WITH_CONFIG))"
# run the automatic configuration check
test-with-config/check-config:
$(Q)test -z "$(strip $(CHECK_CONFIG))" || \
${COLOR_ECHO} -n "${COLOR_RED}"; \
for t in $(CHECK_CONFIG) empty; do \
test $$t = "empty" && break; \
$$t || \
(echo "System configuration for" \
"tests is not available, check $${t#$${RIOTBASE}/} failed." \
"${COLOR_RESET}"; \
exit 1) || exit 1; \
done; \
${COLOR_ECHO} -n "${COLOR_RESET}"
# this target only makes sense if an ELFFILE is actually created, thus guard by
# RIOTNOLINK="".