source: mod_gnutls/test/Makefile.am @ f97f44c

asyncio
Last change on this file since f97f44c was 2089d49, checked in by Krista Karppinen <krista.celestia@…>, 17 months ago

Add mgstest/ocsp.py to Makefile.am

Add the newly created mgstest/ocsp.py to test/Makefile.am
so that make dist works.

  • Property mode set to 100644
File size: 13.0 KB
RevLine 
[33af2b7]1SUBDIRS = tests
2
[99c61f9]3VALGRIND_SUPPRESS = suppressions.valgrind
4EXTRA_DIST = $(VALGRIND_SUPPRESS)
5
6if ENABLE_VALGRIND
7valgrind = --valgrind \
8        $(foreach supp,$(VALGRIND_SUPPRESS),--valgrind-suppressions "$(srcdir)/$(supp)")
9else
10valgrind =
11endif
12
[478767a]13# Generate the test scripts
14test-%.bash: test-template.bash.in | tests/%/
[99c61f9]15        testname="$(*)"; \
16        sed -e s/_NUM_/$${testname%%_*}/ -e 's,_VALGRIND_,$(valgrind),' < $< > $@
[478767a]17        chmod a+x $@
18
[0da2c5d]19test_scripts = test-00_basic.bash \
[c51e33a]20        test-01_serverwide_priorities.bash \
21        test-02_cache_in_vhost.bash \
22        test-03_cachetimeout_in_vhost.bash \
23        test-04_basic_nosni.bash \
24        test-05_mismatched-priorities.bash \
25        test-06_verify_sni_a.bash \
26        test-07_verify_sni_b.bash \
27        test-08_verify_no_sni_fallback_to_first_vhost.bash \
28        test-09_verify_no_sni_fails_with_wrong_order.bash \
29        test-10_basic_client_verification.bash \
30        test-11_basic_client_verification_fail.bash \
31        test-12_cgi_variables.bash \
32        test-13_cgi_variables_no_client_cert.bash \
[6c5c2ec]33        test-14_resume_session.bash
[65c18ce]34if USE_MSVA
[0da2c5d]35test_scripts += test-15_basic_msva.bash
[65c18ce]36endif
[0da2c5d]37test_scripts += test-16_view-status.bash \
[eea8a16]38        test-17_cgi_vars_large_cert.bash \
[6e6a4e4]39        test-18_client_verification_wrong_cert.bash \
[ed82a6a]40        test-19_TLS_reverse_proxy.bash \
41        test-20_TLS_reverse_proxy_client_auth.bash \
[907ae8f]42        test-21_TLS_reverse_proxy_wrong_cert.bash \
[f030883]43        test-22_TLS_reverse_proxy_crl_revoke.bash \
[3f00958]44        test-23_TLS_reverse_proxy_mismatched_priorities.bash \
[29d3311]45        test-24_pkcs11_cert.bash \
[8ac7c0d]46        test-25_Disable_TLS_1.0.bash \
[c4d6e77]47        test-26_redirect_HTTP_to_HTTPS.bash \
[d50dac5]48        test-27_OCSP_server.bash \
[359f009]49        test-28_HTTP2_support.bash \
[0062ede]50        test-29_force_handshake_vhost.bash \
[5cf8e99]51        test-30_ip_based_vhosts.bash \
52        test-31_vhost_SNI_serveralias_match.bash \
[dcc053e]53        test-32_vhost_SNI_serveralias_mismatch.bash \
[f674424]54        test-33_vhost_SNI_serveralias_missinghost.bash \
[6fa6095]55        test-34_TLS_reverse_proxy_h2.bash \
[e60e3b9]56        test-35_client_reauth.bash \
57        test-36_OCSP_server_nonce.bash
[5951102]58
[0da2c5d]59MOSTLYCLEANFILES = $(test_scripts)
[478767a]60dist_check_SCRIPTS = netns_py.bash test-template.bash.in
61
[459a982]62TEST_EXTENSIONS = .bash .py
63PY_LOG_COMPILER = $(PYTHON)
[0da2c5d]64TESTS = doctest-mgstest.py $(test_scripts)
[8f90bf4]65
[7921dc7]66check_PROGRAMS = pgpcrc
[42829ae]67pgpcrc_SOURCES = pgpcrc.c
68
[42bee37]69# build OCSP database tool
70if ENABLE_OCSP_TEST
[b674e95]71check_PROGRAMS += gen_ocsp_index
[42bee37]72gen_ocsp_index_SOURCES = gen_ocsp_index.c cert_helper.c
[439005a]73gen_ocsp_index_CFLAGS = $(LIBGNUTLS_CFLAGS)
[6c44ed2]74gen_ocsp_index_LDFLAGS = $(LIBGNUTLS_LIBS)
[42bee37]75noinst_HEADERS = cert_helper.h
76endif
77
[6d3dc34]78# Python tools for tests
79noinst_PYTHON = https-test-client.py mgstest/http.py mgstest/__init__.py \
[2089d49]80        mgstest/hooks.py mgstest/ocsp.py mgstest/services.py \
81        mgstest/softhsm.py mgstest/tests.py mgstest/valgrind.py runtest.py \
82        softhsm-init.py doctest-mgstest.py required-modules.py data/ocsp.py
[6d3dc34]83
[9a4d250]84# Identities in the miniature CA, server, and client environment for
85# the test suite
[e5546be]86shared_identities = authority authority/client
[c0bb823]87pgp_identities = $(shared_identities)
[c3aebe5]88x509_only_identities = authority/server authority/imposter \
89        authority/subca authority/subca/server \
90        rogueca rogueca/rogueclient
[a03f94e]91if ENABLE_OCSP_TEST
[7cfc02b]92x509_only_identities += authority/ocsp-responder authority/subca/ocsp-responder
[a03f94e]93endif
[c0bb823]94x509_identities = $(shared_identities) $(x509_only_identities)
95identities = $(shared_identities) $(x509_only_identities)
[9a4d250]96# Append strings after ":=" to each identity to generate a list of
97# necessary files
[d70dd6e]98pgp_tokens = $(pgp_identities:=/cert.pgp) \
[c0bb823]99        $(pgp_identities:=/secret.pgp)
100x509_keys = $(x509_identities:=/secret.key)
101x509_certs = $(x509_identities:=/x509.pem)
[9a4d250]102x509_tokens = $(x509_certs) $(x509_keys)
[39a27cf]103tokens = $(x509_tokens)
104if USE_MSVA
105tokens += $(pgp_tokens)
106endif
[9a4d250]107
[5b6a5d9]108if !DISABLE_FLOCK
109# flock command for write access to the authority keyring
[5725dca]110GPG_FLOCK = @FLOCK@ authority/lock
[5b6a5d9]111endif
112
[fc8e463b]113include $(srcdir)/test_ca.mk
[9a4d250]114
[39bd695]115# Test cases trying to create keys and certificates in parallel causes
116# race conditions. Ensure that all keys and certificates are generated
117# before tests get to run.
118#
119# NOTE: Once the support files have been generated, test cases can be
120# run with multiple jobs, but real parallelization would require
121# dynamic port assignments. At the moment, lock files ensure that only
122# one Apache instance (possibly plus a proxy back end instance) is
123# running at any time, so test cases actually have to wait for each
124# other - just not in any particular order.
[c825c3a]125check_DATA = $(tokens) authority/server/crl.pem
[39bd695]126
[478767a]127MOSTLYCLEANFILES += cache/* logs/* outputs/* authority/server/crl.pem
[6ce02e2]128
[e5546be]129cert_templates = authority/template.in authority/client/template.in \
[e8498bf]130        authority/imposter/template.in authority/ocsp-responder/template \
[6dab61d]131        authority/server/template.in \
[c3aebe5]132        authority/subca/template.in authority/subca/server/template.in \
[7cfc02b]133        authority/subca/ocsp-responder/template \
[6dab61d]134        rogueca/template rogueca/rogueclient/template.in
[e5546be]135generated_templates = authority/template authority/client/template \
[6dab61d]136        authority/imposter/template rogueca/rogueclient/template \
[59afe51]137        authority/server/template
[90a31a4]138
[9a4d250]139# Delete X.509 private keys on full clean. Note that unless you need
140# to generate fresh keys, the "mostlyclean" target should be
141# sufficient (see below).
142CLEANFILES = $(x509_keys)
143
[90a31a4]144# Delete X.509 certificates and generated templates on "mostlyclean"
145# target. Certificates can be rebuilt without generating new key
146# pairs, and regenerating them makes it possible to change identities
[7aeabcb]147# (e.g. host names) without wasting time on new keys (which would
[90a31a4]148# happen after "clean").
[e5546be]149MOSTLYCLEANFILES += $(x509_certs) $(generated_templates) $(identities:=/uid)
[9a4d250]150
[90a31a4]151
[6ce02e2]152# Delete PGP keyrings on "mostlyclean" target. They are created from
153# the X.509 private keys and certificates with an expiration time of
154# one day, so regenerating them is both fast and frequently
155# necessary.
[e5546be]156pgp_patterns = /*.pgp /*.pgp.raw /*.gpg /*.gpg~ /gpg.conf \
157        /*.kbx /*.kbx~ /S.gpg-agent /private-keys-v1.d/*
158MOSTLYCLEANFILES += $(foreach pat,$(pgp_patterns),$(pgp_identities:=$(pat))) \
159        authority/lock authority/tofu.db
[9a4d250]160# GnuPG random pool, no need to regenerate on every build
161CLEANFILES += authority/random_seed
[1708045]162
[ee94de5]163# GnuPG 2 starts gpg-agent processes per GNUPGHOME (one for every PGP
164# identity) while creating the PGP certificates. This target is called
165# by both "check-local" and "mostlyclean-local": The former because
166# agent processes are started while preparing for "check" and are no
167# longer needed afterwards, the latter to make sure they are gone
168# along with their certificates.
169stop-gnupg-agent:
170        for id in $(pgp_identities) $(msva_home); do \
171                GNUPGHOME=$$id/ gpgconf --kill gpg-agent || true; \
172        done
173
174check-local: stop-gnupg-agent
175
[9a4d250]176# Delete lock files for test servers on "mostlyclean" target.
177MOSTLYCLEANFILES += *.lock
178
179# rule to build MSVA trust database
180if USE_MSVA
181msva_home = msva.gnupghome
[e5546be]182check_DATA += $(msva_home)/trustdb.gpg authority/client/uid
183MOSTLYCLEANFILES += $(foreach pat,$(pgp_patterns),$(msva_home)$(pat))
184$(msva_home)/trustdb.gpg: authority/minimal.pgp authority/client/cert.pgp
[9a4d250]185        mkdir -p -m 0700 $(dir $@)
186        GNUPGHOME=$(dir $@) gpg --import < $<
[ee94de5]187        printf "%s:6:\n" "$$(GNUPGHOME=authority/ gpg --with-colons --list-secret-keys --fingerprint | grep ^fpr: | cut -f 10 -d :)" | GNUPGHOME=$(dir $@) gpg --import-ownertrust
[e5546be]188        GNUPGHOME=$(dir $@) gpg --import < authority/client/cert.pgp
[9a4d250]189        printf "keyserver does-not-exist.example\n" > $(msva_home)/gpg.conf
190endif
[3f00958]191
[ea99ffe]192if ENABLE_OCSP_TEST
[20f8e99]193# rules to build OCSP database
[7cfc02b]194ocsp_index_data = authority/ocsp_index.txt authority/ocsp_index.txt.attr \
195        authority/subca/ocsp_index.txt authority/subca/ocsp_index.txt.attr
196check_DATA += $(ocsp_index_data)
197MOSTLYCLEANFILES += $(ocsp_index_data)
198
199# The "find" command builds a list of all certificates directly below
200# the CA that aren't for the ocsp-responder.
201%/ocsp_index.txt: $(x509_tokens) gen_ocsp_index
202        ./gen_ocsp_index $$(find $(*) -mindepth 2 -maxdepth 2 ! -path '*/ocsp-responder/*' -name x509.pem) > $@
203
204%/ocsp_index.txt.attr:
205        @mkdir -m 0700 -p $(dir $@)
[ea99ffe]206        echo "unique_subject = no" > $@
[20f8e99]207
[f828974]208# Build certificate chain files. Note that intermediate tokens must be
209# listed explicitly, or the dependency chain will be broken because
210# the higher level pattern matches, too.
211chain_tokens = authority/server/x509-chain.pem \
212        authority/subca/x509-chain.pem \
213        authority/subca/server/x509-chain.pem
214check_DATA += $(chain_tokens)
[7cfc02b]215MOSTLYCLEANFILES += $(chain_tokens) authority/x509-chain.pem
[ea99ffe]216endif
[9a4d250]217
[278381d]218# SoftHSM token, note that the SoftHSM 2 token is a directory
[c825c3a]219SOFTHSM2_TOKEN = authority/server/softhsm2.db
[b0e5dae]220# included in mostlyclean-local below
221clean-softhsm2-db:
222        -rm -rf $(SOFTHSM2_TOKEN)
223
[278381d]224if HAVE_SOFTHSM
[b0e5dae]225check_DATA += $(SOFTHSM2_TOKEN)
[278381d]226endif HAVE_SOFTHSM
[9a4d250]227
228check_DATA += make-test-dirs
229extra_dirs = logs cache outputs
230make-test-dirs:
231        mkdir -p $(extra_dirs)
[b0e5dae]232
[ee94de5]233.PHONY: make-test-dirs clean-softhsm2-db stop-gnupg-agent
234
[b0e5dae]235
[ee94de5]236mostlyclean-local: clean-softhsm2-db stop-gnupg-agent
[42829ae]237        -rmdir $(pgp_identities:=/private-keys-v1.d) || true
238if USE_MSVA
239        -rmdir $(msva_home)/private-keys-v1.d || true
240endif
[3f00958]241
[acea635]242# Delete test data directories, and wait for test services to
243# exit. The reason for the wait is that Apache instances may take some
244# time to exit and delete their PID files. Occasionally some PID files
245# where still around during "distcheck" runs by the time the target
246# checked if the build directory was really empty after "distclean",
247# breaking the build. Delaying "clean-local" until PID files are gone
248# avoids this issue, and the timeout will expose actually unclean
249# stops.
[9a4d250]250clean-local:
251        -rmdir $(extra_dirs) || true
252if USE_MSVA
253        -rmdir $(msva_home) || true
254endif
[acea635]255        wait=0; \
256        while ls *.pid && test "$$wait" -lt "@TEST_LOCK_WAIT@"; do \
257                wait=$$(($$wait + 1)); \
258                echo "waiting for test services to exit ($$wait seconds)"; \
259                sleep 1; \
260        done
[33af2b7]261
[9a4d250]262# Apache configuration and data files
[204377e]263apache_data = base_apache.conf cgi_module.conf data/dump.cgi \
[9db4dcd]264        data/test.txt data/secret/mirror.cgi data/secret/test.txt \
265        mime.types proxy_mods.conf
[33af2b7]266
[c4ba2b60]267# Which modules are compiled into the Apache binary varies between
268# distributions. required-modules.py creates additional LoadModule
269# directives if needed.
270check_DATA += apache-conf/required-modules.conf
271MOSTLYCLEANFILES += apache-conf/required-modules.conf
272apache-conf/required-modules.conf: required-modules.py
[ee6351d]273        APACHE2=@APACHE2@ AP_LIBEXECDIR=@AP_LIBEXECDIR@ $(PYTHON) $< >$@
[c4ba2b60]274
[a1ce49d]275# Documentation for the test system
276test_doc = README.md sample_fail.yml sample_test.yml
277
[99c61f9]278EXTRA_DIST += $(apache_data) $(cert_templates) $(shared_identities:=/uid.in) \
[ff039b1]279        authority/server/crl.template $(test_doc)
[52c3f68]280
[34e5dc7]281# Lockfile for the main Apache process
282test_lockfile = ./test.lock
[412ee84]283# Lockfile for the proxy backend Apache process (if any)
284backend_lockfile = ./backend.lock
[94430e6]285# Lockfile for the OCSP server Apache process (if any)
286ocsp_lockfile = ./ocsp.lock
[50eab8e]287
[34e5dc7]288# port for the main Apache server
289TEST_PORT ?= 9932
290# port for MSVA in test cases that use it
291MSVA_PORT ?= 9933
[97d7c63]292# port for TLS proxy backend server
293BACKEND_PORT ?= 9934
[3871dbd]294# port for plain HTTP server
295TEST_HTTP_PORT ?= 9935
[97d7c63]296# port for the OCSP responder
[21181b2]297if ENABLE_OCSP_TEST
298OCSP_PORT ?= 9936
[b47dc70]299OCSP_URI_TEMPLATE = ocsp_uri = http://$(TEST_HOST):$(OCSP_PORT)/ocsp/
[21181b2]300endif
[a61edfd]301# maximum time to wait for MSVA startup (milliseconds)
[4fb510d]302TEST_SERVICE_MAX_WAIT ?= 10000
[a61edfd]303# wait loop time for MSVA startup (milliseconds)
[4fb510d]304TEST_SERVICE_WAIT ?= 400
[34e5dc7]305
[5725dca]306AM_TESTS_ENVIRONMENT = export APACHE2=@APACHE2@; \
307        export AP_LIBEXECDIR=@AP_LIBEXECDIR@; \
[8335f8c]308        export PYTHON="@PYTHON@"; \
[6c030c1]309        export TEST_LOCK_WAIT="@TEST_LOCK_WAIT@"; \
[849b87e]310        export TEST_IP="@TEST_IP@"; \
[5725dca]311        export TEST_HOST="@TEST_HOST@"; \
[34e5dc7]312        export TEST_PORT="$(TEST_PORT)"; \
313        export MSVA_PORT="$(MSVA_PORT)"; \
[4fb510d]314        export TEST_SERVICE_MAX_WAIT="$(TEST_SERVICE_MAX_WAIT)"; \
315        export TEST_SERVICE_WAIT="$(TEST_SERVICE_WAIT)"; \
[6c030c1]316        export TEST_QUERY_TIMEOUT="@TEST_QUERY_TIMEOUT@"; \
[5725dca]317        export BACKEND_HOST="@TEST_HOST@"; \
[97d7c63]318        export BACKEND_PORT="$(BACKEND_PORT)"; \
[3871dbd]319        export TEST_HTTP_PORT="$(TEST_HTTP_PORT)"; \
[67f2f58]320        export HTTP_CLI="@HTTP_CLI@";
[f9f184f]321
[5eb4544]322if HAVE_SOFTHSM
[74772b2]323AM_TESTS_ENVIRONMENT += export SOFTHSM="@SOFTHSM@"; \
[a592762]324        export SOFTHSM_LIB="@SOFTHSM_LIB@";
[5eb4544]325endif
326
[21181b2]327if ENABLE_OCSP_TEST
328AM_TESTS_ENVIRONMENT += export OPENSSL="@OPENSSL@"; \
329        export OCSP_PORT="$(OCSP_PORT)";
330endif
331
[99c61f9]332if ENABLE_VALGRIND
333AM_TESTS_ENVIRONMENT += export VALGRIND="@VALGRIND@";
334endif
335
[cf4e708]336if ENABLE_NETNS
[5725dca]337AM_TESTS_ENVIRONMENT += export UNSHARE="@UNSHARE@"; \
[cf4e708]338        export USE_TEST_NAMESPACE=1;
339endif
[94430e6]340# Without flock tests must not run in parallel, and PID files are used
341# to prevent conflicts between server instances. Otherwise set lock
342# files for flock.
[412ee84]343if DISABLE_FLOCK
[94430e6]344AM_TESTS_ENVIRONMENT += export TEST_LOCK="apache2.pid"; \
345        export BACKEND_LOCK="backend.pid"; \
346        export OCSP_LOCK="ocsp.pid";
[412ee84]347.NOTPARALLEL:
348else
[5725dca]349AM_TESTS_ENVIRONMENT += export FLOCK="@FLOCK@"; \
[412ee84]350        export TEST_LOCK="$(test_lockfile)"; \
[94430e6]351        export BACKEND_LOCK="$(backend_lockfile)"; \
352        export OCSP_LOCK="$(ocsp_lockfile)";
[412ee84]353endif
354
[f9f184f]355# Echo AM_TESTS_ENVIRONMENT. This can be useful for debugging, e.g. if
356# you want to manually run an Apache instance with Valgrind using the
357# same configuration as a test case.
358show-test-env: export TEST_ENV=$(AM_TESTS_ENVIRONMENT)
359show-test-env:
360        @echo "$${TEST_ENV}"
[a274959]361
362# Build the test suite README as HTML if pandoc is available.
363if USE_PANDOC
364noinst_DATA = README.html
365MOSTLYCLEANFILES += $(noinst_DATA)
366%.html: %.md $(srcdir)/../doc/style.css
367        $(PANDOC) --css $(filter %.css,$^) --metadata pagetitle="$(<)" --self-contained -f markdown -o $@ $<
368endif
Note: See TracBrowser for help on using the repository browser.