Commit 7a1b21a4 authored by Michal 'vorner' Vaner's avatar Michal 'vorner' Vaner

Integrate „check“

Integrate the „check“ test suite into the build system. Teach the build
system to run tests, by:
• make test (only the test)
• make valgrind (tests run inside valgrind)
• make check (everything above).

Build the test binaries only when they are needed, not by default.
parent 0b5b49d6
......@@ -10,3 +10,4 @@
/src/opkg-trans/opkg-trans
# Stuff dump core all over the place.
core
tests/arguments
[submodule "build"]
path = build
url = https://gitlab.labs.nic.cz/turris/buildsystem.git
[submodule "tests/check"]
path = tests/check
url = https://github.com/libcheck/check.git
......@@ -2,6 +2,7 @@ include $(S)/build/Makefile.top
include $(S)/design/Makefile.dir
include $(S)/src/Makefile.dir
include $(S)/tests/Makefile.dir
include $(S)/build/Makefile.dir
include $(S)/build/Makefile.bottom
Subproject commit b13f0cfee279220971a33fb73159e2b3bef4de31
Subproject commit 16a36c616866802a22e6da19b63d0f4634e5dcba
RESTRICT := tests
RELATIVE := ../
include $(RELATIVE)/Makefile
.PHONY: check-compile check-clean test valgrind check
check-compile:
cd $(S)/tests/check && cmake .
+make -C $(S)/tests/check
clean: check-clean
check-clean:
+make -C $(S)/tests/check clean
C_TESTS := arguments
BINARIES += $(patsubst %,tests/%,$(TESTS))
define DO_C_TEST
BINARIES_NOTARGET += tests/$(1)
$(1)_MODULES += $(1)
$(1)_SYSTEM_LIBS += check m rt
$(1)_LOCAL_LIBS += updater
$(S)/bin/$(1): EXTRA_LIBDIRS := $(S)/tests/check/src/
$(S)/bin/$(1): EXTRA_INCLUDES := $(S)/tests/check/src/ $(S)/tests/check/
$(S)/bin/$(1): check-compile
test: test-$(1)
valgrind: valgrind-$(1)
.PHONY: test-$(1) valgrind-$(1)
test-$(1): $(S)/bin/$(1)
$(S)/bin/$(1)
valgrind-$(1): $(S)/bin/$(1)
valgrind $(S)/bin/$(1)
endef
$(eval $(foreach TEST,$(C_TESTS),$(call DO_C_TEST,$(TEST))))
check: test valgrind
#include <check.h>
START_TEST(empty_test) {
}
END_TEST
int main(int argc, char *argv[]) {
}
Subproject commit db24aacf1fdb41371aef16f6d8c2bb68b890f529
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment