Accepting request 335993 from home:pgajdos:apache2

- version 20150930
- %apache_test_module_start_apache, %apache_test_module_load:
  introduce -t option
- %apache_test_module_curl: introduce -r option

OBS-URL: https://build.opensuse.org/request/show/335993
OBS-URL: https://build.opensuse.org/package/show/Apache/apache-rpm-macros?expand=0&rev=21
This commit is contained in:
Petr Gajdos 2015-10-02 20:13:35 +00:00 committed by Git OBS Bridge
parent 47c5fbefab
commit 348ddeb892
3 changed files with 32 additions and 20 deletions

View File

@ -1,3 +1,11 @@
-------------------------------------------------------------------
Wed Sep 30 17:14:29 UTC 2015 - pgajdos@suse.com
- version 20150930
- %apache_test_module_start_apache, %apache_test_module_load:
introduce -t option
- %apache_test_module_curl: introduce -r option
-------------------------------------------------------------------
Tue Sep 22 07:16:24 UTC 2015 - pgajdos@suse.com

View File

@ -57,7 +57,7 @@
%endif
%define macros_file macros.apache
Name: apache-rpm-macros
Version: 20150921
Version: 20150930
Release: 0
Summary: Apache RPM Macros
License: Apache-2.0

View File

@ -10,8 +10,8 @@
#
# macro: apache_test_module_start_apache -- start apache with specified modules loaded
#
# usage: apache_test_module_start_apache -m module_list [-i include_list] [-r document_root]
# [-u user] [-g group] [-p port]
# usage: apache_test_module_start_apache [-m module_list] [-i include_list] [-r document_root]
# [-u user] [-g group] [-p port] [-t mpm]
#
# module_list: colon separated list of module names to be loaded with test run
# search path: %{buildroot} tree
@ -35,12 +35,13 @@
# [default value: abuild]
# port: listen on port
# [default value: 60080]
# mpm: multiprocessing module (prefork, worker, event)
# [default value: prefork]
#
#
%apache_test_module_start_apache(m:,i:,r:,u:,g:) \
%apache_test_module_start_apache(m:,i:,r:,u:,g:,t:) \
# constants \
TEST_DIR='%{__test_dir}' \
TEST_MPM='%{__test_mpm}' \
# arguments \
# modules to load, from BUILD tree or system \
MODULES=$(echo %{-m:%{-m*}} | tr ':' ' ') \
@ -65,6 +66,10 @@
if [ -z "$TEST_PORT" ]; then \
TEST_PORT='%{__test_port}' \
fi \
TEST_MPM="%{-t:%{-t*}}" \
if [ -z "$TEST_MPM" ]; then \
TEST_MPM='%{__test_mpm}' \
fi \
# helpers \
APACHE_BRANCH=$(echo %{apache_branch} | tr -d '.') \
# begin \
@ -119,15 +124,6 @@
done \
echo "DocumentRoot $DOCUMENT_ROOT" >> $TEST_CONF_FILE \
echo "DirectoryIndex index.html" >> $TEST_CONF_FILE \
echo "<Directory $DOCUMENT_ROOT>" >> $TEST_CONF_FILE \
if [ $APACHE_BRANCH -ge 24 ]; then \
echo " Require local" >> $TEST_CONF_FILE \
else \
echo " Order deny,allow" >> $TEST_CONF_FILE \
echo " Deny from all" >> $TEST_CONF_FILE \
echo " Allow from localhost" >> $TEST_CONF_FILE \
fi \
echo "</Directory>" >> $TEST_CONF_FILE \
# run apache \
CMD=$(ls %{_sbindir}/httpd*-$TEST_MPM | head -n 1) \
echo -n "Starting Apache ... " \
@ -162,22 +158,25 @@
# document root of test instance
#
# usage: apache_test_module_curl -d document_to_curl -o output_of_curl
# -p port -u user:password
# -p port -u user:password -r protocol
#
# document_to_curl: relative to DocumentRoot [default: /]
# output_of_curl: where to save document (required)
# port: from which port of localhost will be document
# downloaded [default value: 60080]
# user:password: --user parameter of curl
# protocol: protocol to download document
# [default: http]
#
# example: apache_test_module_curl -d foo/test.html -o test.html
# apache_test_module_curl -d foo/ -o output.txt
#
%apache_test_module_curl(d:,o:,p:,u:) \
%apache_test_module_curl(d:,o:,p:,u:,r:) \
TEST_DOCUMENT="%{-d:%{-d*}}" \
TEST_OUTPUT="%{-o:%{-o*}}" \
TEST_PORT="%{-p:%{-p*}}" \
TEST_CURL_USER="%{-u:%{-u*}}" \
TEST_PROTO="%{-r:%{-r*}}" \
if [ -z "$TEST_PORT" ]; then \
TEST_PORT='%{__test_port}' \
fi \
@ -189,13 +188,16 @@
if [ ! -z "$TEST_CURL_USER" ]; then \
USER_PARAM="-u $TEST_CURL_USER" \
fi \
curl -s "http://localhost:$TEST_PORT/$TEST_DOCUMENT" --create-dirs -o "$TEST_OUTPUT" $USER_PARAM \
if [ -z "$TEST_PROTO" ]; then \
TEST_PROTO="http" \
fi \
curl -s -k "$TEST_PROTO://127.0.0.1:$TEST_PORT/$TEST_DOCUMENT" --create-dirs -o "$TEST_OUTPUT" $USER_PARAM \
%nil
#
# macro: apache_test_module_load -- tests that module(s) can be loaded
#
# usage: apache_test_module_load -m module_list [-i include_list]
# usage: apache_test_module_load [-m module_list] [-i include_list] [-t mpm]
#
# module_list: colon separated list of module names to be loaded with test run
# search path: %{buildroot} tree
@ -207,9 +209,11 @@
# search path %{buildroot}%{apache_sysconfdir} tree
# $PWD tree
# [example value: mod_asn.conf]
# mpm: multiprocessing module (prefork, worker, event)
# [default value: prefork]
#
%apache_test_module_load(m:,i:) \
%apache_test_module_start_apache %{-m:-m %{-m*}} %{-i:-i %{-i*}} \
%apache_test_module_load(m:,i:,t:) \
%apache_test_module_start_apache %{-m:-m %{-m*}} %{-i:-i %{-i*}} %{-t:-t %{-t*}} \
%apache_test_module_stop_apache \
%nil