From: Wolfgang Bangerth Date: Sat, 8 Oct 2005 19:16:51 +0000 (+0000) Subject: Make all-headers a real directory. Run separate tests for all header files and create... X-Git-Tag: v8.0.0~13024 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d2f56ad54c9e8ee6bc5c3d1e629eb00e2ec3f188;p=dealii.git Make all-headers a real directory. Run separate tests for all header files and create a proper report for them. git-svn-id: https://svn.dealii.org/trunk@11579 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/tests/Makefile b/tests/Makefile index 2c26b456ff..c8c4fc8b83 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -23,16 +23,10 @@ multigrid: compare abort.o cd multigrid ; $(MAKE) report: compare abort.o - @for i in base lac fe deal.II multigrid bits ; do \ + @for i in base lac fe deal.II multigrid bits all-headers ; do \ echo =======Report: $$i ======= ; \ cd $$i ; $(MAKE) report ; cd .. ; \ done - @echo =======Report: all-headers ======= - @if (($(MAKE) all-headers 2>&1) > /dev/null) ; then \ - echo `date -u +"%Y-%m-%d %H:%M"` + all/headers/all-headers ; \ - else \ - echo `date -u +"%Y-%m-%d %H:%M"` - all-headers/all-headers ; \ - fi report+mail: @$(MAKE) report | tee testresults @@ -87,35 +81,6 @@ output-multigrid: abort.o cd multigrid ; $(MAKE) output -# collect all header files, and for each try to do the following: -# generate a file tmp.cc that contains nothing but "#include " -# with this particular header file. then try to compile it. this -# sometimes fails since this header does not include all other headers -# it actually needs. we don't usually see this since we may be -# including these missing headers into our files before, so that nobody -# notices the problem. expose it this way. -# -# this all happens in a subdir tmp-all-headers, which is removed -# afterwards again. -all-headers: - @rm -rf tmp-all-headers - @mkdir tmp-all-headers - @for i in base lac deal.II ; do \ - pushd . > /dev/null ; \ - headers=`cd $D/$$i/include ; \ - for j in */*.h ; do echo $$j ; done` ; \ - popd > /dev/null ; \ - cd tmp-all-headers ; \ - cp ../Makefile.headers Makefile ; \ - for j in $$headers ; do \ - echo "=====Header======== $$j " ; \ - echo "#include <$$j>" > tmp.cc ; \ - if $(MAKE) -s tmp.g.$(OBJEXT) ; then : ; else exit 1 ; fi ; \ - rm -f tmp.* ; \ - done ; \ - cd .. ; \ - done - @rm -rf tmp-all-headers # generate a link to system specific test program output. we create diff --git a/tests/Makefile.headers b/tests/Makefile.headers deleted file mode 100644 index b08b2137c8..0000000000 --- a/tests/Makefile.headers +++ /dev/null @@ -1,18 +0,0 @@ -# Generated automatically from Makefile.in by configure. -# Generated automatically from Makefile.in by configure. -############################################################ -# Makefile,v 1.27 2002/09/03 17:39:25 wolf Exp -# Copyright (C) 2000, 2001, 2002, 2003 by the deal.II authors -############################################################ - -############################################################ -# Include general settings for including DEAL libraries -############################################################ - -include ../Makefile.paths -include $D/common/Make.global_options -debug-mode = on - -default: tmp.g.$(OBJEXT) - -include ../Makefile.rules diff --git a/tests/all-headers/Makefile b/tests/all-headers/Makefile new file mode 100644 index 0000000000..ed49ba7c5f --- /dev/null +++ b/tests/all-headers/Makefile @@ -0,0 +1,88 @@ +# collect all header files, and for each try to do the following: +# generate a file tmp.cc that contains nothing but "#include " +# with this particular header file. then try to compile it. this +# sometimes fails since this header does not include all other headers +# it actually needs. we don't usually see this since we may be +# including these missing headers into our files before, so that nobody +# notices the problem. expose it this way. + +include ../Makefile.paths +include $D/common/Make.global_options + +############################################################ +# First how to create executables, including all necessary +# flags: +############################################################ + +flags = $(CXXFLAGS.g) + +ifeq ($(findstring gcc,$(GXX_VERSION)),gcc) +flags += -Wno-missing-noreturn +endif + +%.g.$(OBJEXT) : %.cc Makefile + @echo =====debug========= $< + @$(CXX) $(flags) -c $< -o $@ + +%.$(OBJEXT) : %.cc Makefile + @echo =====optimized===== $< + @$(CXX) $(CXXFLAGS.o) -c $< -o $@ + + +default:all + +# collect all headers +HEADERS = $(shell cd $D; echo */include/*/*.h) +TESTS = $(HEADERS:%=test-%) + + +# we need two auxiliary functions. the first one takes a filename and replaces +# all occurrences of slashes by hyphens, so that we can create a .cc file that +# corresponds to a header file in a different directory +subst_slashes = $(shell echo $(1) | $(PERL) -pi -e 's/\//-/g;') + +# the second one takes a path to a header file and makes sure that we can +# #include it, i.e. it drops the top-level xxx/include/ part of the filename, +# since we only find include directives like +normalize = $(shell echo $(1) | $(PERL) -pi -e 's/.*include.//g;') + + +# next the target that creates the target rules. First, we list all the header +# files as the head of the rule, followed by a colon. Then the actual rule +# that includes writing the .cc file that only includes a single header file, +# compiles it, and then deletes everything again +Makefile.dep: $(HEADERS:%=$D/%) Makefile + @for i in $(HEADERS) ; do \ + echo test-$$i \\ ; \ + done > Makefile.dep + @echo : >> Makefile.dep + @echo ' @echo "#include <$$(call normalize,$$@)>" > $$(call subst_slashes,$$@).cc' >> Makefile.dep + @echo ' @$$(MAKE) $$(call subst_slashes,$$@).g.o' >> Makefile.dep + @echo ' @rm -f $$(call subst_slashes,$$@).g.o' >> Makefile.dep + @echo ' @rm -f $$(call subst_slashes,$$@).cc' >> Makefile.dep + +include Makefile.dep + + +# here's what's to be done +all: $(TESTS) + + +# create a report, where we get exactly one line per test +report: + @for test in $(TESTS) ; do \ + testname=all-headers/`echo $$test | perl -pi -e 's/.*include.//g; s/\//-/g;'` ; \ + if (($(MAKE) $$test 2>&1) > /dev/null); then \ + echo `date -u +"%Y-%m-%d %H:%M"` + $$testname ; \ + else \ + echo `date -u +"%Y-%m-%d %H:%M"` - $$testname ; \ + fi ; \ + done + + +clean: + -rm -f Makefile.dep *.$(OBJEXT) \ + *.g.$(OBJEXT) *.output *~ + + +.PHONY: report clean distclean