f545d156561c08020a67f9640c51454c2df4fb57fabien#
f545d156561c08020a67f9640c51454c2df4fb57fabien# $Id$
f545d156561c08020a67f9640c51454c2df4fb57fabien#
f545d156561c08020a67f9640c51454c2df4fb57fabien# mod_macro non regression tests
f545d156561c08020a67f9640c51454c2df4fb57fabien
f545d156561c08020a67f9640c51454c2df4fb57fabien# where is apache
f545d156561c08020a67f9640c51454c2df4fb57fabienAPA.dir = /tmp/apache
f545d156561c08020a67f9640c51454c2df4fb57fabien
f545d156561c08020a67f9640c51454c2df4fb57fabien# apache executable with mod macro loaded
f545d156561c08020a67f9640c51454c2df4fb57fabienHTTPD = \
f545d156561c08020a67f9640c51454c2df4fb57fabien $(APA.dir)/bin/httpd \
f545d156561c08020a67f9640c51454c2df4fb57fabien -C 'LoadModule macro_module modules/mod_macro.so' \
f545d156561c08020a67f9640c51454c2df4fb57fabien -C "Define PWD $$PWD/conf"
f545d156561c08020a67f9640c51454c2df4fb57fabien
f545d156561c08020a67f9640c51454c2df4fb57fabien# default target
f545d156561c08020a67f9640c51454c2df4fb57fabien.PHONY: default
f545d156561c08020a67f9640c51454c2df4fb57fabiendefault: clean
f545d156561c08020a67f9640c51454c2df4fb57fabien
f545d156561c08020a67f9640c51454c2df4fb57fabien# run all non regression tests
f545d156561c08020a67f9640c51454c2df4fb57fabien.PHONY: check
f545d156561c08020a67f9640c51454c2df4fb57fabiencheck: check-out
f545d156561c08020a67f9640c51454c2df4fb57fabien
f545d156561c08020a67f9640c51454c2df4fb57fabien# result directory
f545d156561c08020a67f9640c51454c2df4fb57fabienOUT = out
f545d156561c08020a67f9640c51454c2df4fb57fabienout:
f545d156561c08020a67f9640c51454c2df4fb57fabien mkdir $@
f545d156561c08020a67f9640c51454c2df4fb57fabien
f545d156561c08020a67f9640c51454c2df4fb57fabien# test cases & results
f545d156561c08020a67f9640c51454c2df4fb57fabienF.conf = $(wildcard conf/test*.conf)
f545d156561c08020a67f9640c51454c2df4fb57fabienF.out = $(F.conf:conf/%.conf=$(OUT)/%.out)
f545d156561c08020a67f9640c51454c2df4fb57fabien
f545d156561c08020a67f9640c51454c2df4fb57fabien# run all tests
f545d156561c08020a67f9640c51454c2df4fb57fabien.PHONY: run-test
f545d156561c08020a67f9640c51454c2df4fb57fabienrun-test: $(F.out)
f545d156561c08020a67f9640c51454c2df4fb57fabien
f545d156561c08020a67f9640c51454c2df4fb57fabien# generate & compare in a separate directory
f545d156561c08020a67f9640c51454c2df4fb57fabien.PHONY: check-out
f545d156561c08020a67f9640c51454c2df4fb57fabiencheck-out: out
f545d156561c08020a67f9640c51454c2df4fb57fabien $(RM) out/*.out
f545d156561c08020a67f9640c51454c2df4fb57fabien $(MAKE) OUT=out run-test
f545d156561c08020a67f9640c51454c2df4fb57fabien diff -r out/ ref/
f545d156561c08020a67f9640c51454c2df4fb57fabien
f545d156561c08020a67f9640c51454c2df4fb57fabien# generate & compare in the same directory
f545d156561c08020a67f9640c51454c2df4fb57fabien.PHONY: check-ref
f545d156561c08020a67f9640c51454c2df4fb57fabiencheck-ref:
f545d156561c08020a67f9640c51454c2df4fb57fabien $(RM) ref/*.out
f545d156561c08020a67f9640c51454c2df4fb57fabien $(MAKE) OUT=ref run-test
f545d156561c08020a67f9640c51454c2df4fb57fabien svn diff ref/
f545d156561c08020a67f9640c51454c2df4fb57fabien
f545d156561c08020a67f9640c51454c2df4fb57fabien# run one test case
f545d156561c08020a67f9640c51454c2df4fb57fabien# filter output so that it is portable
f545d156561c08020a67f9640c51454c2df4fb57fabien# use '|' sed separator because $PWD will contain plenty '/'
f545d156561c08020a67f9640c51454c2df4fb57fabien$(OUT)/%.out: conf/%.conf
f545d156561c08020a67f9640c51454c2df4fb57fabien { \
f545d156561c08020a67f9640c51454c2df4fb57fabien echo "# testing with $<" ; \
f545d156561c08020a67f9640c51454c2df4fb57fabien $(HTTPD) -f $$PWD/$< 2>&1 ; \
f545d156561c08020a67f9640c51454c2df4fb57fabien echo "# exit: $$?" ; \
f545d156561c08020a67f9640c51454c2df4fb57fabien } > $@.tmp ; \
f545d156561c08020a67f9640c51454c2df4fb57fabien sed -e "s|$$PWD|.|g" \
f545d156561c08020a67f9640c51454c2df4fb57fabien -e "s|^\[[\.a-zA-Z0-9 :]*\] ||" \
f545d156561c08020a67f9640c51454c2df4fb57fabien -e "s|\[pid [0-9]*:tid [0-9]*] ||" \
f545d156561c08020a67f9640c51454c2df4fb57fabien $@.tmp > $@ ; \
f545d156561c08020a67f9640c51454c2df4fb57fabien $(RM) $@.tmp
f545d156561c08020a67f9640c51454c2df4fb57fabien
f545d156561c08020a67f9640c51454c2df4fb57fabien# cleanup
f545d156561c08020a67f9640c51454c2df4fb57fabien.PHONY: clean
f545d156561c08020a67f9640c51454c2df4fb57fabienclean:
f545d156561c08020a67f9640c51454c2df4fb57fabien $(RM) *~
f545d156561c08020a67f9640c51454c2df4fb57fabien $(RM) -r out