Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 29 additions & 7 deletions Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -449,6 +449,12 @@ check/bin/apxs:
sed -e 's#$(prefix)#$(top_builddir)/check#g' support/apxs > $@
chmod +x $@

# A version of apachectl with the PREFIX overridden to point inside the install root
check/bin/apachectl:
mkdir -p check
sed -e 's#$(prefix)#$(top_builddir)/check#g' support/apachectl > $@
chmod +x $@

# A version of config_vars.mk with PREFIX and SBINDIR and BINDIR overridden.
check/build/config_vars.mk: build/config_vars.out
mkdir -p check/build
Expand All @@ -468,16 +474,29 @@ $(TEST_SUITE_LOCATION)/Makefile: $(TEST_SUITE_LOCATION)/Makefile.PL $(INSTALL_HE

check-make: $(TEST_SUITE_LOCATION)/Makefile

check-no:
@echo 'Re-run configure with the --with-test-suite option to enable in-tree tests.'
@false
check-tree: check-include check-dirs check-conf check/build/config_vars.mk \
check-binaries

check-yes: check-include check-dirs check-conf check/build/config_vars.mk \
check-binaries $(TEST_SUITE_LOCATION)/Makefile
# Run the Apache::Test Perl framework
check-test-framework: check-tree $(TEST_SUITE_LOCATION)/Makefile
cd $(TEST_SUITE_LOCATION) && $(MAKE) && ./t/TEST $(TEST_CONFIG) $(TESTS)

# Run the Apache::Test suite if it has been configured with --with-test-suite.
check: check-$(WITH_TEST_SUITE)
# Generate config.ini suitable for running against the check/ install prefix
check/config.ini: test/pyhttpd/config.ini
sed -e 's#$(prefix)#$(top_builddir)/check#g' test/pyhttpd/config.ini > $@

check/modules/stamp: build/config_vars.mk
mkdir -p check/modules
rm -f check/modules/*.so
find modules -name \*.so -exec ln -s $(top_builddir)/{} check/modules/ \;
find server/mpm -name \*.so -exec ln -s $(top_builddir)/{} check/modules/ \;
date > $@

check-pytest: check-tree check/bin/apachectl check/config.ini check/modules/stamp
PYHTTPD_CONFIG=$(top_builddir)/check/config.ini $(PYTEST3) $(PYTEST_DIRS)

# Runs all configured/available test targets.
check: $(CHECK_TARGETS)

#
# Unit Test Suite
Expand Down Expand Up @@ -513,3 +532,6 @@ httpdunit_OBJECTS := test/httpdunit.lo $(testcase_OBJECTS)
$(httpdunit_OBJECTS): override LTCFLAGS += $(UNITTEST_CFLAGS)
test/httpdunit: $(httpdunit_OBJECTS) $(PROGRAM_DEPENDENCIES) $(PROGRAM_OBJECTS)
$(LINK) $(httpdunit_OBJECTS) $(PROGRAM_OBJECTS) $(UNITTEST_LIBS) $(PROGRAM_LDADD)

check-unittests: test/httpdunit
test/httpdunit
2 changes: 2 additions & 0 deletions build/config_vars.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -88,4 +88,6 @@ exec sed "
/^EXPORTS_DOT_C/d
/^LIBMAIN_LIB/d
/TEST_SUITE/d
/^PYTEST3/d
/^CHECK_TARGETS/d
"
18 changes: 12 additions & 6 deletions configure.in
Original file line number Diff line number Diff line change
Expand Up @@ -791,10 +791,11 @@ AC_ARG_WITH(valgrind,
dnl Enable the unit test executable if Check is installed.
dnl TODO: at the moment, only pkg-config discovery is supported.
AC_MSG_CHECKING([for Check to enable unit tests])
if test "x$PKGCONFIG" != "x" -a "$ap_reduced_exports" = "no" && `$PKGCONFIG --atleast-version='0.9.12' check`; then
if test "x$PKGCONFIG" != "x" -a -d "./test" -a "$ap_reduced_exports" = "no" && `$PKGCONFIG --atleast-version='0.9.12' check`; then
UNITTEST_CFLAGS=`$PKGCONFIG --cflags check`
UNITTEST_LIBS=`$PKGCONFIG --libs check`
other_targets="$other_targets test/httpdunit"
CHECK_TARGETS="$CHECK_TARGETS check-unittests"

AC_MSG_RESULT([yes])
else
Expand All @@ -803,6 +804,13 @@ fi
APACHE_SUBST(UNITTEST_CFLAGS)
APACHE_SUBST(UNITTEST_LIBS)

if test -d "./test"; then
AC_PATH_PROG(PYTEST3, pytest-3)
if test -n "$ac_cv_path_PYTEST3"; then
CHECK_TARGETS="$CHECK_TARGETS check-pytest"
fi
fi
APACHE_SUBST(PYTEST3)

prefix="$orig_prefix"
APACHE_ENABLE_MODULES
Expand All @@ -817,6 +825,7 @@ APACHE_SUBST(BUILTIN_LIBS)
APACHE_SUBST(SHLIBPATH_VAR)
APACHE_SUBST(OS_SPECIFIC_VARS)
APACHE_SUBST(HTTPD_LIBS)
APACHE_SUBST(CHECK_TARGETS)

PRE_SHARED_CMDS='echo ""'
POST_SHARED_CMDS='echo ""'
Expand Down Expand Up @@ -1007,14 +1016,11 @@ AC_ARG_WITH([test-suite],
else
test -f "$withval/Makefile.PL" || AC_MSG_ERROR([--with-test-suite directory $withval does not contain the expected Makefile.PL])
TEST_SUITE_LOCATION="$withval"
WITH_TEST_SUITE=yes
CHECK_TARGETS="$CHECK_TARGETS check-test-framework"
fi
],
[ WITH_TEST_SUITE=no ]
)
])

APACHE_SUBST(TEST_SUITE_LOCATION)
APACHE_SUBST(WITH_TEST_SUITE)

APACHE_FAST_OUTPUT(Makefile modules/Makefile srclib/Makefile)
APACHE_FAST_OUTPUT(os/Makefile server/Makefile)
Expand Down
4 changes: 3 additions & 1 deletion test/pyhttpd/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,8 +238,10 @@ def has_shared_module(cls, name):

def __init__(self, pytestconfig=None):
self._our_dir = os.path.dirname(inspect.getfile(Dummy))
self._config_ini = os.getenv("PYHTTPD_CONFIG",
os.path.join(self._our_dir, 'config.ini'))
self.config = ConfigParser(interpolation=ExtendedInterpolation())
self.config.read(os.path.join(self._our_dir, 'config.ini'))
self.config.read(self._config_ini)

self._bin_dir = self.config.get('global', 'bindir')
self._apxs = self.config.get('global', 'apxs')
Expand Down