summaryrefslogtreecommitdiffstats
path: root/tests/test_integration.mk
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-06 00:55:53 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-06 00:55:53 +0000
commit3d0386f27ca66379acf50199e1d1298386eeeeb8 (patch)
treef87bd4a126b3a843858eb447e8fd5893c3ee3882 /tests/test_integration.mk
parentInitial commit. (diff)
downloadknot-resolver-3d0386f27ca66379acf50199e1d1298386eeeeb8.tar.xz
knot-resolver-3d0386f27ca66379acf50199e1d1298386eeeeb8.zip
Adding upstream version 3.2.1.upstream/3.2.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/test_integration.mk')
-rw-r--r--tests/test_integration.mk48
1 files changed, 48 insertions, 0 deletions
diff --git a/tests/test_integration.mk b/tests/test_integration.mk
new file mode 100644
index 0000000..a5d36c3
--- /dev/null
+++ b/tests/test_integration.mk
@@ -0,0 +1,48 @@
+#
+# Integration tests
+#
+# 1. Run tests from main Deckard repo (generic DNS tests)
+# 2. Run tests from kresd repo (kresd-specific tests)
+
+SUBMODULES_DIRTY := $(shell git submodule status --recursive | cut -c 1 | grep -q '[^ ]' && echo $$?)
+REAL_PREFIX=$(realpath $(PREFIX))
+REAL_CURDIR=$(realpath $(CURDIR))
+
+# Integration tests from Deckard repo
+deckard_DIR := $(TOPSRCDIR)/tests/deckard
+
+$(deckard_DIR)/Makefile:
+ @git submodule update --init --recursive
+
+# this is necessary to avoid multiple parallel but independent runs
+# of 'make depend' from $(deckard_DIR)/run.sh
+$(deckard_DIR)/env.sh: $(deckard_DIR)/Makefile
+ @make -C "$(deckard_DIR)" depend
+
+check-install-precond:
+ $(if $(SUBMODULES_DIRTY), $(warning Warning: Git submodules are not up-to-date, expect test failures),)
+ $(if $(findstring $(REAL_CURDIR),$(REAL_PREFIX)),, $(warning Warning: PREFIX does not point into source directory; testing version in $(PREFIX)!))
+ @test -x "$(SBINDIR)/kresd" || (echo 'to run integration tests install kresd into into $$PREFIX ($(SBINDIR)/kresd)' && exit 1)
+
+# Deckard requires additional depedencies so it is not part of installcheck
+deckard: check-install-precond $(deckard_DIR)/env.sh
+ COVERAGE_ENV_SCRIPT="$(TOPSRCDIR)/scripts/coverage_env.sh" DAEMONSRCDIR="$(TOPSRCDIR)" COVERAGE_STATSDIR="$(COVERAGE_STATSDIR)/deckard" $(preload_syms) PATH="$(SBINDIR):$(PATH)" "$(deckard_DIR)/kresd_run.sh"
+
+
+tests_integr := \
+ $(wildcard daemon/*.test.integr) \
+ $(wildcard modules/*/*.test.integr) \
+ $(wildcard modules/*/test.integr) \
+ $(wildcard modules/*/*/test.integr) \
+ $(wildcard modules/*/*/*.test.integr)
+
+define make_integr_test
+$(1): check-install-precond $(deckard_DIR)/env.sh
+ echo "Integration tests from $1" && cd "$(TOPSRCDIR)" && COVERAGE_ENV_SCRIPT="$(TOPSRCDIR)/scripts/coverage_env.sh" DAEMONSRCDIR="$(TOPSRCDIR)" COVERAGE_STATSDIR="$(COVERAGE_STATSDIR)/deckard" $(preload_syms) PATH="$(SBINDIR):$(PATH)" "$(deckard_DIR)/run.sh" "--config=$(abspath $(1))/deckard.yaml" "--scenarios=$(abspath $(1))"
+.PHONY: $(1)
+endef
+
+$(foreach test,$(tests_integr),$(eval $(call make_integr_test,$(test))))
+
+check-integration: deckard $(tests_integr)
+.PHONY: check-install-precond deckard check-integration $(tests_integr)