Changeset 9a4d250 in mod_gnutls


Ignore:
Timestamp:
Oct 18, 2015, 10:42:58 AM (4 years ago)
Author:
Thomas Klute <thomas2.klute@…>
Branches:
debian/master, debian/stretch-backports, jessie-backports, master, upstream
Children:
fc8e463
Parents:
f9f184f
Message:

Avoid external make calls for test environment setup

All targets needed to set up the test suite environment are now
directly handled by the makefile created through automake, avoiding
any external make calls. The rules for X.509 and PGP certificate
management are included from the old test makefile through automake.

Note that those included rules use syntax that automake warns is GNU
make specific and might not work with other make implementations. This
is not a regression, just increased visibility, so automake
portability warnings are ignored.

Files:
4 edited

Legend:

Unmodified
Added
Removed
  • README

    rf9f184f r9a4d250  
    2424 * GnuTLS          >= 3.1.4 <http://www.gnutls.org/> (3.2.* or newer preferred)
    2525 * Apache HTTPD    >= 2.2 <http://httpd.apache.org/> (2.4.* preferred)
    26  * autotools & gcc
     26 * autotools, GNU make, & gcc
    2727 * APR Memcache    >= 0.7.0 (Optional)
    2828 * libmsv          >= 0.1 (Optional, enable with ./configure --enable-msva)
  • configure.ac

    rf9f184f r9a4d250  
    1010AM_MAINTAINER_MODE
    1111AC_CANONICAL_TARGET
    12 AM_INIT_AUTOMAKE
     12# mod_gnutls test suite requires GNU make
     13AM_INIT_AUTOMAKE([-Wno-portability])
    1314AM_CONFIG_HEADER(include/mod_gnutls_config.h:config.in)
    1415
  • test/Makefile.am

    rf9f184f r9a4d250  
    3131TESTS = $(dist_check_SCRIPTS)
    3232
     33# Identities in the miniature CA, server, and client environment for
     34# the test suite
     35identities = server authority client imposter rogueca
     36# Append strings after ":=" to each identity to generate a list of
     37# necessary files
     38pgp_tokens = $(identities:=/secring.gpg) $(identities:=/cert.pgp) \
     39        $(identities:=/secret.pgp)
     40x509_keys = $(identities:=/secret.key)
     41x509_certs = $(identities:=/x509.pem)
     42x509_tokens = $(x509_certs) $(x509_keys)
     43tokens = $(x509_tokens) $(pgp_tokens)
     44
     45include $(srcdir)/TestMakefile
     46
    3347# Test cases trying to create keys and certificates in parallel causes
    3448# race conditions. Ensure that all keys and certificates are generated
     
    4155# running at any time, so test cases actually have to wait for each
    4256# other - just not in any particular order.
    43 check_DATA = setup.done server/crl.pem
     57check_DATA = $(tokens) server/crl.pem
    4458
    4559MOSTLYCLEANFILES = cache/* logs/* outputs/* server/crl.pem
     
    5064        imposter.template server.template
    5165
     66# Delete X.509 private keys on full clean. Note that unless you need
     67# to generate fresh keys, the "mostlyclean" target should be
     68# sufficient (see below).
     69CLEANFILES = $(x509_keys)
     70
    5271# Delete X.509 certificates and generated templates on "mostlyclean"
    5372# target. Certificates can be rebuilt without generating new key
     
    5574# (e.g. host names) without wasting entropy on new keys (which would
    5675# happen after "clean").
    57 MOSTLYCLEANFILES += */x509.pem $(generated_templates)
     76MOSTLYCLEANFILES += */x509.pem $(generated_templates) *.uid
     77
    5878
    5979# Delete PGP keyrings on "mostlyclean" target. They are created from
     
    6181# one day, so regenerating them is both fast and frequently
    6282# necessary.
    63 MOSTLYCLEANFILES += */*.pgp */*.gpg */*.gpg~ */gpg.conf
     83MOSTLYCLEANFILES += */*.pgp */*.gpg */*.gpg~ */gpg.conf authority/lock
     84# GnuPG random pool, no need to regenerate on every build
     85CLEANFILES += authority/random_seed
    6486
    65 clean-local:
    66         $(MAKE) -f $(srcdir)/TestMakefile $(AM_MAKEFLAGS) clean
     87# Delete lock files for test servers on "mostlyclean" target.
     88MOSTLYCLEANFILES += *.lock
     89
     90# rule to build MSVA trust database
     91if USE_MSVA
     92msva_home = msva.gnupghome
     93check_DATA += $(msva_home)/trustdb.gpg client.uid
     94MOSTLYCLEANFILES += $(msva_home)/trustdb.gpg
     95$(msva_home)/trustdb.gpg: authority/minimal.pgp client/cert.pgp
     96        mkdir -p -m 0700 $(dir $@)
     97        GNUPGHOME=$(dir $@) gpg --import < $<
     98        printf "%s:6:\n" "$$(GNUPGHOME=authority gpg --with-colons --list-secret-keys --fingerprint | grep ^fpr: | cut -f 10 -d :)" | GNUPGHOME=$(dir $@) gpg --import-ownertrust
     99        GNUPGHOME=$(dir $@) gpg --import < client/cert.pgp
     100        printf "keyserver does-not-exist.example\n" > $(msva_home)/gpg.conf
     101endif
    67102
    68103# SoftHSM files
    69104check_DATA += server/softhsm.db
    70 MOSTLYCLEANFILES += tests/24_pkcs11_cert/softhsm.conf
     105MOSTLYCLEANFILES += tests/24_pkcs11_cert/softhsm.conf server/softhsm.db
    71106
    72 # This rule can be used for any TestMakefile target not included in
    73 # setup.done. The dependency on setup.done is used to avoid race
    74 # conditions between multiple calls to TestMakefile for key and
    75 # certificate generation. It is ignored for setup.done itself.
    76 .PHONY: setup.done
    77 server/crl.pem server/softhsm.db setup.done: setup.done
    78         TEST_HOST="$(TEST_HOST)" TEST_IP="$(TEST_IP)" srcdir=$(srcdir) \
    79         $(MAKE) -f $(srcdir)/TestMakefile $(AM_MAKEFLAGS) $@
    80107
     108check_DATA += make-test-dirs
     109extra_dirs = logs cache outputs
     110make-test-dirs:
     111        mkdir -p $(extra_dirs)
     112.PHONY: make-test-dirs
     113
     114clean-local:
     115        -rmdir $(identities) || true
     116        -rmdir $(extra_dirs) || true
     117if USE_MSVA
     118        -rmdir $(msva_home) || true
     119endif
     120
     121# Apache configuration and data files
    81122apache_data = base_apache.conf cgi_module.conf data/* mime.types proxy_mods.conf
    82123
  • test/TestMakefile

    rf9f184f r9a4d250  
    11#!/usr/bin/make -f
     2# Authors:
     3# Daniel Kahn Gillmor <dkg@fifthhorseman.net>
     4# Thomas Klute <thomas2.klute@uni-dortmund.de>
    25
    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 
    8 export 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)
    11 export APACHE2 ?= apache2
    12 
    13 export TEST_HOST ?= localhost
    14 
    15 
    16 
    17 
    18 
    19 ### for setting up a little miniature CA + server + client environment:
    20 identities := server authority client imposter rogueca
    21 tokens := x509.pem secring.gpg secret.key cert.pgp secret.pgp
    22 all_tokens := $(foreach id,$(identities),$(foreach token,$(tokens),$(id)/$(token)))
     6# General rules to set up a miniature CA & server & client environment
     7# for the test suite
    238
    249%.template: $(srcdir)/%.template.in
     
    8065                --template "${srcdir}/$(*)-crl.template" \
    8166                > $@
    82 
    83 msva.gnupghome/trustdb.gpg: authority/minimal.pgp client/cert.pgp
    84         mkdir -p -m 0700 $(dir $@)
    85         GNUPGHOME=$(dir $@) gpg --import < $<
    86         printf "%s:6:\n" "$$(GNUPGHOME=authority gpg --with-colons --list-secret-keys --fingerprint | grep ^fpr: | cut -f 10 -d :)" | GNUPGHOME=$(dir $@) gpg --import-ownertrust
    87         GNUPGHOME=$(dir $@) gpg --import < client/cert.pgp
    88         printf "keyserver does-not-exist.example\n" > msva.gnupghome/gpg.conf
    89 
    90 
    91 setup.done: $(all_tokens) msva.gnupghome/trustdb.gpg client.uid
    92         mkdir -p logs cache outputs
    93 
    94 clean:
    95         rm -rf server client authority logs cache outputs setup.done \
    96         server.template imposter.template msva.gnupghome \
    97         */*.pgp */*.gpg */*.gpg~ */*.pem */*.key authority.template \
    98         client.template client.uid server.uid *.lock tests/*/*.pem
    99         rmdir imposter rogueca || true
    100 
    101 .PHONY: all clean setup.done
Note: See TracChangeset for help on using the changeset viewer.