You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by jo...@apache.org on 2026/02/28 13:22:38 UTC
svn commit: r1932079 - in httpd/httpd/trunk: . build test/pyhttpd
Author: jorton
Date: Sat Feb 28 13:22:38 2026
New Revision: 1932079
Log:
Have "make check" run all of the libcheck-based unit tests,
pytest-based tests, and perl-framework-based tests if available.
* test/pyhttpd/env.py (HttpdTestEnv.__init__): Use config.ini from
$PYHTTPD_CONFIG if set.
* configure.in: Check for pytest-3, add check-pytest to $CHECK_TARGETS
if found. Add check-unittests to $CHECK_TARGETS if test/httpdunit is
generated. Add check-test-framework to $CHECK_TARGETS if the Perl test
framework is present. Stop generating WITH_TEST_SUITE.
* Makefile.in (check): Depend on $CHECK_TARGETS.
(check-tree, check/bin/apachectl, check/config.ini, check/modules/stamp):
New targets to fill out the check/ install tree for use with pyhttpd.
(check-pytest): New target to run pytest-based tests.
(check-unittests): New target to run libcheck-based tests.
(check-test-framework): Renamed from "check-yes", runs Perl framework tests.
Github: closes #598
Modified:
httpd/httpd/trunk/Makefile.in
httpd/httpd/trunk/build/config_vars.sh.in
httpd/httpd/trunk/configure.in
httpd/httpd/trunk/test/pyhttpd/env.py
Modified: httpd/httpd/trunk/Makefile.in
==============================================================================
--- httpd/httpd/trunk/Makefile.in Sat Feb 28 13:07:27 2026 (r1932078)
+++ httpd/httpd/trunk/Makefile.in Sat Feb 28 13:22:38 2026 (r1932079)
@@ -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
@@ -468,16 +474,29 @@ $(TEST_SUITE_LOCATION)/Makefile: $(TEST_
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
@@ -513,3 +532,6 @@ httpdunit_OBJECTS := test/httpdunit.lo $
$(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
Modified: httpd/httpd/trunk/build/config_vars.sh.in
==============================================================================
--- httpd/httpd/trunk/build/config_vars.sh.in Sat Feb 28 13:07:27 2026 (r1932078)
+++ httpd/httpd/trunk/build/config_vars.sh.in Sat Feb 28 13:22:38 2026 (r1932079)
@@ -88,4 +88,6 @@ exec sed "
/^EXPORTS_DOT_C/d
/^LIBMAIN_LIB/d
/TEST_SUITE/d
+/^PYTEST3/d
+/^CHECK_TARGETS/d
"
Modified: httpd/httpd/trunk/configure.in
==============================================================================
--- httpd/httpd/trunk/configure.in Sat Feb 28 13:07:27 2026 (r1932078)
+++ httpd/httpd/trunk/configure.in Sat Feb 28 13:22:38 2026 (r1932079)
@@ -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
@@ -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
@@ -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 ""'
@@ -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)
Modified: httpd/httpd/trunk/test/pyhttpd/env.py
==============================================================================
--- httpd/httpd/trunk/test/pyhttpd/env.py Sat Feb 28 13:07:27 2026 (r1932078)
+++ httpd/httpd/trunk/test/pyhttpd/env.py Sat Feb 28 13:22:38 2026 (r1932079)
@@ -238,8 +238,10 @@ class HttpdTestEnv:
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')