]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Add mesh_converter tests Part I
authorMatthias Maier <tamiko@kyomu.43-1.org>
Sun, 20 Oct 2013 12:49:40 +0000 (12:49 +0000)
committerMatthias Maier <tamiko@kyomu.43-1.org>
Sun, 20 Oct 2013 12:49:40 +0000 (12:49 +0000)
git-svn-id: https://svn.dealii.org/branches/branch_port_the_testsuite@31327 0785d39b-7218-0410-832d-ea1e28bc413d

24 files changed:
deal.II/tests/mesh_converter/CMakeLists.txt [new file with mode: 0644]
deal.II/tests/mesh_converter/meshes/2d/2d_test.cub [moved from tests/mesh_converter/meshes/2d/2d_test.cub with 100% similarity, mode: 0644]
deal.II/tests/mesh_converter/meshes/2d/2d_test.inp [moved from tests/mesh_converter/meshes/2d/2d_test.inp with 100% similarity, mode: 0644]
deal.II/tests/mesh_converter/meshes/2d/2d_test.ucd [moved from tests/mesh_converter/meshes/2d/2d_test.ucd with 100% similarity, mode: 0644]
deal.II/tests/mesh_converter/meshes/2d/quad.cub [moved from tests/mesh_converter/meshes/2d/quad.cub with 100% similarity, mode: 0644]
deal.II/tests/mesh_converter/meshes/2d/quad.inp [moved from tests/mesh_converter/meshes/2d/quad.inp with 100% similarity, mode: 0644]
deal.II/tests/mesh_converter/meshes/2d/quad.ucd [moved from tests/mesh_converter/meshes/2d/quad.ucd with 100% similarity, mode: 0644]
deal.II/tests/mesh_converter/meshes/3d/CC.cub [moved from tests/mesh_converter/meshes/3d/CC.cub with 100% similarity, mode: 0644]
deal.II/tests/mesh_converter/meshes/3d/CC_cubit_new.inp [moved from tests/mesh_converter/meshes/3d/CC_cubit_new.inp with 100% similarity, mode: 0644]
deal.II/tests/mesh_converter/meshes/3d/CC_cubit_new.ucd [moved from tests/mesh_converter/meshes/3d/CC_cubit_new.ucd with 100% similarity, mode: 0644]
deal.II/tests/mesh_converter/meshes/3d/CC_cubit_old.inp [moved from tests/mesh_converter/meshes/3d/CC_cubit_old.inp with 100% similarity, mode: 0644]
deal.II/tests/mesh_converter/meshes/3d/CC_cubit_old.ucd [moved from tests/mesh_converter/meshes/3d/CC_cubit_old.ucd with 100% similarity, mode: 0644]
deal.II/tests/mesh_converter/meshes/3d/other_simple.inp [moved from tests/mesh_converter/meshes/3d/other_simple.inp with 100% similarity]
deal.II/tests/mesh_converter/meshes/3d/other_simple.ucd [moved from tests/mesh_converter/meshes/3d/other_simple.ucd with 100% similarity]
deal.II/tests/mesh_converter/meshes/3d/test_cube_1.cub [moved from tests/mesh_converter/meshes/3d/test_cube_1.cub with 100% similarity, mode: 0644]
deal.II/tests/mesh_converter/meshes/3d/test_cube_1.inp [moved from tests/mesh_converter/meshes/3d/test_cube_1.inp with 100% similarity, mode: 0644]
deal.II/tests/mesh_converter/meshes/3d/test_cube_1.ucd [moved from tests/mesh_converter/meshes/3d/test_cube_1.ucd with 100% similarity, mode: 0644]
deal.II/tests/mesh_converter/meshes/3d/test_cube_pave_1.cub [moved from tests/mesh_converter/meshes/3d/test_cube_pave_1.cub with 100% similarity, mode: 0644]
deal.II/tests/mesh_converter/meshes/3d/test_cube_pave_1.inp [moved from tests/mesh_converter/meshes/3d/test_cube_pave_1.inp with 100% similarity, mode: 0644]
deal.II/tests/mesh_converter/meshes/3d/test_cube_pave_1.ucd [moved from tests/mesh_converter/meshes/3d/test_cube_pave_1.ucd with 100% similarity, mode: 0644]
deal.II/tests/mesh_converter/meshes/3d/test_cube_two_materials.cub [moved from tests/mesh_converter/meshes/3d/test_cube_two_materials.cub with 100% similarity, mode: 0644]
deal.II/tests/mesh_converter/meshes/3d/test_cube_two_materials.inp [moved from tests/mesh_converter/meshes/3d/test_cube_two_materials.inp with 100% similarity, mode: 0644]
deal.II/tests/mesh_converter/meshes/3d/test_cube_two_materials.ucd [moved from tests/mesh_converter/meshes/3d/test_cube_two_materials.ucd with 100% similarity, mode: 0644]
tests/mesh_converter/Makefile [deleted file]

