]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
tests: split integration test to separate Makefile
authorPetr Špaček <petr.spacek@nic.cz>
Wed, 4 Apr 2018 12:41:23 +0000 (14:41 +0200)
committerPetr Špaček <petr.spacek@nic.cz>
Fri, 22 Jun 2018 12:03:47 +0000 (14:03 +0200)
This is preparation for more generic integration test framework.

tests/test_integration.mk [new file with mode: 0644]
tests/tests.mk

diff --git a/tests/test_integration.mk b/tests/test_integration.mk
new file mode 100644 (file)
index 0000000..4d0303b
--- /dev/null
@@ -0,0 +1,41 @@
+#
+# Integration tests
+#
+# 1. Run tests from main Deckard repo (generic DNS tests)
+# 2. Run Deckard tests from kresd repo (kresd-specific tests)
+
+# Platform-specific library injection
+ifeq ($(PLATFORM),Darwin)
+       preload_syms := DYLD_FORCE_FLAT_NAMESPACE=1 DYLD_LIBRARY_PATH="$(abspath lib):$(DYLD_LIBRARY_PATH)"
+else
+       preload_syms := LD_LIBRARY_PATH="$(abspath lib):$(LD_LIBRARY_PATH)"
+endif
+
+tests_integr := \
+       $(wildcard modules/*/*.test.integr) \
+       $(wildcard modules/*/*/*.test.integr)
+
+# Integration tests from Deckard repo
+deckard_DIR := tests/deckard
+TESTS := sets/resolver
+TEMPLATE := template/kresd.j2
+SUBMODULES_DIRTY := $(shell git submodule status --recursive | cut -c 1 | grep -q '[^ ]' && echo $$?)
+
+REAL_PREFIX=$(realpath $(PREFIX))
+REAL_CURDIR=$(realpath $(CURDIR))
+
+$(deckard_DIR)/Makefile:
+       @git submodule update --init --recursive
+
+check-install-precond:
+       $(if $(findstring $(REAL_CURDIR),$(REAL_PREFIX)),, $(warning Warning: PREFIX does not point into source directory; testing version in $(PREFIX)!))
+
+# Deckard requires additional depedencies so it is not part of installcheck
+deckard: check-install-precond $(deckard_DIR)/Makefile
+       $(if $(SUBMODULES_DIRTY), $(warning Warning: Git submodules are not up-to-date),)
+       @mkdir -p $(deckard_DIR)/contrib/libswrap/obj
+       +TESTS=$(TESTS) DAEMON=$(abspath $(SBINDIR)/kresd) TEMPLATE=$(TEMPLATE) COVERAGE_ENV_SCRIPT=$(TOPSRCDIR)/scripts/coverage_env.sh DAEMONSRCDIR=$(TOPSRCDIR) COVERAGE_STATSDIR=$(COVERAGE_STATSDIR)/deckard $(preload_syms) $(deckard_DIR)/kresd_run.sh
+
+check-integration: deckard
+
+.PHONY: deckard check-integration
index 263b6129e121c9f5cceb4343d60272e4bee889f1..282fcf26f18a50f017dfb65a00ec4ab2b0694285 100644 (file)
@@ -1,10 +1,3 @@
-# Platform-specific library injection
-ifeq ($(PLATFORM),Darwin)
-       preload_syms := DYLD_FORCE_FLAT_NAMESPACE=1 DYLD_LIBRARY_PATH="$(abspath lib):$(DYLD_LIBRARY_PATH)"
-else
-       preload_syms := LD_LIBRARY_PATH="$(abspath lib):$(LD_LIBRARY_PATH)"
-endif
-
 # Unit tests
 ifeq ($(HAS_cmocka), yes)
 include tests/unit.mk
@@ -12,42 +5,22 @@ else
 $(warning cmocka not found, skipping unit tests)
 endif
 
-include tests/config/test_config.mk
-
 CLEAN_DNSTAP :=
 ifeq ($(ENABLE_DNSTAP)|$(HAS_go),yes|yes)
 include tests/dnstap/src/dnstap-test/dnstap.mk
 CLEAN_DNSTAP := clean-dnstap
 endif
-
-# Integration tests with Deckard
-deckard_DIR := tests/deckard
-TESTS := sets/resolver
-TEMPLATE := template/kresd.j2
-SUBMODULES_DIRTY := $(shell git submodule status --recursive | cut -c 1 | grep -q '[^ ]' && echo $$?)
-
-REAL_PREFIX=$(realpath $(PREFIX))
-REAL_CURDIR=$(realpath $(CURDIR))
-
-$(deckard_DIR)/Makefile:
-       @git submodule update --init --recursive
-
-check-install-precond:
-       $(if $(findstring $(REAL_CURDIR),$(REAL_PREFIX)),, $(warning Warning: PREFIX does not point into source directory; testing version in $(PREFIX)!))
-
-# Deckard requires additional depedencies so it is not part of installcheck
-check-integration: check-install-precond $(deckard_DIR)/Makefile
-       $(if $(SUBMODULES_DIRTY), $(warning Warning: Git submodules are not up-to-date),)
-       @mkdir -p $(deckard_DIR)/contrib/libswrap/obj
-       +TESTS=$(TESTS) DAEMON=$(abspath $(SBINDIR)/kresd) TEMPLATE=$(TEMPLATE) COVERAGE_ENV_SCRIPT=$(TOPSRCDIR)/scripts/coverage_env.sh DAEMONSRCDIR=$(TOPSRCDIR) COVERAGE_STATSDIR=$(COVERAGE_STATSDIR)/deckard $(preload_syms) $(deckard_DIR)/kresd_run.sh
-
-deckard: check-integration
+tests-clean: $(foreach test,$(tests_BIN),$(test)-clean) mock_cmodule-clean $(CLEAN_DNSTAP)
 
 # Targets
 tests: check-unit
 # installcheck requires kresd to be installed in its final destination
 # (DESTDIR is not supported right now because module path gets hardcoded)
+
 installcheck: check-config
-tests-clean: $(foreach test,$(tests_BIN),$(test)-clean) mock_cmodule-clean $(CLEAN_DNSTAP)
 
-.PHONY: check-integration deckard installcheck tests tests-clean
+include tests/config/test_config.mk
+include tests/test_integration.mk
+
+
+.PHONY: installcheck tests tests-clean