]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Port all-headers
authorMatthias Maier <tamiko@kyomu.43-1.org>
Tue, 3 Sep 2013 22:15:29 +0000 (22:15 +0000)
committerMatthias Maier <tamiko@kyomu.43-1.org>
Tue, 3 Sep 2013 22:15:29 +0000 (22:15 +0000)
git-svn-id: https://svn.dealii.org/branches/branch_port_the_testsuite@30580 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/cmake/macros/macro_deal_ii_add_test.cmake
deal.II/cmake/scripts/run_test.cmake
tests/CMakeLists.txt
tests/all-headers/CMakeLists.txt [new file with mode: 0644]
tests/all-headers/Makefile [deleted file]
tests/all-headers/test_header.cc [new file with mode: 0644]

index 4223836a40fccfc6aba451944b42217144b3523e..0e947df9c0b5213ffc1fe5efa54443193601396f 100644 (file)
@@ -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}
index cc13455227f54a0af2625b29eb810fac93b0d35e..65a5eaa35c8e021023967541cc372d1faec25beb 100644 (file)
@@ -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:")
index 291d50f2fede6a5d98a33582f2fae6f0a1e3a882..40ca010d8c5bdd12a066e34480a13a772892ae53 100644 (file)
@@ -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 (file)
index 0000000..7546d3b
--- /dev/null
@@ -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=<deal.II/${_path}/${_file}>
+      )
+
+    #
+    # 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 (file)
index 25232bb..0000000
+++ /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 <xxx>"
-# 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 (file)
index 0000000..fbd150c
--- /dev/null
@@ -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;
+}

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.