1# 2# $Id: Makefile 1435811 2013-01-20 10:07:44Z fabien $ 3# 4# mod_macro non regression tests 5 6# where is apache 7APA.dir = /tmp/apache 8 9# apache executable with mod macro loaded 10HTTPD = \ 11 $(APA.dir)/bin/httpd \ 12 -C 'LoadModule macro_module modules/mod_macro.so' \ 13 -C "Define PWD $$PWD/conf" 14 15# default target 16.PHONY: default 17default: clean 18 19# run all non regression tests 20.PHONY: check 21check: check-out 22 23# result directory 24OUT = out 25out: 26 mkdir $@ 27 28# test cases & results 29F.conf = $(wildcard conf/test*.conf) 30F.out = $(F.conf:conf/%.conf=$(OUT)/%.out) 31 32# run all tests 33.PHONY: run-test 34run-test: $(F.out) 35 36# generate & compare in a separate directory 37.PHONY: check-out 38check-out: out 39 $(RM) out/*.out 40 $(MAKE) OUT=out run-test 41 diff -r out/ ref/ 42 43# generate & compare in the same directory 44.PHONY: check-ref 45check-ref: 46 $(RM) ref/*.out 47 $(MAKE) OUT=ref run-test 48 svn diff ref/ 49 50# run one test case 51# filter output so that it is portable 52# use '|' sed separator because $PWD will contain plenty '/' 53$(OUT)/%.out: conf/%.conf 54 { \ 55 echo "# testing with $<" ; \ 56 $(HTTPD) -f $$PWD/$< 2>&1 ; \ 57 echo "# exit: $$?" ; \ 58 } > $@.tmp ; \ 59 sed -e "s|$$PWD|.|g" \ 60 -e "s|^\[[\.a-zA-Z0-9 :]*\] ||" \ 61 -e "s|\[pid [0-9]*:tid [0-9]*] ||" \ 62 $@.tmp > $@ ; \ 63 $(RM) $@.tmp 64 65# cleanup 66.PHONY: clean 67clean: 68 $(RM) *~ 69 $(RM) -r out 70