Changeset 99c61f9 in mod_gnutls


Ignore:
Timestamp:
Jan 28, 2020, 3:37:37 AM (10 months ago)
Author:
Fiona Klute <fiona.klute@…>
Branches:
master, proxy-ticket
Children:
e46d203
Parents:
c5f8e85
Message:

Add configure option --enable-valgrind-test to run tests with Valgrind

Also includes suppressions for known issues not caused by mod_gnutls.

Files:
1 added
5 edited

Legend:

Unmodified
Added
Removed
  • configure.ac

    rc5f8e85 r99c61f9  
    8787AM_PATH_PYTHON([3])
    8888AX_PYTHON_MODULE([yaml], [fatal])
     89
     90dnl Enable testing with Valgrind? Default is "no".
     91AC_ARG_ENABLE([valgrind-test],
     92        AS_HELP_STRING([--enable-valgrind-test], [Enable running \
     93        tests with Valgrind (slow)]),
     94        [use_valgrind=$enableval], [use_valgrind=no])
     95AC_MSG_CHECKING([whether to run tests with Valgrind])
     96AC_MSG_RESULT([$use_valgrind])
     97AC_PATH_PROG([VALGRIND], [valgrind], [no])
     98AS_IF([test "${use_valgrind}" != "no" -a "${VALGRIND}" = "no"],
     99      [AC_MSG_ERROR([Valgrind test are enabled, but "valgrind" not \
     100      found in PATH!])])
     101AM_CONDITIONAL([ENABLE_VALGRIND], [test "${use_valgrind}" != "no"])
    89102
    90103dnl Optionally disable flock
  • test/Makefile.am

    rc5f8e85 r99c61f9  
    11SUBDIRS = tests
     2
     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
    212
    313# Generate the test scripts
    414test-%.bash: test-template.bash.in | tests/%/
    5         testname="$(*)"; sed s/@NUMBER@/$${testname%%_*}/ < $< > $@
     15        testname="$(*)"; \
     16        sed -e s/_NUM_/$${testname%%_*}/ -e 's,_VALGRIND_,$(valgrind),' < $< > $@
    617        chmod a+x $@
    718
     
    264275test_doc = README.md sample_fail.yml sample_test.yml
    265276
    266 EXTRA_DIST = $(apache_data) $(cert_templates) $(shared_identities:=/uid.in) \
     277EXTRA_DIST += $(apache_data) $(cert_templates) $(shared_identities:=/uid.in) \
    267278        authority/server/crl.template $(test_doc)
    268279
     
    318329endif
    319330
     331if ENABLE_VALGRIND
     332AM_TESTS_ENVIRONMENT += export VALGRIND="@VALGRIND@";
     333endif
     334
    320335if ENABLE_NETNS
    321336AM_TESTS_ENVIRONMENT += export UNSHARE="@UNSHARE@"; \
  • test/mgstest/services.py

    rc5f8e85 r99c61f9  
    158158
    159159    def __init__(self, config, env=None, pidfile=None, check=None,
    160                  valgrind_log=None):
     160                 valgrind_log=None, valgrind_suppress=[]):
    161161        self.config = Path(config).resolve()
    162162        base_cmd = [self.apache2, '-f', str(self.config), '-k']
    163163        start_cmd = base_cmd + ['start', '-DFOREGROUND']
    164164        if valgrind_log:
    165             start_cmd = ['valgrind', '-s', '--leak-check=full',
     165            valgrind = os.environ.get('VALGRIND', 'valgrind')
     166            suppress = [f'--suppressions={s}' for s in valgrind_suppress]
     167            start_cmd = [valgrind, '-s', '--leak-check=full',
    166168                         '--track-origins=yes', '--vgdb=no',
    167169                         f'--log-file={valgrind_log}'] \
    168                          + start_cmd
     170                         + suppress + start_cmd
    169171        if not check:
    170172            check = self.pidfile_check
  • test/runtest.py

    rc5f8e85 r99c61f9  
    118118    apache = ApacheService(config=os.path.join(testdir, 'apache.conf'),
    119119                           pidfile=f'apache2{pidaffix}.pid',
    120                            valgrind_log=valgrind_log)
     120                           valgrind_log=valgrind_log,
     121                           valgrind_suppress=args.valgrind_suppressions)
    121122    backend = ApacheService(config=os.path.join(testdir, 'backend.conf'),
    122123                            pidfile=f'backend{pidaffix}.pid')
     
    221222    parser.add_argument('--valgrind', action='store_true',
    222223                        help='run primary Apache instance with Valgrind')
     224    parser.add_argument('--valgrind-suppressions', action='append',
     225                        default=[],
     226                        help='use Valgrind suppressions file')
    223227
    224228    # enable bash completion if argcomplete is available
  • test/test-template.bash.in

    rc5f8e85 r99c61f9  
    11#!/bin/bash
    2 . ${srcdir}/netns_py.bash ${srcdir}/runtest.py --test-number @NUMBER@
     2. ${srcdir}/netns_py.bash ${srcdir}/runtest.py --test-number _NUM_ _VALGRIND_
Note: See TracChangeset for help on using the changeset viewer.