source: mod_gnutls/test/TestMakefile @ 50eab8e

debian/masterdebian/stretch-backportsjessie-backportsupstream
Last change on this file since 50eab8e was 50eab8e, checked in by Thomas Klute <thomas2.klute@…>, 4 years ago

Test suite: Configure max wait time for instance locks from Makefile.am

The increased maximum (30 seconds) should help to avoid false failures
with parallel builds on slow systems.

  • Property mode set to 100644
File size: 4.9 KB
Line 
1#!/usr/bin/make -f
2
3# Author: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
4
5# run these tests to ensure that mod_gnutls can handle a range of
6# simple configuration choices.
7
8export srcdir ?= .
9# If the Apache binary is not set, try to find apache2 in default PATH
10# (should only happen when the test script is run manually)
11export APACHE2 ?= apache2
12
13export TEST_HOST ?= localhost
14export TEST_IP ?= ::1
15# chosen at random:
16export TEST_PORT ?= 9932
17export MSVA_PORT ?= 9933
18
19export TEST_GAP ?= 0.4
20export TEST_MSVA_MAX_WAIT ?= 10
21export TEST_QUERY_DELAY ?= 30
22export TEST_LOCK_WAIT ?= 30
23
24TEST_LOCK := ./test.lock
25
26all: setup.done
27        TEST_LOCK=$(TEST_LOCK) $(srcdir)/runtests
28
29t-%: setup.done
30        TEST_LOCK=$(TEST_LOCK) $(srcdir)/runtests $@
31
32
33
34
35
36### for setting up a little miniature CA + server + client environment:
37identities := server authority client imposter rogueca
38tokens := x509.pem secring.gpg secret.key cert.pgp secret.pgp
39all_tokens := $(foreach id,$(identities),$(foreach token,$(tokens),$(id)/$(token)))
40
41%.template: $(srcdir)/%.template.in
42        sed s/__HOSTNAME__/$(TEST_HOST)/ < $< > $@
43
44%.uid: $(srcdir)/%.uid.in
45        sed s/__HOSTNAME__/$(TEST_HOST)/ < $< > $@
46
47%/secret.key:
48        mkdir -p $(dir $@)
49        chmod 0700 $(dir $@)
50        certtool --generate-privkey > $@
51
52%/secring.gpg: %.uid %/secret.key
53        rm -f $(dir $@)pubring.gpg $(dir $@)secring.gpg $(dir $@)trustdb.gpg
54        PEM2OPENPGP_EXPIRATION=86400 PEM2OPENPGP_USAGE_FLAGS=authenticate,certify,sign pem2openpgp "$$(cat $<)" < $(dir $@)secret.key | GNUPGHOME=$(dir $@) gpg --import
55        printf "%s:6:\n" "$$(GNUPGHOME=$(dir $@) gpg --with-colons --list-secret-keys --fingerprint | grep ^fpr: | cut -f 10 -d :)" | GNUPGHOME=$(dir $@) gpg --import-ownertrust
56
57%/gpg.conf: %/secring.gpg
58        printf "default-key %s\n" "$$(GNUPGHOME=$(dir $@) gpg --with-colons --list-secret-keys --fingerprint | grep ^fpr: | cut -f 10 -d :)" > $@
59
60%/secret.pgp: %/secring.gpg
61        GNUPGHOME=$(dir $@) gpg --armor --batch --no-tty --yes --export-secret-key "$$(GNUPGHOME=$(dir $@) gpg --with-colons --list-secret-keys --fingerprint | grep ^fpr: | cut -f 10 -d :)" > $@
62
63%/minimal.pgp: %/secring.gpg
64        GNUPGHOME=$(dir $@) gpg --armor --export "$$(GNUPGHOME=$(dir $@) gpg --with-colons --list-secret-keys --fingerprint | grep ^fpr: | cut -f 10 -d :)" > $@
65
66# Import and signing modify the shared keyring, which leads to race
67# conditions with parallel make. Locking avoids this problem.
68%/cert.pgp: %/minimal.pgp authority/gpg.conf
69        GNUPGHOME=authority flock authority/lock gpg --import $<
70        GNUPGHOME=authority flock authority/lock gpg --batch --sign-key --no-tty --yes "$$(GNUPGHOME=$(dir $@) gpg --with-colons --list-secret-keys --fingerprint | grep ^fpr: | cut -f 10 -d :)"
71        GNUPGHOME=authority gpg --armor --export "$$(GNUPGHOME=$(dir $@) gpg --with-colons --list-secret-keys --fingerprint | grep ^fpr: | cut -f 10 -d :)" > $@
72
73# special cases for the authorities' root certs:
74authority/x509.pem: authority.template authority/secret.key
75        certtool --generate-self-signed --load-privkey authority/secret.key --template authority.template > $@
76rogueca/x509.pem: $(srcdir)/rogueca.template rogueca/secret.key
77        certtool --generate-self-signed --load-privkey rogueca/secret.key --template $(srcdir)/rogueca.template > $@
78
79%/cert-request: %.template %/secret.key
80        certtool --generate-request --load-privkey $(dir $@)secret.key --template $< > $@
81
82%/x509.pem: %.template %/cert-request authority/secret.key authority/x509.pem
83        certtool --generate-certificate --load-ca-certificate authority/x509.pem --load-ca-privkey authority/secret.key --load-request $(dir $@)cert-request --template $< > $@
84
85%/softhsm.db: %/x509.pem %/secret.key
86        SOFTHSM_CONF="$(srcdir)/$(*)-softhsm.conf" $(srcdir)/softhsm.bash init $(dir $@)secret.key $(dir $@)x509.pem
87
88# Generate CRL revoking a certain certificate. Currently used to
89# revoke the server certificate and check if setting the CRL as
90# GnuTLSProxyCRLFile causes the connection to the back end server to
91# fail.
92%/crl.pem: %/x509.pem ${srcdir}/%-crl.template
93        certtool --generate-crl \
94                --load-ca-privkey authority/secret.key \
95                --load-ca-certificate authority/x509.pem \
96                --load-certificate $< \
97                --template "${srcdir}/$(*)-crl.template" \
98                > $@
99
100msva.gnupghome/trustdb.gpg: authority/minimal.pgp client/cert.pgp
101        mkdir -p -m 0700 $(dir $@)
102        GNUPGHOME=$(dir $@) gpg --import < $<
103        printf "%s:6:\n" "$$(GNUPGHOME=authority gpg --with-colons --list-secret-keys --fingerprint | grep ^fpr: | cut -f 10 -d :)" | GNUPGHOME=$(dir $@) gpg --import-ownertrust
104        GNUPGHOME=$(dir $@) gpg --import < client/cert.pgp
105        printf "keyserver does-not-exist.example\n" > msva.gnupghome/gpg.conf
106
107
108setup.done: $(all_tokens) msva.gnupghome/trustdb.gpg client.uid
109        mkdir -p logs cache outputs
110        touch setup.done
111
112
113clean:
114        rm -rf server client authority logs cache outputs setup.done \
115        server.template imposter.template msva.gnupghome \
116        */*.pgp */*.gpg */*.gpg~ */*.pem */*.key authority.template \
117        client.template client.uid server.uid *.lock tests/*/*.pem
118        rmdir imposter rogueca || true
119
120.PHONY: all clean
Note: See TracBrowser for help on using the repository browser.