Merge pull request #16795 from miri64/make-tests-with-config/feat/config-check

make: add capability to check config for `test-with-config`
This commit is contained in:
Martine Lenders 2021-09-04 00:14:02 +02:00 committed by GitHub
commit 473ab2f9d3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -40,17 +40,36 @@ test-as-root/available:
$(Q)test -n "$(strip $(TESTS_AS_ROOT))" $(Q)test -n "$(strip $(TESTS_AS_ROOT))"
# Tests that require specific configuration # Tests that require specific configuration
.PHONY: test-with-config test-with-config/available .PHONY: test-with-config test-with-config/available test-with-config/check-config
TESTS_WITH_CONFIG ?= $(foreach file,$(wildcard $(APPDIR)/tests-with-config/*[^~]),\ # Scripts for tests that require specific configuration (with automatic
$(shell test -f $(file) -a -x $(file) && echo $(file))) # 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 \ $(Q) for t in $(TESTS_WITH_CONFIG); do \
$$t || exit 1; \ $$t || exit 1; \
done done
test-with-config/available: # run the automatic configuration check
$(Q)test -n "$(strip $(TESTS_WITH_CONFIG))" 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 # this target only makes sense if an ELFFILE is actually created, thus guard by
# RIOTNOLINK="". # RIOTNOLINK="".