Files
bind9/bin/tests/system/Makefile.am
T
Michał Kępień 31e5ca4bd9 Rework get_ports.sh to make it not use a lock file
The get_ports.sh script is used for determining the range of ports a
given system test should use.  It first determines the start of the port
range to return (the base port); it can either be specified explicitly
by the caller or chosen randomly.  Subsequent ports are picked
sequentially, starting from the base port.  To ensure no single port is
used by multiple tests, a state file (get_ports.state) containing the
last assigned port is maintained by the script.  Concurrent access to
the state file is protected by a lock file (get_ports.lock); if one
instance of the script holds the lock file while another instance tries
to acquire it, the latter retries its attempt to acquire the lock file
after sleeping for 1 second; this retry process can be repeated up to 10
times before the script returns an error.

There are some problems with this approach:

  - the sleep period in case of failure to acquire the lock file is
    fixed, which leads to a "thundering herd" type of problem, where
    (depending on how processes are scheduled by the operating system)
    multiple system tests try to acquire the lock file at the same time
    and subsequently sleep for 1 second, only for the same situation to
    likely happen the next time around,

  - the lock file is being locked and then unlocked for every single
    port assignment made, not just once for the entire range of ports a
    system test should use; in other words, the lock file is currently
    locked and unlocked 13 times per system test; this increases the
    odds of the "thundering herd" problem described above preventing a
    system test from getting one or more ports assigned before the
    maximum retry count is reached (assuming multiple system tests are
    run in parallel); it also enables the range of ports used by a given
    system test to be non-sequential (which is a rather cosmetic issue,
    but one that can make log interpretation harder than necessary when
    test failures are diagnosed),

  - both issues described above cause unnecessary delays when multiple
    system tests are started in parallel (due to high lock file
    contention among the system tests being started),

  - maintaining a state file requires ensuring proper locking, which
    complicates the script's source code.

Rework the get_ports.sh script so that it assigns non-overlapping port
ranges to its callers without using a state file or a lock file:

  - add a new command line switch, "-t", which takes the name of the
    system test to assign ports for,

  - ensure every instance of get_ports.sh knows how many ports all
    system tests which form the test suite are going to need in total
    (based on the number of subdirectories found in bin/tests/system/),

  - in order to ensure all instances of get_ports.sh work on the same
    global port range (so that no port range collisions happen), a
    stable (throughout the expected run time of a single system test
    suite) base port selection method is used instead of the random one;
    specifically, the base port, unless specified explicitly using the
    "-p" command line switch, is derived from the number of hours which
    passed since the Unix Epoch time,

  - use the name of the system test to assign ports for (passed via the
    new "-t" command line switch) as a unique index into the global
    system test range, to ensure all system tests use disjoint port
    ranges.
2021-04-08 11:12:37 +02:00

245 lines
3.8 KiB
Makefile

