mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
tests: add 'test-as-root' and 'test-with-config' targets
These targets cannot be used in an automated testing workflow without complex configuration or extend rights. - Add new 'test-as-root' target for tests that require to be root or start an external daemon as root - Add new 'test-with-config' target for tests that require a specific configuration to succeed (module configuration or hardware configuration)
This commit is contained in:
parent
4412b9a4ab
commit
54c4536945
@ -26,10 +26,36 @@ test: $(TEST_DEPS)
|
||||
test/available:
|
||||
$(Q)test -n "$(strip $(TESTS))"
|
||||
|
||||
# Tests that require root privileges
|
||||
.PHONY: test-as-root test-as-root/available
|
||||
TESTS_AS_ROOT ?= $(foreach file,$(wildcard $(APPDIR)/tests-as-root/*[^~]),\
|
||||
$(shell test -f $(file) -a -x $(file) && echo $(file)))
|
||||
|
||||
test-as-root: $(TEST_DEPS)
|
||||
$(Q) for t in $(TESTS_AS_ROOT); do \
|
||||
sudo -E PYTHONPATH=$(PYTHONPATH) $$t || exit 1; \
|
||||
done
|
||||
|
||||
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)))
|
||||
|
||||
test-with-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))"
|
||||
|
||||
# this target only makes sense if an ELFFILE is actually created, thus guard by
|
||||
# RIOTNOLINK="".
|
||||
ifeq (,$(RIOTNOLINK))
|
||||
test-input-hash: $(TESTS) $(ELFFILE) $(TEST_EXTRA_FILES)
|
||||
test-input-hash: $(TESTS) $(TESTS_WITH_CONFIG) $(TESTS_AS_ROOT) $(ELFFILE) $(TEST_EXTRA_FILES)
|
||||
sha1sum $^ > $(BINDIR)/test-input-hash.sha1
|
||||
else
|
||||
test-input-hash:
|
||||
|
@ -117,3 +117,22 @@ The expected behavior is verified with the test in `tests/test_tools`.
|
||||
Tests cannot rely on having on all boards and terminal programs:
|
||||
* unbuffered input
|
||||
* allowing sending special characters like `ctrl+c/ctrl+d`
|
||||
|
||||
|
||||
Running tests that require a preliminary manual configuration
|
||||
-------------------------------------------------------------
|
||||
|
||||
Some tests need active monitoring or manual setup steps but still have some
|
||||
automated scripts. The test automation scripts are defined in the
|
||||
`<test_application>/tests-with-config/` folder.
|
||||
For running them, follow the setup or analysis documentation and use the
|
||||
`test-with-config` target.
|
||||
|
||||
Running tests that require root privileges
|
||||
------------------------------------------
|
||||
|
||||
Some tests require root privileges to launch their automated script. In this
|
||||
case, the test automation scripts are defined in the
|
||||
`<test_application>/tests-as-root/` folder.
|
||||
For running them, follow the setup or analysis documentation and use the
|
||||
`test-as-root` target.
|
||||
|
Loading…
Reference in New Issue
Block a user