2
0
mirror of https://gitlab.isc.org/isc-projects/kea synced 2025-08-31 05:55:28 +00:00

[#1642] make gtests, shtests, pytests sequential

This commit is contained in:
Andrei Pavel
2021-06-04 12:19:42 +03:00
parent fbaf186be1
commit 960c74a45f
11 changed files with 215 additions and 240 deletions

View File

@@ -1,34 +1,32 @@
SUBDIRS = data .
SHTESTS =
# Add to the tarball:
EXTRA_DIST =
EXTRA_DIST += dhcpdb_create_1.0.mysql
EXTRA_DIST += dhcpdb_create_1.0.pgsql
EXTRA_DIST += dhcpdb_create_1.0.cql
# Shell tests
SHTESTS =
SHTESTS += admin_tests.sh
SHTESTS += memfile_tests.sh
if HAVE_MYSQL
SHTESTS += mysql_tests.sh
endif
if HAVE_PGSQL
SHTESTS += pgsql_tests.sh
endif
if HAVE_CQL
SHTESTS += cql_tests.sh
endif
# Run tests on "make check".
check_SCRIPTS = $(SHTESTS)
TESTS = $(SHTESTS)
# As with every file generated by ./configure, clean them up when running
# "make distclean", but not on "make clean".
DISTCLEANFILES = $(SHTESTS)
# Don't install shell tests.
noinst_SCRIPTS = $(SHTESTS)
EXTRA_DIST = dhcpdb_create_1.0.mysql
EXTRA_DIST += dhcpdb_create_1.0.pgsql
EXTRA_DIST += dhcpdb_create_1.0.cql
CLEANFILES = *.log
DISTCLEANFILES = memfile_tests.sh mysql_tests.sh pgsql_tests.sh cql_tests.sh
# Execute all test scripts.
check-local:
for shtest in $(SHTESTS) ; do \
echo Running test: $$shtest ; \
chmod +x $(abs_builddir)/$$shtest ; \
${SHELL} $(abs_builddir)/$$shtest || exit ; \
done

View File

@@ -122,11 +122,6 @@ memfile_init_test() {
clean_up
clean_exit 1
fi
export KEA_LOCKFILE_DIR="@abs_top_builddir@/src/bin/admin/tests/lock_dir_${v}"
export KEA_PIDFILE_DIR="@abs_top_builddir@/src/bin/admin/tests/pid_dir_${v}"
export KEA_LFC_EXECUTABLE="@abs_top_builddir@/src/bin/lfc/kea-lfc"
mkdir -p "${KEA_LOCKFILE_DIR}"
mkdir -p "${KEA_PIDFILE_DIR}"
start_kea_dhcp "${v}"
# This assumes that the CSV creation + writing to CSV is atomic. Not
# sure if it is, but if this ever fails on the comparison further below,
@@ -151,8 +146,6 @@ memfile_init_test() {
fi
clean_up
unset KEA_LOCKFILE_DIR
unset KEA_PIDFILE_DIR
done
test_finish 0

View File

@@ -1,21 +1,29 @@
SHTESTS =
# The test of dynamic reconfiguration based on signals will work only
# if we are using file based configuration approach.
SHTESTS += ca_process_tests.sh
SUBDIRS = .
noinst_SCRIPTS = ca_process_tests.sh
# Add to the tarball:
EXTRA_DIST = testdata/get_config.json
EXTRA_DIST = ca_process_tests.sh.in
EXTRA_DIST += testdata/get_config.json
TESTS_ENVIRONMENT = \
$(LIBTOOL) --mode=execute $(VALGRIND_COMMAND)
# test using command-line arguments, so use check-local target instead of TESTS
check-local:
for shtest in $(SHTESTS) ; do \
echo Running test: $$shtest ; \
export KEA_LOCKFILE_DIR=$(abs_top_builddir); \
export KEA_PIDFILE_DIR=$(abs_top_builddir); \
${SHELL} $(abs_builddir)/$$shtest || exit ; \
done
# Shell tests
SHTESTS = ca_process_tests.sh
# Run shell tests on "make check".
check_SCRIPTS = $(SHTESTS)
TESTS = $(SHTESTS)
# As with every file generated by ./configure, clean them up when running
# "make distclean", but not on "make clean".
DISTCLEANFILES = $(SHTESTS)
# Don't install shell tests.
noinst_SCRIPTS = $(SHTESTS)
if HAVE_GTEST
# C++ tests
PROGRAM_TESTS = ca_unittests
AM_CPPFLAGS = -I$(top_srcdir)/src/lib -I$(top_builddir)/src/lib
AM_CPPFLAGS += -I$(top_srcdir)/src/bin -I$(top_builddir)/src/bin
@@ -25,28 +33,12 @@ AM_CPPFLAGS += -DINSTALL_PROG=\"$(abs_top_srcdir)/install-sh\"
AM_CPPFLAGS += -DCFG_EXAMPLES=\"$(abs_top_srcdir)/doc/examples/agent\"
AM_CPPFLAGS += -DSYNTAX_FILE=\"$(abs_srcdir)/../agent_parser.yy\"
CLEANFILES = $(builddir)/interfaces.txt $(builddir)/logger_lockfile
DISTCLEANFILES = ca_process_tests.sh tls_ca_process_tests.sh
DISTCLEANFILES += test_data_files_config.h test_basic_auth_libraries.h
DISTCLEANFILES += test_callout_libraries.h
AM_CXXFLAGS = $(KEA_CXXFLAGS)
if USE_STATIC_LINK
AM_LDFLAGS = -static
endif
TESTS_ENVIRONMENT = \
$(LIBTOOL) --mode=execute $(VALGRIND_COMMAND)
TESTS =
if HAVE_GTEST
noinst_LTLIBRARIES = libcallout.la libbasicauth.la
TESTS += ca_unittests
ca_unittests_SOURCES = ca_cfg_mgr_unittests.cc
ca_unittests_SOURCES += ca_command_mgr_unittests.cc
ca_unittests_SOURCES += ca_controller_unittests.cc
@@ -110,6 +102,19 @@ nodist_ca_unittests_SOURCES = test_data_files_config.h
nodist_ca_unittests_SOURCES += test_basic_auth_libraries.h
nodist_ca_unittests_SOURCES += test_callout_libraries.h
endif
# Run C++ tests on "make check".
TESTS += $(PROGRAM_TESTS)
noinst_PROGRAMS = $(TESTS)
# As with every file generated by ./configure, clean them up when running
# "make distclean", but not on "make clean".
DISTCLEANFILES += test_basic_auth_libraries.h
DISTCLEANFILES += test_callout_libraries.h
DISTCLEANFILES += test_data_files_config.h
# Don't install test libraries.
noinst_LTLIBRARIES = libcallout.la libbasicauth.la
# Don't install C++ tests.
noinst_PROGRAMS = $(PROGRAM_TESTS)
endif

View File

@@ -1,21 +1,31 @@
SHTESTS =
# The test of dynamic reconfiguration based on signals will work only
# if we are using file based configuration approach.
SHTESTS += d2_process_tests.sh
SUBDIRS = .
noinst_SCRIPTS = d2_process_tests.sh
# Add to the tarball:
EXTRA_DIST =
EXTRA_DIST += testdata/d2_cfg_tests.json
EXTRA_DIST += testdata/get_config.json
EXTRA_DIST = d2_process_tests.sh.in
EXTRA_DIST += testdata/d2_cfg_tests.json testdata/get_config.json
TESTS_ENVIRONMENT = \
$(LIBTOOL) --mode=execute $(VALGRIND_COMMAND)
# test using command-line arguments, so use check-local target instead of TESTS
check-local:
for shtest in $(SHTESTS) ; do \
echo Running test: $$shtest ; \
export KEA_LOCKFILE_DIR=$(abs_top_builddir); \
export KEA_PIDFILE_DIR=$(abs_top_builddir); \
${SHELL} $(abs_builddir)/$$shtest || exit ; \
done
# Shell tests
SHTESTS = d2_process_tests.sh
# Run shell tests on "make check".
check_SCRIPTS = $(SHTESTS)
TESTS = $(SHTESTS)
# As with every file generated by ./configure, clean them up when running
# "make distclean", but not on "make clean".
DISTCLEANFILES = $(SHTESTS)
# Don't install shell tests.
noinst_SCRIPTS = $(SHTESTS)
if HAVE_GTEST
# C++ tests
PROGRAM_TESTS = d2_unittests
AM_CPPFLAGS = -I$(top_srcdir)/src/lib -I$(top_builddir)/src/lib
AM_CPPFLAGS += -I$(top_srcdir)/src/bin -I$(top_builddir)/src/bin
@@ -25,27 +35,12 @@ AM_CPPFLAGS += -DINSTALL_PROG=\"$(abs_top_srcdir)/install-sh\"
AM_CPPFLAGS += -DCFG_EXAMPLES=\"$(abs_top_srcdir)/doc/examples/ddns\"
AM_CPPFLAGS += -DSYNTAX_FILE=\"$(abs_srcdir)/../d2_parser.yy\"
CLEANFILES = $(builddir)/interfaces.txt $(builddir)/logger_lockfile
DISTCLEANFILES = d2_process_tests.sh test_data_files_config.h
DISTCLEANFILES += test_data_files_config.h test_libraries.h
AM_CXXFLAGS = $(KEA_CXXFLAGS)
if USE_STATIC_LINK
AM_LDFLAGS = -static
endif
TESTS_ENVIRONMENT = \
$(LIBTOOL) --mode=execute $(VALGRIND_COMMAND)
TESTS =
if HAVE_GTEST
noinst_LTLIBRARIES = libcallout.la
TESTS += d2_unittests
d2_unittests_SOURCES = d2_unittests.cc
d2_unittests_SOURCES += d2_process_unittests.cc
d2_unittests_SOURCES += d2_cfg_mgr_unittests.cc
@@ -112,8 +107,22 @@ libcallout_la_LIBADD += $(top_builddir)/src/lib/hooks/libkea-hooks.la
libcallout_la_LIBADD += $(top_builddir)/src/lib/log/libkea-log.la
libcallout_la_LDFLAGS = -avoid-version -export-dynamic -module -rpath /nowhere
nodist_d2_unittests_SOURCES = test_data_files_config.h test_libraries.h
noinst_LTLIBRARIES = libcallout.la
nodist_d2_unittests_SOURCES =
nodist_d2_unittests_SOURCES += test_data_files_config.h
nodist_d2_unittests_SOURCES += test_libraries.h
# Run C++ tests on "make check".
TESTS += $(PROGRAM_TESTS)
# As with every file generated by ./configure, clean them up when running
# "make distclean", but not on "make clean".
DISTCLEANFILES += d2_process_tests.sh
DISTCLEANFILES += test_data_files_config.h
DISTCLEANFILES += test_libraries.h
# Don't install C++ tests.
noinst_PROGRAMS = $(PROGRAM_TESTS)
endif
noinst_PROGRAMS = $(TESTS)

View File

@@ -1,20 +1,29 @@
SHTESTS =
# The test of dynamic reconfiguration based on signals will work only
# if we are using file based configuration approach.
SHTESTS += dhcp4_process_tests.sh
SUBDIRS = .
noinst_SCRIPTS = dhcp4_process_tests.sh
# Add to the tarball:
EXTRA_DIST = get_config_unittest.cc.skel
EXTRA_DIST = dhcp4_process_tests.sh.in get_config_unittest.cc.skel
TESTS_ENVIRONMENT = \
$(LIBTOOL) --mode=execute $(VALGRIND_COMMAND)
# test using command-line arguments, so use check-local target instead of TESTS
check-local:
for shtest in $(SHTESTS) ; do \
echo Running test: $$shtest ; \
export KEA_LOCKFILE_DIR=$(abs_top_builddir); \
export KEA_PIDFILE_DIR=$(abs_top_builddir); \
${SHELL} $(abs_builddir)/$$shtest || exit ; \
done
# Shell tests
SHTESTS = dhcp4_process_tests.sh
# Run shell tests on "make check".
check_SCRIPTS = $(SHTESTS)
TESTS = $(SHTESTS)
# As with every file generated by ./configure, clean them up when running
# "make distclean", but not on "make clean".
DISTCLEANFILES = $(SHTESTS)
# Don't install tests.
noinst_SCRIPTS = $(SHTESTS)
if HAVE_GTEST
# C++ tests
PROGRAM_TESTS = dhcp4_unittests
AM_CPPFLAGS = -I$(top_srcdir)/src/lib -I$(top_builddir)/src/lib
AM_CPPFLAGS += -I$(top_srcdir)/src -I$(top_builddir)/src
@@ -26,25 +35,12 @@ AM_CPPFLAGS += -DCFG_EXAMPLES=\"$(abs_top_srcdir)/doc/examples/kea4\"
AM_CPPFLAGS += -DSYNTAX_FILE=\"$(abs_srcdir)/../dhcp4_parser.yy\"
AM_CPPFLAGS += -DKEA_LFC_EXECUTABLE=\"$(abs_top_builddir)/src/bin/lfc/kea-lfc\"
CLEANFILES = $(builddir)/interfaces.txt $(builddir)/logger_lockfile
CLEANFILES += $(builddir)/load_marker.txt $(builddir)/unload_marker.txt
CLEANFILES += $(builddir)/test_leases.csv.*
CLEANFILES += *.json *.log
DISTCLEANFILES = dhcp4_process_tests.sh marker_file.h
DISTCLEANFILES += test_data_files_config.h test_libraries.h
AM_CXXFLAGS = $(KEA_CXXFLAGS)
if USE_STATIC_LINK
AM_LDFLAGS = -static
endif
TESTS_ENVIRONMENT = \
$(LIBTOOL) --mode=execute $(VALGRIND_COMMAND)
TESTS =
if HAVE_GTEST
# Build shared libraries for testing. The libtool way to create a shared library
# is to specify "-avoid-version -export-dynamic -module" in the library LDFLAGS
# (see http://www.gnu.org/software/libtool/manual/html_node/Link-mode.html).
@@ -58,8 +54,6 @@ if HAVE_GTEST
# to unexpected errors. For this reason, the --enable-static-link option is
# ignored for unit tests built here.
noinst_LTLIBRARIES = libco1.la libco2.la libco3.la
# -rpath /nowhere is a hack to trigger libtool to not create a
# convenience archive, resulting in shared modules
@@ -78,8 +72,6 @@ libco3_la_CXXFLAGS = $(AM_CXXFLAGS)
libco3_la_CPPFLAGS = $(AM_CPPFLAGS)
libco3_la_LDFLAGS = -avoid-version -export-dynamic -module -rpath /nowhere
TESTS += dhcp4_unittests
dhcp4_unittests_SOURCES = d2_unittest.h d2_unittest.cc
dhcp4_unittests_SOURCES += dhcp4_unittests.cc
dhcp4_unittests_SOURCES += dhcp4_srv_unittest.cc
@@ -167,11 +159,21 @@ dhcp4_unittests_LDADD += $(top_builddir)/src/lib/util/libkea-util.la
dhcp4_unittests_LDADD += $(top_builddir)/src/lib/exceptions/libkea-exceptions.la
dhcp4_unittests_LDADD += $(LOG4CPLUS_LIBS) $(CRYPTO_LIBS)
dhcp4_unittests_LDADD += $(BOOST_LIBS) $(GTEST_LDADD)
endif
noinst_EXTRA_DIST = configs-list.txt
# Run C++ tests on "make check".
TESTS += $(PROGRAM_TESTS)
noinst_PROGRAMS = $(TESTS)
# As with every file generated by ./configure, clean them up when running
# "make distclean", but not on "make clean".
DISTCLEANFILES += marker_file.h
DISTCLEANFILES += test_data_files_config.h
DISTCLEANFILES += test_libraries.h
# Don't install test libraries.
noinst_LTLIBRARIES = libco1.la libco2.la libco3.la
# Don't install C++ tests.
noinst_PROGRAMS = $(PROGRAM_TESTS)
# Use this target if you want to rebuild the get-config unit-tests.
#
@@ -190,3 +192,5 @@ rebuild-tests:
read -p "Press ENTER when ready"
touch get_config_unittest.cc
$(MAKE)
endif

View File

@@ -1,20 +1,29 @@
SHTESTS =
# The test of dynamic reconfiguration based on signals will work only
# if we are using file based configuration approach.
SHTESTS += dhcp6_process_tests.sh
SUBDIRS = .
noinst_SCRIPTS = dhcp6_process_tests.sh
# Add to the tarball:
EXTRA_DIST = get_config_unittest.cc.skel
EXTRA_DIST = dhcp6_process_tests.sh.in get_config_unittest.cc.skel
TESTS_ENVIRONMENT = \
$(LIBTOOL) --mode=execute $(VALGRIND_COMMAND)
# test using command-line arguments, so use check-local target instead of TESTS
check-local:
for shtest in $(SHTESTS) ; do \
echo Running test: $$shtest ; \
export KEA_LOCKFILE_DIR=$(abs_top_builddir); \
export KEA_PIDFILE_DIR=$(abs_top_builddir); \
${SHELL} $(abs_builddir)/$$shtest || exit ; \
done
# Shell tests
SHTESTS = dhcp6_process_tests.sh
# Run shell tests on "make check".
check_SCRIPTS = $(SHTESTS)
TESTS = $(SHTESTS)
# As with every file generated by ./configure, clean them up when running
# "make distclean", but not on "make clean".
DISTCLEANFILES = $(SHTESTS)
# Don't install shell tests.
noinst_SCRIPTS = $(SHTESTS)
if HAVE_GTEST
# C++ tests
PROGRAM_TESTS = dhcp6_unittests
AM_CPPFLAGS = -I$(top_srcdir)/src/lib -I$(top_builddir)/src/lib
AM_CPPFLAGS += -I$(top_srcdir)/src/bin -I$(top_builddir)/src/bin
@@ -27,25 +36,12 @@ AM_CPPFLAGS += -DCFG_EXAMPLES=\"$(abs_top_srcdir)/doc/examples/kea6\"
AM_CPPFLAGS += -DSYNTAX_FILE=\"$(abs_srcdir)/../dhcp6_parser.yy\"
AM_CPPFLAGS += -DKEA_LFC_EXECUTABLE=\"$(abs_top_builddir)/src/bin/lfc/kea-lfc\"
CLEANFILES = $(builddir)/logger_lockfile
CLEANFILES += $(builddir)/load_marker.txt $(builddir)/unload_marker.txt
CLEANFILES += $(builddir)/test_leases.csv.*
CLEANFILES += *.json *.log
DISTCLEANFILES = dhcp6_process_tests.sh marker_file.h
DISTCLEANFILES += test_data_files_config.h test_libraries.h
AM_CXXFLAGS = $(KEA_CXXFLAGS)
if USE_STATIC_LINK
AM_LDFLAGS = -static
endif
TESTS_ENVIRONMENT = \
$(LIBTOOL) --mode=execute $(VALGRIND_COMMAND)
TESTS =
if HAVE_GTEST
# Build shared libraries for testing. The libtool way to create a shared library
# is to specify "-avoid-version -export-dynamic -module" in the library LDFLAGS
# (see http://www.gnu.org/software/libtool/manual/html_node/Link-mode.html).
@@ -59,8 +55,6 @@ if HAVE_GTEST
# to unexpected errors. For this reason, the --enable-static-link option is
# ignored for unit tests built here.
noinst_LTLIBRARIES = libco1.la libco2.la libco3.la
# -rpath /nowhere is a hack to trigger libtool to not create a
# convenience archive, resulting in shared modules
@@ -79,8 +73,6 @@ libco3_la_CXXFLAGS = $(AM_CXXFLAGS)
libco3_la_CPPFLAGS = $(AM_CPPFLAGS)
libco3_la_LDFLAGS = -avoid-version -export-dynamic -module -rpath /nowhere
TESTS += dhcp6_unittests
# This list is ordered alphabetically. When adding new files, please maintain
# this order.
dhcp6_unittests_SOURCES = classify_unittests.cc
@@ -167,9 +159,21 @@ dhcp6_unittests_LDADD += $(top_builddir)/src/lib/util/libkea-util.la
dhcp6_unittests_LDADD += $(top_builddir)/src/lib/exceptions/libkea-exceptions.la
dhcp6_unittests_LDADD += $(LOG4CPLUS_LIBS) $(CRYPTO_LIBS)
dhcp6_unittests_LDADD += $(BOOST_LIBS) $(GTEST_LDADD)
endif
noinst_PROGRAMS = $(TESTS)
# Run C++ tests on "make check".
TESTS += $(PROGRAM_TESTS)
# As with every file generated by ./configure, clean them up when running
# "make distclean", but not on "make clean".
DISTCLEANFILES += marker_file.h
DISTCLEANFILES += test_data_files_config.h
DISTCLEANFILES += test_libraries.h
# Don't install test libraries.
noinst_LTLIBRARIES = libco1.la libco2.la libco3.la
# Don't install C++ tests.
noinst_PROGRAMS = $(PROGRAM_TESTS)
# Use this target if you want to rebuild the get-config unit-tests.
#
@@ -188,3 +192,5 @@ rebuild-tests:
read -p "Press ENTER when ready"
touch get_config_unittest.cc
$(MAKE)
endif

View File

@@ -1,22 +1,15 @@
SUBDIRS = .
# Shell tests
SHTESTS = keactrl_tests.sh
noinst_SCRIPTS = keactrl_tests.sh
# Run tests on "make check".
check_SCRIPTS = $(SHTESTS)
TESTS = $(SHTESTS)
CLEANFILES = *.log *.json *.saved
DISTCLEANFILES = keactrl_tests.sh
# As with every file generated by ./configure, clean them up when running
# "make distclean", but not on "make clean".
DISTCLEANFILES = $(SHTESTS)
EXTRA_DIST = keactrl_tests.sh.in
# Execute all test scripts.
check-local:
for shtest in $(SHTESTS) ; do \
echo Running test: $$shtest ; \
chmod +x $(abs_builddir)/$$shtest ; \
export KEA_LOCKFILE_DIR=$(abs_top_builddir); \
export KEACTRL_BUILD_DIR=$(abs_top_builddir); \
export KEA_PIDFILE_DIR=$(abs_top_builddir); \
export KEACTRL_CONF=$(abs_top_builddir)/src/bin/keactrl/tests/keactrl_test.conf; \
${SHELL} $(abs_builddir)/$$shtest || exit ; \
done
# Don't install shell tests.
noinst_SCRIPTS = $(SHTESTS)

View File

@@ -1,16 +1,4 @@
SHTESTS =
noinst_SCRIPTS =
EXTRA_DIST =
# test using command-line arguments, so use check-local target instead of TESTS
check-local:
for shtest in $(SHTESTS) ; do \
echo Running test: $$shtest ; \
export KEA_LOCKFILE_DIR=$(abs_top_builddir); \
${SHELL} $(abs_builddir)/$$shtest || exit ; \
done
SUBDIRS = .
AM_CPPFLAGS = -I$(top_srcdir)/src/lib -I$(top_builddir)/src/lib
AM_CPPFLAGS += -I$(top_srcdir)/src/bin -I$(top_builddir)/src/bin
@@ -20,8 +8,6 @@ AM_CPPFLAGS += -DINSTALL_PROG=\"$(abs_top_srcdir)/install-sh\"
CLEANFILES = $(builddir)/interfaces.txt $(builddir)/logger_lockfile
DISTCLEANFILES =
AM_CXXFLAGS = $(KEA_CXXFLAGS)
if USE_STATIC_LINK

View File

@@ -1,18 +1,15 @@
SUBDIRS = .
# Shell tests
SHTESTS = netconf_tests.sh
noinst_SCRIPTS = netconf_tests.sh
# Run shell tests on "make check".
check_SCRIPTS = $(SHTESTS)
TESTS = $(SHTESTS)
EXTRA_DIST = netconf_tests.sh.in
# As with every file generated by ./configure, clean them up when running
# "make distclean", but not on "make clean".
DISTCLEANFILES = $(SHTESTS)
# test using command-line arguments, so use check-local target instead of TESTS
check-local:
for shtest in $(SHTESTS) ; do \
echo Running test: $$shtest ; \
export KEA_LOCKFILE_DIR=$(abs_top_builddir); \
export KEA_PIDFILE_DIR=$(abs_top_builddir); \
${SHELL} $(abs_builddir)/$$shtest || exit ; \
done
CLEANFILES = *.json *.log
DISTCLEANFILES = netconf_tests.sh
# Don't install shell tests.
noinst_SCRIPTS = $(SHTESTS)

View File

@@ -1,36 +1,23 @@
SUBDIRS = .
# Python tests
PYTESTS = shell_unittest.py
SHTESTS =
# Shell tests
SHTESTS =
SHTESTS += basic_auth_tests.sh
SHTESTS += shell_process_tests.sh
if CA_TLS_TEST
SHTESTS += tls_ca_process_tests.sh
endif
noinst_SCRIPTS = $(PYTESTS) $(SHTESTS)
# Run tests on "make check".
check_SCRIPTS = $(PYTESTS) $(SHTESTS)
TESTS = $(PYTESTS) $(SHTESTS)
# As with every file generated by ./configure, clean them up when running
# "make distclean", but not on "make clean".
DISTCLEANFILES = $(PYTESTS) $(SHTESTS)
# test using command-line arguments, so use check-local target instead of TESTS
check-local: check-shell check-python
check-python:
@for pytest in $(PYTESTS) ; do \
echo Running python test: $$pytest ; \
chmod +x $(abs_builddir)/$$pytest ; \
PYTHONPATH=$(PYTHONPATH):$(abs_top_srcdir)/src/bin/shell @PYTHON@ $(abs_builddir)/$$pytest || exit ; \
done
check-shell:
@for shtest in $(SHTESTS) ; do \
echo Running shell test: $$shtest ; \
export KEA_LOCKFILE_DIR=$(abs_top_builddir); \
export KEA_PIDFILE_DIR=$(abs_top_builddir); \
export PYTHONPATH=$(PYTHONPATH):$(abs_top_srcdir)/src/bin/shell; \
${SHELL} $(abs_builddir)/$$shtest || exit ; \
done
CLEANDIRS = __pycache__
clean-local:
rm -rf $(CLEANDIRS)
# Don't install tests.
noinst_SCRIPTS = $(PYTESTS) $(SHTESTS)

View File

@@ -36,6 +36,11 @@ prefix="@prefix@"
# Expected version
EXPECTED_VERSION="@PACKAGE_VERSION@"
# Kea environment variables for shell tests.
# KEA_LOGGER_DESTINATION is set per test with set_logger.
export KEA_LOCKFILE_DIR="@abs_top_builddir@"
export KEA_PIDFILE_DIR="@abs_top_builddir@"
# A list of Kea processes, mainly used by the cleanup functions.
KEA_PROCS="kea-dhcp4 kea-dhcp6 kea-dhcp-ddns kea-ctrl-agent"
@@ -414,19 +419,11 @@ set_logger() {
export KEA_LOGGER_DESTINATION=${LOG_FILE}
}
# PID file path is by default <kea-install-dir>/var/run/kea, but can be
# overridden by the environmental variable.
PID_FILE_PATH="@runstatedir@/@PACKAGE@/"
# Use ${var+x} to test if ${var} is defined.
if test -n "${KEA_PIDFILE_DIR+x}" && test -n "${KEA_PIDFILE_DIR}"; then
PID_FILE_PATH="${KEA_PIDFILE_DIR}"
fi
# Checks if specified process is running.
#
# This function uses PID file to obtain the PID and then calls
# 'kill -0 <pid>' to check if the process is alive.
# The PID files are expected to be located in the ${PID_FILE_PATH},
# The PID files are expected to be located in the ${KEA_PIDFILE_DIR},
# and their names should match the following pattern:
# <cfg_file_name>.<proc_name>.pid. If the <cfg_file_name> is not
# specified a 'test_config' is used by default.
@@ -453,7 +450,7 @@ get_pid() {
# Get the absolute location of the PID file for the specified process
# name.
abs_pidfile_path="${PID_FILE_PATH}/${cfg_file_name}.${proc_name}.pid"
abs_pidfile_path="${KEA_PIDFILE_DIR}/${cfg_file_name}.${proc_name}.pid"
_GET_PID=0
_GET_PIDS_NUM=0
@@ -871,7 +868,7 @@ verify_server_pid() {
fi
# Now we can build the name:
pid_file="$KEA_PIDFILE_DIR/$fname.$bin_name.pid"
pid_file="${KEA_PIDFILE_DIR}/${fname}.${bin_name}.pid"
if [ ! -e "${pid_file}" ]; then
printf "ERROR: PID file:[%s] does not exist\n" "${pid_file}"