--- /dev/null
+## ---------------------------------------------------------------------
+## $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()
+++ /dev/null
-# 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