diff options
author | Jacob Champion <jchampion@apache.org> | 2017-01-06 20:01:27 +0000 |
---|---|---|
committer | Jacob Champion <jchampion@apache.org> | 2017-01-06 20:01:27 +0000 |
commit | 3286d877044abd76ad5151a5358d7b24ecc014f2 (patch) | |
tree | dddfd83e53851c0c742d83d5303bb8b7fb00b3f7 | |
parent | c34870e09ee4383bf90ab16a86809696b40a214f (diff) | |
parent | 50462f0467a85ebe67cc84ac80577d0bcb813478 (diff) | |
download | httpd-3286d877044abd76ad5151a5358d7b24ecc014f2.tar.gz |
Reintegrate the --with-test-suite feature with trunk
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1777709 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | Makefile.in | 121 | ||||
-rw-r--r-- | configure.in | 15 |
2 files changed, 136 insertions, 0 deletions
diff --git a/Makefile.in b/Makefile.in index b166700b6f..6b396a45b7 100644 --- a/Makefile.in +++ b/Makefile.in @@ -18,6 +18,9 @@ INSTALL_TARGETS = install-conf install-htdocs install-error install-icons \ install-other install-cgi install-include install-suexec install-build \ install-man +CLEAN_TARGETS = check/apxs check/build/config_vars.mk \ + check/conf/$(PROGRAM_NAME).conf check/conf/magic check/conf/mime.types \ + check/conf/extra/* check/include/* DISTCLEAN_TARGETS = include/ap_config_auto.h include/ap_config_layout.h \ include/apache_probes.h \ modules.c config.cache config.log config.status build/config_vars.mk \ @@ -25,6 +28,7 @@ DISTCLEAN_TARGETS = include/ap_config_auto.h include/ap_config_layout.h \ build/pkg/pkginfo build/config_vars.sh bsd_converted EXTRACLEAN_TARGETS = configure include/ap_config_auto.h.in generated_lists \ httpd.spec +PHONY_TARGETS := check check-conf check-include include $(top_builddir)/build/rules.mk include $(top_srcdir)/build/program.mk @@ -297,3 +301,120 @@ update-log-tags update-log-msg-tags: # XXX: This looks awfully platform-specific [read: bad form and style] include $(top_srcdir)/os/os2/core.mk + +# +# In-tree Testing +# + +# Installs the include/ header files into the ./check/ directory so we can use +# them during `make check`. +check-include: override includedir:=$(top_builddir)/check/include +check-include: install-include + +# This is basically the same as install-conf, but we only care about the files +# necessary to run the test suite, and the LoadModule lines point back to the +# build tree. Configuration files will be installed to ./check/conf and pointed +# to by ./check/apxs. +check-conf: + @mkdir -p check/conf/extra; \ + cd $(top_srcdir)/docs/conf; \ + for i in mime.types magic; do \ + $(INSTALL_DATA) $$i $(top_builddir)/check/conf; \ + done; \ + for j in $(top_srcdir)/docs/conf $(top_builddir)/docs/conf ; do \ + cd $$j ; \ + for i in httpd.conf extra/*.conf; do \ + if [ -f $$i ] ; then \ + ( \ + n_lm=`awk 'BEGIN {n=0} /@@LoadModule@@/ {n+=1} END {print n}' < $$i`; \ + if test $$n_lm -eq 0 -o "x$(MPM_MODULE)$(DSO_MODULES)" = "x"; then \ + sed -e 's#@@ServerRoot@@#$(prefix)#g' \ + -e 's#@@Port@@#$(PORT)#g' \ + -e 's#@@SSLPort@@#$(SSLPORT)#g' \ + -e '/@@LoadModule@@/d' \ + < $$i; \ + else \ + sed -n -e '/@@LoadModule@@/q' \ + -e 's#@@ServerRoot@@#$(prefix)#g' \ + -e 's#@@Port@@#$(PORT)#g' \ + -e 's#@@SSLPort@@#$(SSLPORT)#g' \ + -e 'p' \ + < $$i; \ + if echo " $(DSO_MODULES) "|$(EGREP) " cgi " > /dev/null ; then \ + have_cgi="1"; \ + else \ + have_cgi="0"; \ + fi; \ + if echo " $(DSO_MODULES) "|$(EGREP) " cgid " > /dev/null ; then \ + have_cgid="1"; \ + else \ + have_cgid="0"; \ + fi; \ + for j in $(MPM_MODULES) "^EOL^"; do \ + path=$$(find "$(top_builddir)/modules" -name "mod_$$j.so"); \ + if test $$j != "^EOL^"; then \ + if echo ",$(ENABLED_MPM_MODULE),"|$(EGREP) ",$$j," > /dev/null ; then \ + loading_disabled=""; \ + else \ + loading_disabled="#"; \ + fi; \ + echo "$${loading_disabled}LoadModule $${j}_module $${path}"; \ + fi; \ + done; \ + for j in $(DSO_MODULES) "^EOL^"; do \ + path=$$(find "$(top_builddir)/modules" -name "mod_$$j.so"); \ + if test $$j != "^EOL^"; then \ + if test $$j = "cgid" -a "$$have_cgi" = "1"; then \ + echo "<IfModule !mpm_prefork_module>"; \ + echo " LoadModule $${j}_module $${path}"; \ + echo "</IfModule>"; \ + elif test $$j = "cgi" -a "$$have_cgid" = "1"; then \ + echo "<IfModule mpm_prefork_module>"; \ + echo " LoadModule $${j}_module $${path}"; \ + echo "</IfModule>"; \ + else \ + echo "LoadModule $${j}_module $${path}"; \ + fi; \ + fi; \ + done; \ + sed -e '1,/@@LoadModule@@/d' \ + -e '/@@LoadModule@@/d' \ + -e 's#@@ServerRoot@@#$(prefix)#g' \ + -e 's#@@Port@@#$(PORT)#g' \ + -e 's#@@SSLPort@@#$(SSLPORT)#g' \ + < $$i; \ + fi \ + ) > $(top_builddir)/check/conf/$$i; \ + chmod 0644 $(top_builddir)/check/conf/$$i; \ + if [ "$$i" = "httpd.conf" ]; then \ + mv "$(top_builddir)/check/conf/$$i" "$(top_builddir)/check/conf/$(PROGRAM_NAME).conf"; \ + fi; \ + fi; \ + done ; \ + done ; + +# A version of apxs with the PREFIX overridden to point inside the build tree. +check/apxs: + mkdir -p check + sed -e 's#$(prefix)#$(top_builddir)/check#g' support/apxs > $@ + chmod +x $@ + +# A version of config_vars.mk with the PREFIX and SBINDIR overridden to point +# inside the build tree. +check/build/config_vars.mk: build/config_vars.out + mkdir -p check/build + cp $< $@ + echo "prefix = $(top_builddir)/check" >> $@ + echo "sbindir = $(top_builddir)" >> $@ + +# Run the Apache::Test suite if it has been configured with --with-test-suite. +check: check-include check-conf check/build/config_vars.mk check/apxs + @if test "x$(TEST_SUITE_LOCATION)" = "xno"; then \ + echo 'Re-run configure with the --with-test-suite option to enable in-tree tests.'; \ + false; \ + fi + cd "$(TEST_SUITE_LOCATION)" && \ + perl Makefile.PL -apxs "$(top_builddir)/check/apxs" && \ + ./t/TEST -clean && \ + ./t/TEST -config && \ + ./t/TEST diff --git a/configure.in b/configure.in index 19ce9e7374..0309d77c43 100644 --- a/configure.in +++ b/configure.in @@ -886,6 +886,21 @@ AC_ARG_ENABLE(bsd-makefiles,APACHE_HELP_STRING(--enable-bsd-makefiles,use BSD Ma FORCE_BSD_MAKEFILE="auto" ]) +AC_ARG_WITH([test-suite], + APACHE_HELP_STRING([--with-test-suite=PATH], [enable in-tree 'make check' with the given Apache::Test suite location]), + [ + if test "x$withval" = "xyes"; then + AC_MSG_ERROR([option --with-test-suite requires a directory]); + 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" + fi + ], + [ TEST_SUITE_LOCATION="no" ] +) + +APACHE_SUBST(TEST_SUITE_LOCATION) + APACHE_FAST_OUTPUT(Makefile modules/Makefile srclib/Makefile) APACHE_FAST_OUTPUT(os/Makefile server/Makefile) APACHE_FAST_OUTPUT(support/Makefile) |