Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 25 additions & 6 deletions makefiles/tests/tests.inc.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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/*[^~]),\
$(shell test -f $(file) -a -x $(file) && echo $(file)))
.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." \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"tests is not available, check $${t#$${RIOTBASE}/} failed." \
"tests is not available, check $${t#$${RIOTBASE}/}." \

Copy link
Contributor

@kfessel kfessel Sep 3, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

" check tests/gnrc_dhcpv6_client/tests-with-config/check-config.sh failed. "
i read the "check" a a verb and it sounded wrong to me, but if check and the filename are one noun it sounds correct

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That looks to me like a part of the sentence is missing...

Copy link
Contributor

@kfessel kfessel Sep 4, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i was just citing the part after the , but as said i was reading it kinda wrong

"${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="".
Expand Down