From: Matthias Maier Date: Tue, 3 Sep 2013 22:15:29 +0000 (+0000) Subject: Port all-headers X-Git-Tag: v8.1.0~570^2~385 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bf3dec009564d55e8551c2dbdc6d694213655a53;p=dealii.git Port all-headers git-svn-id: https://svn.dealii.org/branches/branch_port_the_testsuite@30580 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/cmake/macros/macro_deal_ii_add_test.cmake b/deal.II/cmake/macros/macro_deal_ii_add_test.cmake index 4223836a40..0e947df9c0 100644 --- a/deal.II/cmake/macros/macro_deal_ii_add_test.cmake +++ b/deal.II/cmake/macros/macro_deal_ii_add_test.cmake @@ -149,7 +149,7 @@ MACRO(DEAL_II_ADD_TEST _category _test_name) ADD_TEST(NAME ${_category}/${_test} COMMAND ${CMAKE_COMMAND} - -DTEST=${_full_test} + -DTEST=${_full_test}.diff -DDEAL_II_BINARY_DIR=${CMAKE_BINARY_DIR} -P ${CMAKE_SOURCE_DIR}/cmake/scripts/run_test.cmake WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${_test} diff --git a/deal.II/cmake/scripts/run_test.cmake b/deal.II/cmake/scripts/run_test.cmake index cc13455227..65a5eaa35c 100644 --- a/deal.II/cmake/scripts/run_test.cmake +++ b/deal.II/cmake/scripts/run_test.cmake @@ -6,11 +6,14 @@ # EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} - --build ${DEAL_II_BINARY_DIR} --target ${TEST}.diff + --build ${DEAL_II_BINARY_DIR} --target ${TEST} RESULT_VARIABLE _result_code OUTPUT_VARIABLE _output ) +# Remove the trailing ".diff" from the target name: +STRING(REGEX REPLACE "\.diff$" "" TEST "${TEST}") + IF("${_result_code}" STREQUAL "0") MESSAGE("${TEST}: Test successful:") diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 291d50f2fe..40ca010d8c 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -66,6 +66,7 @@ SET_IF_EMPTY(TEST_TIME_LIMIT 120) MESSAGE(STATUS "Proceed to test definitions") ADD_SUBDIRECTORY(a-framework) +ADD_SUBDIRECTORY(all-headers) ADD_SUBDIRECTORY(aniso) ADD_SUBDIRECTORY(base) ADD_SUBDIRECTORY(bits) diff --git a/tests/all-headers/CMakeLists.txt b/tests/all-headers/CMakeLists.txt new file mode 100644 index 0000000000..7546d3b410 --- /dev/null +++ b/tests/all-headers/CMakeLists.txt @@ -0,0 +1,58 @@ +# +# Header tests are special: +# +# Construct a list of all header files and build up a test that just tries +# to compile a simple worker (test_header.cc) that only includes the given +# header file. We omit linking to safe some time. +# +SET(_category all-headers) + +FILE(GLOB_RECURSE _header + ${CMAKE_SOURCE_DIR}/include/*.h + ) + +FOREACH(_full_file ${_header}) + GET_FILENAME_COMPONENT(_file ${_full_file} NAME) + GET_FILENAME_COMPONENT(_path ${_full_file} PATH) + GET_FILENAME_COMPONENT(_path ${_path} NAME) + + FOREACH(_build ${DEAL_II_BUILD_TYPES}) + STRING(TOLOWER ${_build} _build_lowercase) + + SET(_test ${_category}-${_path}-${_file}.${_build_lowercase}) + + # + # Add an object library for each header file and build configuration: + # + ADD_LIBRARY(${_test} OBJECT EXCLUDE_FROM_ALL test_header.cc) + SET_TARGET_PROPERTIES(${_test} PROPERTIES + COMPILE_DEFINITIONS "${DEAL_II_DEFINITIONS};${DEAL_II_DEFINITIONS_${_build}}" + COMPILE_FLAGS "${DEAL_II_CXX_FLAGS_${_build}}" + ) + SET_PROPERTY(TARGET ${_test} APPEND PROPERTY + INCLUDE_DIRECTORIES + "${CMAKE_BINARY_DIR}/include" + "${CMAKE_SOURCE_DIR}/include" + "${CMAKE_SOURCE_DIR}/include/deal.II/" + ) + SET_PROPERTY(TARGET ${_test} APPEND PROPERTY + COMPILE_DEFINITIONS + HEADER= + ) + + # + # And finally add the test: + # + ADD_TEST(NAME ${_category}/${_path}/${_file}.${_build} + COMMAND ${CMAKE_COMMAND} + -DTEST=${_test} + -DDEAL_II_BINARY_DIR=${CMAKE_BINARY_DIR} + -P ${CMAKE_SOURCE_DIR}/cmake/scripts/run_test.cmake + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + ) + SET_TESTS_PROPERTIES(${_category}/${_path}/${_file}.${_build} PROPERTIES + LABEL "${_category}" + TIMEOUT ${TEST_TIME_LIMIT} + ) + ENDFOREACH() +ENDFOREACH() diff --git a/tests/all-headers/Makefile b/tests/all-headers/Makefile deleted file mode 100644 index 25232bb861..0000000000 --- a/tests/all-headers/Makefile +++ /dev/null @@ -1,106 +0,0 @@ -# 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 - -# The mail program. Override this by something like -# -# MAIL=mymailprog -# -# as part of the 'make' arguments or in the environment to use a different -# mail agent or to tunnel through ssh. The mail program takes a single -# argument, which is the mail address for tests The contents of the mail will -# be provided on STDIN -MAIL ?= mail - - -############################################################ -# 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 - @echo =====debug========= $@ - @$(CXX) $(flags) -c $< -o $@ - -%.$(OBJEXT) : %.cc - @echo =====optimized===== $@ - @$(CXX) $(CXXFLAGS.o) -c $< -o $@ - -%.cc : - @echo "=================== $@" - @echo "#include <$^>" > $@ - @echo "// make sure we include config.h somehow:" >> $@ - @echo "DEAL_II_NAMESPACE_OPEN DEAL_II_NAMESPACE_CLOSE" >> $@ - -%.OK : %.g.$(OBJEXT) - @echo "=================== $@" - @touch $@ - - -default: all - -# collect all headers -HEADERS = $(shell cd $D; echo include/deal.II/*/*.h) -TESTS = $(shell for i in $(HEADERS) ; do echo test-$$i | $(PERL) -pi -e 's/.h$$/.OK/g; s/\//-/g;' ; done) - -ID = `id -un`"@"`hostname` - - -# 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/%) - @for i in $(HEADERS) ; do \ - echo `echo test-$$i | $(PERL) -pi -e 's/\.h/.cc/g; s/\//-/g;'` : $D/$$i ; \ - done > 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: - @-$(MAKE) -k - @-svn info . | grep '^Revision' - @echo 'Date: ' `date -u +"%Y %j %F %U-%w"` - @echo 'Id: ' $(ID) - @for test in $(TESTS) ; do \ - testname=`echo $$test | perl -pi -e 's/.*include.//g; s/\//-/g;'` ; \ - if test -f $$test ; then \ - echo "`date -u +"%Y-%m-%d %H:%M"` + $(WORKDIR)/$$testname" ; \ - else \ - echo "`date -u +"%Y-%m-%d %H:%M"` 0 $(WORKDIR)/$$testname" ; \ - fi ; \ - done - -report+mail: all - @$(MAKE) report | tee testresults - @cat testresults | $(MAIL) dealii.regression.tests@gmail.com - @rm testresults - - -clean: - -rm -f Makefile.dep *.$(OBJEXT) \ - *.g.$(OBJEXT) *.output *~ *.OK *.cc - -summary: - @echo "not implemented" - -.PHONY: report clean distclean all default report report+mail summary diff --git a/tests/all-headers/test_header.cc b/tests/all-headers/test_header.cc new file mode 100644 index 0000000000..fbd150cfed --- /dev/null +++ b/tests/all-headers/test_header.cc @@ -0,0 +1,10 @@ +#include HEADER + +// Make sure that config.h is always included: +DEAL_II_NAMESPACE_OPEN +DEAL_II_NAMESPACE_CLOSE + +int main() +{ + return 0; +}