From: Petr Špaček Date: Wed, 4 Apr 2018 12:41:23 +0000 (+0200) Subject: tests: split integration test to separate Makefile X-Git-Tag: v2.4.0~18^2~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0118441e60ca2937790bd65526b2a07edd73b2c4;p=thirdparty%2Fknot-resolver.git tests: split integration test to separate Makefile This is preparation for more generic integration test framework. --- diff --git a/tests/test_integration.mk b/tests/test_integration.mk new file mode 100644 index 000000000..4d0303b04 --- /dev/null +++ b/tests/test_integration.mk @@ -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 diff --git a/tests/tests.mk b/tests/tests.mk index 263b6129e..282fcf26f 100644 --- a/tests/tests.mk +++ b/tests/tests.mk @@ -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