diff --git a/deal.II/tests/mesh_converter/CMakeLists.txt b/deal.II/tests/mesh_converter/CMakeLists.txt
new file mode 100644 (file)
index 0000000..7226a6d
--- /dev/null
@@ -0,0 +1,118 @@
+## ---------------------------------------------------------------------
+## $Id$
+##
+## Copyright (C) 2013 by the deal.II authors
+##
+## This file is part of the deal.II library.
+##
+## The deal.II library is free software; you can use it, redistribute
+## it, and/or modify it under the terms of the GNU Lesser General
+## Public License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+## The full text of the license can be found in the file LICENSE at
+## the top level of the deal.II distribution.
+##
+## ---------------------------------------------------------------------
+
+CMAKE_MINIMUM_REQUIRED(VERSION 2.8.8)
+INCLUDE(${DEAL_II_SOURCE_DIR}/cmake/setup_testsuite.cmake)
+PROJECT(testsuite CXX)
+INCLUDE(${DEAL_II_TARGET_CONFIG})
+
+#
+# Tests for the mesh_converter executable
+#
+
+SET(_category mesh_converter)
+
+FILE(GLOB _meshes ${CMAKE_CURRENT_SOURCE_DIR}/meshes/?d/*.ucd)
+
+FOREACH(_full_file ${_meshes})
+  GET_FILENAME_COMPONENT(_mesh ${_full_file} NAME)
+
+  SET(_test_full ${_category}/${_mesh})
+  SET(_target ${_mesh})
+  SET(_diff_target ${_target}.diff)
+  SET(_test_directory ${CMAKE_CURRENT_BINARY_DIR}/${_target}) # directory to run the test in
+
+  STRING(REGEX REPLACE "\\.ucd$" ".inp" _comparison_file ${_full_file})
+
+  SET(_dim 3)
+  IF(_full_file MATCHES "meshes/2d")
+    SET(_dim 2)
+  ENDIF()
+
+  # Respect TEST_PICKUP_REGEX:
+  IF( "${TEST_PICKUP_REGEX}" STREQUAL "" OR
+      _test_full MATCHES "${TEST_PICKUP_REGEX}" )
+
+    FILE(MAKE_DIRECTORY ${_test_directory})
+
+    #
+    # Add a top level target to run and compare the test:
+    #
+
+    ADD_CUSTOM_COMMAND(OUTPUT ${_test_directory}/output
+      COMMAND rm -f ${_test_directory}/failing_output
+      COMMAND touch ${_test_directory}/output
+      COMMAND
+        mesh_converter ${_dim} < ${_full_file} > output
+        || (mv ${_test_directory}/output
+               ${_test_directory}/failing_output
+            && echo "${_test_full}: RUN failed. ------ Result: ${_test_directory}/failing_output"
+            && echo "${_test_full}: RUN failed. ------ Partial output:"
+            && cat ${_test_directory}/failing_output
+            && exit 1)
+      WORKING_DIRECTORY ${_test_directory}
+      DEPENDS mesh_converter
+      )
+    ADD_CUSTOM_COMMAND(OUTPUT ${_test_directory}/diff
+      COMMAND rm -f ${_test_directory}/failing_diff
+      COMMAND touch ${_test_directory}/diff
+      COMMAND
+        ${TEST_DIFF}
+          ${_test_directory}/output
+          ${_comparison_file}
+          > ${_test_directory}/diff
+        || (mv ${_test_directory}/diff
+               ${_test_directory}/failing_diff
+            && echo "${_test_full}: RUN successful."
+            && echo "${_test_full}: DIFF failed. ------ Source: ${_comparison_file}"
+            && echo "${_test_full}: DIFF failed. ------ Result: ${_test_directory}/output"
+            && echo "${_test_full}: DIFF failed. ------ Diff:   ${_test_directory}/failing_diff"
+            && echo "${_test_full}: DIFF failed. ------ Diffs as follows:"
+            && cat ${_test_directory}/failing_diff
+            && exit 1)
+      WORKING_DIRECTORY ${_test_directory}
+      DEPENDS
+        ${_test_directory}/output
+        ${_comparison_file}
+      )
+
+    ADD_CUSTOM_TARGET(${_diff_target} DEPENDS ${_test_directory}/diff
+      COMMAND
+           echo "${_test_full}: RUN successful."
+        && echo "${_test_full}: DIFF successful."
+        && echo "${_test_full}: PASSED."
+      )
+
+    #
+    # And finally add the test:
+    #
+
+    ADD_TEST(NAME ${_test_full}
+      COMMAND ${CMAKE_COMMAND}
+        -DTRGT=${_diff_target}
+        -DTEST=${_test_full}
+        -DDEAL_II_BINARY_DIR=${CMAKE_BINARY_DIR}
+        -P ${DEAL_II_SOURCE_DIR}/cmake/scripts/run_test.cmake
+      WORKING_DIRECTORY ${_test_directory}
+      )
+    SET_TESTS_PROPERTIES(${_test_full} PROPERTIES
+      LABEL "${_category}"
+      TIMEOUT ${TEST_TIME_LIMIT}
+      )
+
+  ENDIF()
+
+ENDFOREACH()
old mode 100755 (executable)
new mode 100644 (file)
similarity index 100%
rename from tests/mesh_converter/meshes/3d/CC.cub
rename to deal.II/tests/mesh_converter/meshes/3d/CC.cub
diff --git a/tests/mesh_converter/Makefile b/tests/mesh_converter/Makefile
deleted file mode 100644 (file)
index 0d5ad33..0000000
+++ /dev/null
@@ -1,100 +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:
-############################################################
-
-
-%.OK :
-       @echo "=================== $@"
-       @if test -n "`echo $< | grep 2d`" ; then \
-         (($D/bin/mesh_converter 2 $< $(@:OK=ucd) 2>&1) > $(@:OK=log)) ; \
-       else \
-         (($D/bin/mesh_converter 3 $< $(@:OK=ucd) 2>&1) > $(@:OK=log)) ; \
-       fi
-       @cmd="diff $(<:%.inp=%.ucd) $(@:OK=ucd) > /dev/null" ; \
-        if eval $$cmd ; then \
-                       echo '=====OK============' $@ ; \
-                       echo OK > $@ ; \
-        else \
-                       echo '+++++Error+++++++++' $@ ; \
-        fi
-
-
-
-default: all
-
-# collect all headers
-MESH_INPUTS = $(shell echo meshes/?d/*.inp)
-TESTS_X   = $(shell for i in $(MESH_INPUTS) ; do echo $$i | $(PERL) -pi -e 's/.inp$$/.OK/g;' ; done)
-TESTS     = $(shell echo $(TESTS_X:$D/%=%) | $(PERL) -pi -e 's/\//-/g;')
-
-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: $D/bin/mesh_converter $(MESH_INPUTS)
-       @for i in $(MESH_INPUTS) ; do \
-               echo `echo $$i | $(PERL) -pi -e 's/\.inp/.OK/g; s/\//-/g;'` : $$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 *.ucd *.log
-
-summary:
-       @printf "not implemented\n"
-
-.PHONY: report clean distclean all default report report+mail summary

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.