diff --git a/tests/hints_zone.j2 b/tests/hints_zone.j2 new file mode 100644 index 0000000000000000000000000000000000000000..b46b30ddd7f74f2bced7788510513d20add91ec3 --- /dev/null +++ b/tests/hints_zone.j2 @@ -0,0 +1,9 @@ +; This file holds the information on root name servers needed to +; initialize cache of Internet domain name servers + +. 3600000 NS K.ROOT-SERVERS.NET. +{% if ':' in ROOT_ADDR %} +K.ROOT-SERVERS.NET. 3600000 AAAA {{ROOT_ADDR}} +{% else %} +K.ROOT-SERVERS.NET. 3600000 A {{ROOT_ADDR}} +{% endif %} diff --git a/tests/kresd_config.j2 b/tests/kresd_config.j2 new file mode 100644 index 0000000000000000000000000000000000000000..52814b506fe1815ebcfc5d3ac7d682768a716c91 --- /dev/null +++ b/tests/kresd_config.j2 @@ -0,0 +1,53 @@ +net = { '{{SELF_ADDR}}' } +-- hints.root({['k.root-servers.net'] = '{{ROOT_ADDR}}'}) +_hint_root_file('hints') + +cache.size = 2*MB + + +{% if QMIN == "false" %} +option('NO_MINIMIZE', true) +{% else %} +option('NO_MINIMIZE', false) +{% endif %} + +{% if DO_NOT_QUERY_LOCALHOST == "false" %} +option('ALLOW_LOCAL', true) +{% else %} +option('ALLOW_LOCAL', false) +{% endif %} + +{% if HARDEN_GLUE == "true" %} +mode('normal') +{% else %} +mode('permissive') +{% endif %} + +{% for TAF in TRUST_ANCHOR_FILES %} +trust_anchors.add_file('{{TAF}}') +{% endfor %} +trust_anchors.set_insecure({ + +{% for DI in NEGATIVE_TRUST_ANCHORS %} +"{{DI}}", +{% endfor %} +}) + +verbose(true) + +-- Self-checks on globals +assert(help() ~= nil) +assert(worker.id ~= nil) +-- Self-checks on facilities +assert(cache.count() == 0) +assert(cache.stats() ~= nil) +assert(cache.backends() ~= nil) +assert(worker.stats() ~= nil) +assert(net.interfaces() ~= nil) +-- Self-checks on loaded stuff +assert(net.list()['{{SELF_ADDR}}']) +assert(#modules.list() > 0) +-- Self-check timers +ev = event.recurrent(1 * sec, function (ev) return 1 end) +event.cancel(ev) +ev = event.after(0, function (ev) return 1 end) diff --git a/tests/test_integration.mk b/tests/test_integration.mk index 3046485ae6c9ff61b27a1b487dd39dd4f215e6af..7c4e53a134f91440395b26574b84d02c32726220 100644 --- a/tests/test_integration.mk +++ b/tests/test_integration.mk @@ -2,6 +2,7 @@ # 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)) @@ -15,20 +16,40 @@ else endif # Integration tests from Deckard repo -deckard_DIR := tests/deckard +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)/Makefile - 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" +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 -check-integration: deckard +$(foreach test,$(tests_integr),$(eval $(call make_integr_test,$(test)))) -.PHONY: check-install-precond deckard check-integration +check-integration: deckard $(tests_integr) +.PHONY: check-install-precond deckard check-integration $(tests_integr)