From fa99add8f6f2fb21aaba07d16738b81aafc2f1d4 Mon Sep 17 00:00:00 2001 From: Matthias Maier Date: Sun, 20 Oct 2013 12:49:40 +0000 Subject: [PATCH] Add mesh_converter tests Part I git-svn-id: https://svn.dealii.org/branches/branch_port_the_testsuite@31327 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/tests/mesh_converter/CMakeLists.txt | 118 ++++++++++++++++++ .../mesh_converter/meshes/2d/2d_test.cub | Bin .../mesh_converter/meshes/2d/2d_test.inp | 0 .../mesh_converter/meshes/2d/2d_test.ucd | 0 .../tests}/mesh_converter/meshes/2d/quad.cub | Bin .../tests}/mesh_converter/meshes/2d/quad.inp | 0 .../tests}/mesh_converter/meshes/2d/quad.ucd | 0 .../tests}/mesh_converter/meshes/3d/CC.cub | Bin .../mesh_converter/meshes/3d/CC_cubit_new.inp | 0 .../mesh_converter/meshes/3d/CC_cubit_new.ucd | 0 .../mesh_converter/meshes/3d/CC_cubit_old.inp | 0 .../mesh_converter/meshes/3d/CC_cubit_old.ucd | 0 .../mesh_converter/meshes/3d/other_simple.inp | 0 .../mesh_converter/meshes/3d/other_simple.ucd | 0 .../mesh_converter/meshes/3d/test_cube_1.cub | Bin .../mesh_converter/meshes/3d/test_cube_1.inp | 0 .../mesh_converter/meshes/3d/test_cube_1.ucd | 0 .../meshes/3d/test_cube_pave_1.cub | Bin .../meshes/3d/test_cube_pave_1.inp | 0 .../meshes/3d/test_cube_pave_1.ucd | 0 .../meshes/3d/test_cube_two_materials.cub | Bin .../meshes/3d/test_cube_two_materials.inp | 0 .../meshes/3d/test_cube_two_materials.ucd | 0 tests/mesh_converter/Makefile | 100 --------------- 24 files changed, 118 insertions(+), 100 deletions(-) create mode 100644 deal.II/tests/mesh_converter/CMakeLists.txt rename {tests => deal.II/tests}/mesh_converter/meshes/2d/2d_test.cub (100%) mode change 100755 => 100644 rename {tests => deal.II/tests}/mesh_converter/meshes/2d/2d_test.inp (100%) mode change 100755 => 100644 rename {tests => deal.II/tests}/mesh_converter/meshes/2d/2d_test.ucd (100%) mode change 100755 => 100644 rename {tests => deal.II/tests}/mesh_converter/meshes/2d/quad.cub (100%) mode change 100755 => 100644 rename {tests => deal.II/tests}/mesh_converter/meshes/2d/quad.inp (100%) mode change 100755 => 100644 rename {tests => deal.II/tests}/mesh_converter/meshes/2d/quad.ucd (100%) mode change 100755 => 100644 rename {tests => deal.II/tests}/mesh_converter/meshes/3d/CC.cub (100%) mode change 100755 => 100644 rename {tests => deal.II/tests}/mesh_converter/meshes/3d/CC_cubit_new.inp (100%) mode change 100755 => 100644 rename {tests => deal.II/tests}/mesh_converter/meshes/3d/CC_cubit_new.ucd (100%) mode change 100755 => 100644 rename {tests => deal.II/tests}/mesh_converter/meshes/3d/CC_cubit_old.inp (100%) mode change 100755 => 100644 rename {tests => deal.II/tests}/mesh_converter/meshes/3d/CC_cubit_old.ucd (100%) mode change 100755 => 100644 rename {tests => deal.II/tests}/mesh_converter/meshes/3d/other_simple.inp (100%) rename {tests => deal.II/tests}/mesh_converter/meshes/3d/other_simple.ucd (100%) rename {tests => deal.II/tests}/mesh_converter/meshes/3d/test_cube_1.cub (100%) mode change 100755 => 100644 rename {tests => deal.II/tests}/mesh_converter/meshes/3d/test_cube_1.inp (100%) mode change 100755 => 100644 rename {tests => deal.II/tests}/mesh_converter/meshes/3d/test_cube_1.ucd (100%) mode change 100755 => 100644 rename {tests => deal.II/tests}/mesh_converter/meshes/3d/test_cube_pave_1.cub (100%) mode change 100755 => 100644 rename {tests => deal.II/tests}/mesh_converter/meshes/3d/test_cube_pave_1.inp (100%) mode change 100755 => 100644 rename {tests => deal.II/tests}/mesh_converter/meshes/3d/test_cube_pave_1.ucd (100%) mode change 100755 => 100644 rename {tests => deal.II/tests}/mesh_converter/meshes/3d/test_cube_two_materials.cub (100%) mode change 100755 => 100644 rename {tests => deal.II/tests}/mesh_converter/meshes/3d/test_cube_two_materials.inp (100%) mode change 100755 => 100644 rename {tests => deal.II/tests}/mesh_converter/meshes/3d/test_cube_two_materials.ucd (100%) mode change 100755 => 100644 delete mode 100644 tests/mesh_converter/Makefile diff --git a/deal.II/tests/mesh_converter/CMakeLists.txt b/deal.II/tests/mesh_converter/CMakeLists.txt new file mode 100644 index 0000000000..7226a6dcf0 --- /dev/null +++ b/deal.II/tests/mesh_converter/CMakeLists.txt @@ -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() diff --git a/tests/mesh_converter/meshes/2d/2d_test.cub b/deal.II/tests/mesh_converter/meshes/2d/2d_test.cub old mode 100755 new mode 100644 similarity index 100% rename from tests/mesh_converter/meshes/2d/2d_test.cub rename to deal.II/tests/mesh_converter/meshes/2d/2d_test.cub diff --git a/tests/mesh_converter/meshes/2d/2d_test.inp b/deal.II/tests/mesh_converter/meshes/2d/2d_test.inp old mode 100755 new mode 100644 similarity index 100% rename from tests/mesh_converter/meshes/2d/2d_test.inp rename to deal.II/tests/mesh_converter/meshes/2d/2d_test.inp diff --git a/tests/mesh_converter/meshes/2d/2d_test.ucd b/deal.II/tests/mesh_converter/meshes/2d/2d_test.ucd old mode 100755 new mode 100644 similarity index 100% rename from tests/mesh_converter/meshes/2d/2d_test.ucd rename to deal.II/tests/mesh_converter/meshes/2d/2d_test.ucd diff --git a/tests/mesh_converter/meshes/2d/quad.cub b/deal.II/tests/mesh_converter/meshes/2d/quad.cub old mode 100755 new mode 100644 similarity index 100% rename from tests/mesh_converter/meshes/2d/quad.cub rename to deal.II/tests/mesh_converter/meshes/2d/quad.cub diff --git a/tests/mesh_converter/meshes/2d/quad.inp b/deal.II/tests/mesh_converter/meshes/2d/quad.inp old mode 100755 new mode 100644 similarity index 100% rename from tests/mesh_converter/meshes/2d/quad.inp rename to deal.II/tests/mesh_converter/meshes/2d/quad.inp diff --git a/tests/mesh_converter/meshes/2d/quad.ucd b/deal.II/tests/mesh_converter/meshes/2d/quad.ucd old mode 100755 new mode 100644 similarity index 100% rename from tests/mesh_converter/meshes/2d/quad.ucd rename to deal.II/tests/mesh_converter/meshes/2d/quad.ucd diff --git a/tests/mesh_converter/meshes/3d/CC.cub b/deal.II/tests/mesh_converter/meshes/3d/CC.cub old mode 100755 new mode 100644 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/meshes/3d/CC_cubit_new.inp b/deal.II/tests/mesh_converter/meshes/3d/CC_cubit_new.inp old mode 100755 new mode 100644 similarity index 100% rename from tests/mesh_converter/meshes/3d/CC_cubit_new.inp rename to deal.II/tests/mesh_converter/meshes/3d/CC_cubit_new.inp diff --git a/tests/mesh_converter/meshes/3d/CC_cubit_new.ucd b/deal.II/tests/mesh_converter/meshes/3d/CC_cubit_new.ucd old mode 100755 new mode 100644 similarity index 100% rename from tests/mesh_converter/meshes/3d/CC_cubit_new.ucd rename to deal.II/tests/mesh_converter/meshes/3d/CC_cubit_new.ucd diff --git a/tests/mesh_converter/meshes/3d/CC_cubit_old.inp b/deal.II/tests/mesh_converter/meshes/3d/CC_cubit_old.inp old mode 100755 new mode 100644 similarity index 100% rename from tests/mesh_converter/meshes/3d/CC_cubit_old.inp rename to deal.II/tests/mesh_converter/meshes/3d/CC_cubit_old.inp diff --git a/tests/mesh_converter/meshes/3d/CC_cubit_old.ucd b/deal.II/tests/mesh_converter/meshes/3d/CC_cubit_old.ucd old mode 100755 new mode 100644 similarity index 100% rename from tests/mesh_converter/meshes/3d/CC_cubit_old.ucd rename to deal.II/tests/mesh_converter/meshes/3d/CC_cubit_old.ucd diff --git a/tests/mesh_converter/meshes/3d/other_simple.inp b/deal.II/tests/mesh_converter/meshes/3d/other_simple.inp similarity index 100% rename from tests/mesh_converter/meshes/3d/other_simple.inp rename to deal.II/tests/mesh_converter/meshes/3d/other_simple.inp diff --git a/tests/mesh_converter/meshes/3d/other_simple.ucd b/deal.II/tests/mesh_converter/meshes/3d/other_simple.ucd similarity index 100% rename from tests/mesh_converter/meshes/3d/other_simple.ucd rename to deal.II/tests/mesh_converter/meshes/3d/other_simple.ucd diff --git a/tests/mesh_converter/meshes/3d/test_cube_1.cub b/deal.II/tests/mesh_converter/meshes/3d/test_cube_1.cub old mode 100755 new mode 100644 similarity index 100% rename from tests/mesh_converter/meshes/3d/test_cube_1.cub rename to deal.II/tests/mesh_converter/meshes/3d/test_cube_1.cub diff --git a/tests/mesh_converter/meshes/3d/test_cube_1.inp b/deal.II/tests/mesh_converter/meshes/3d/test_cube_1.inp old mode 100755 new mode 100644 similarity index 100% rename from tests/mesh_converter/meshes/3d/test_cube_1.inp rename to deal.II/tests/mesh_converter/meshes/3d/test_cube_1.inp diff --git a/tests/mesh_converter/meshes/3d/test_cube_1.ucd b/deal.II/tests/mesh_converter/meshes/3d/test_cube_1.ucd old mode 100755 new mode 100644 similarity index 100% rename from tests/mesh_converter/meshes/3d/test_cube_1.ucd rename to deal.II/tests/mesh_converter/meshes/3d/test_cube_1.ucd diff --git a/tests/mesh_converter/meshes/3d/test_cube_pave_1.cub b/deal.II/tests/mesh_converter/meshes/3d/test_cube_pave_1.cub old mode 100755 new mode 100644 similarity index 100% rename from tests/mesh_converter/meshes/3d/test_cube_pave_1.cub rename to deal.II/tests/mesh_converter/meshes/3d/test_cube_pave_1.cub diff --git a/tests/mesh_converter/meshes/3d/test_cube_pave_1.inp b/deal.II/tests/mesh_converter/meshes/3d/test_cube_pave_1.inp old mode 100755 new mode 100644 similarity index 100% rename from tests/mesh_converter/meshes/3d/test_cube_pave_1.inp rename to deal.II/tests/mesh_converter/meshes/3d/test_cube_pave_1.inp diff --git a/tests/mesh_converter/meshes/3d/test_cube_pave_1.ucd b/deal.II/tests/mesh_converter/meshes/3d/test_cube_pave_1.ucd old mode 100755 new mode 100644 similarity index 100% rename from tests/mesh_converter/meshes/3d/test_cube_pave_1.ucd rename to deal.II/tests/mesh_converter/meshes/3d/test_cube_pave_1.ucd diff --git a/tests/mesh_converter/meshes/3d/test_cube_two_materials.cub b/deal.II/tests/mesh_converter/meshes/3d/test_cube_two_materials.cub old mode 100755 new mode 100644 similarity index 100% rename from tests/mesh_converter/meshes/3d/test_cube_two_materials.cub rename to deal.II/tests/mesh_converter/meshes/3d/test_cube_two_materials.cub diff --git a/tests/mesh_converter/meshes/3d/test_cube_two_materials.inp b/deal.II/tests/mesh_converter/meshes/3d/test_cube_two_materials.inp old mode 100755 new mode 100644 similarity index 100% rename from tests/mesh_converter/meshes/3d/test_cube_two_materials.inp rename to deal.II/tests/mesh_converter/meshes/3d/test_cube_two_materials.inp diff --git a/tests/mesh_converter/meshes/3d/test_cube_two_materials.ucd b/deal.II/tests/mesh_converter/meshes/3d/test_cube_two_materials.ucd old mode 100755 new mode 100644 similarity index 100% rename from tests/mesh_converter/meshes/3d/test_cube_two_materials.ucd rename to deal.II/tests/mesh_converter/meshes/3d/test_cube_two_materials.ucd diff --git a/tests/mesh_converter/Makefile b/tests/mesh_converter/Makefile deleted file mode 100644 index 0d5ad334b7..0000000000 --- a/tests/mesh_converter/Makefile +++ /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 " -# 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 -- 2.39.5