include $(top_srcdir)/Makefile.top
EXTRA_DIST = .
# Source tarballs must not contain configure/build artifacts.
dist-hook:
git clean -n -x -d | \
grep -v "Makefile.in$$" | \
sed -n "s|^Would remove \(.*\)|$(distdir)/\1|p" | \
xargs -I{} rm -rf "{}"
SUBDIRS = dyndb/driver dlzexternal/driver hooks/driver
AM_CPPFLAGS += \
$(LIBISC_CFLAGS)
LDADD = \
$(LIBISC_LIBS)
if HAVE_PERL
check_PROGRAMS = \
feature-test \
makejournal \
pipelined/pipequeries \
rndc/gencheck \
rpz/dnsrps \
tkey/keycreate \
tkey/keydelete
feature_test_CPPFLAGS = \
$(AM_CPPFLAGS) \
$(LIBDNS_CFLAGS)
makejournal_CPPFLAGS = \
$(AM_CPPFLAGS) \
$(LIBDNS_CFLAGS)
makejournal_LDADD = \
$(LDADD) \
$(LIBDNS_LIBS)
pipelined_pipequeries_CPPFLAGS = \
$(AM_CPPFLAGS) \
$(LIBDNS_CFLAGS)
pipelined_pipequeries_LDADD = \
$(LDADD) \
$(LIBDNS_LIBS)
tkey_keycreate_CPPFLAGS = \
$(AM_CPPFLAGS) \
$(LIBDNS_CFLAGS)
tkey_keycreate_LDADD = \
$(LDADD) \
$(LIBDNS_LIBS)
tkey_keydelete_CPPFLAGS = \
$(AM_CPPFLAGS) \
$(LIBDNS_CFLAGS)
tkey_keydelete_LDADD = \
$(LDADD) \
$(LIBDNS_LIBS)
TESTS =
if HAVE_PERLMOD_TIME_HIRES
TESTS += serve-stale
endif HAVE_PERLMOD_TIME_HIRES
if HAVE_PERLMOD_NET_DNS
TESTS += \
rpzrecurse
endif HAVE_PERLMOD_NET_DNS
TESTS += \
acl \
additional \
addzone \
allow-query \
auth \
autosign \
builtin \
cacheclean \
case \
catz \
cds \
checkconf \
checknames \
checkzone \
cpu \
database \
dlz \
dlzexternal \
dns64 \
doth \
dscp \
dsdigest \
dyndb \
ecdsa \
eddsa \
ednscompliance \
emptyzones \
filter-aaaa \
formerr \
geoip2 \
glue \
idna \
include-multiplecfg \
inline \
integrity \
hooks \
journal \
keepalive \
legacy \
limits \
logfileconfig \
masterfile \
masterformat \
metadata \
mirror \
mkeys \
names \
notify \
nsec3 \
nslookup \
padding \
pending \
redirect \
rndc \
rootkeysentinel \
rpz \
rrchecker \
rrl \
rrsetorder \
rsabigexponent \
runtime \
sfcache \
smartsign \
sortlist \
spf \
staticstub \
stub \
synthfromdnssec \
tkey \
tools \
tsig \
tsiggss \
ttl \
unknown \
verify \
views \
wildcard \
xferquota \
zonechecks
# The "stress" test is not run by default since it creates enough
# load on the machine to make it unusable to other users.
# The "dialup", "delzone", and "dupsigs" tests are also not run by
# default because they take a very long time to complete.
# TESTS += delzone dialup dupsigs stress
if HAVE_LMDB
TESTS += nzd2nzf
endif # HAVE_LMDB
if HAVE_PERLMOD_NET_DNS
TESTS += \
digdelv \
fetchlimit \
forward \
ixfr \
nsupdate \
resolver \
statistics \
upforwd \
zero
if HAVE_DNSTAP
TESTS += dnstap
endif
if HAVE_PERLMOD_FILE_FETCH
TESTS += statschannel
endif HAVE_PERLMOD_FILE_FETCH
if HAVE_PERLMOD_DIGEST_HMAC
TESTS += xfer
endif HAVE_PERLMOD_DIGEST_HMAC
if HAVE_PERLMOD_NET_DNS_NAMESERVER
TESTS += reclimit
endif HAVE_PERLMOD_NET_DNS_NAMESERVER
endif HAVE_PERLMOD_NET_DNS
if HAVE_PYTHON
TESTS += kasp keymgr2kasp tcp pipelined
if HAVE_PYMOD_DNS
TESTS += qmin cookie timeouts
if HAVE_PERLMOD_NET_DNS
TESTS += dnssec
if HAVE_PERLMOD_NET_DNS_NAMESERVER
TESTS += chain
endif HAVE_PERLMOD_NET_DNS_NAMESERVER
endif HAVE_PERLMOD_NET_DNS
if HAVE_PYTEST
TESTS += rpzextra shutdown
endif
endif HAVE_PYMOD_DNS
endif HAVE_PYTHON
if HAVE_PKCS11
TESTS += pkcs11
endif
else !HAVE_PERL
check:
echo Perl is not available, no tests were ran
exit 1
endif !HAVE_PERL
LOG_DRIVER_V = $(LOG_DRIVER_V_@AM_V@)
LOG_DRIVER_V_ = $(LOG_DRIVER_V_@AM_DEFAULT_V@)
LOG_DRIVER_V_0 = --verbose no
LOG_DRIVER_V_1 = --verbose yes
LOG_DRIVER = $(srcdir)/custom-test-driver
AM_LOG_DRIVER_FLAGS = $(LOG_DRIVER_V)
LOG_COMPILER = $(builddir)/run.sh
AM_LOG_FLAGS = -r
$(TESTS): run.sh
test-local: check