From 1975c04c209fee635c1c15e593f79612bb796fbf Mon Sep 17 00:00:00 2001 From: Matthias Maier Date: Sun, 18 Aug 2013 21:08:11 +0000 Subject: [PATCH] First commit (tm) git-svn-id: https://svn.dealii.org/branches/branch_port_the_testsuite@30337 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/CMakeLists.txt | 2 +- .../cmake/macros/macro_deal_ii_add_test.cmake | 52 +++++++++++++++++++ deal.II/contrib/CMakeLists.txt | 2 - deal.II/contrib/test_affinity/CMakeLists.txt | 46 ---------------- .../threads/affinity.cc} | 0 tests/CMakeLists.txt | 6 ++- tests/base/CMakeLists.txt | 8 +++ tests/bits/CMakeLists.txt | 8 +++ tests/fe/CMakeLists.txt | 8 +++ 9 files changed, 82 insertions(+), 50 deletions(-) create mode 100644 deal.II/cmake/macros/macro_deal_ii_add_test.cmake delete mode 100644 deal.II/contrib/test_affinity/CMakeLists.txt rename deal.II/{contrib/test_affinity/test_affinity.cc => tests_tmp/threads/affinity.cc} (100%) create mode 100644 tests/base/CMakeLists.txt create mode 100644 tests/bits/CMakeLists.txt create mode 100644 tests/fe/CMakeLists.txt diff --git a/deal.II/CMakeLists.txt b/deal.II/CMakeLists.txt index 714613a8c7..c7f0ab92d4 100644 --- a/deal.II/CMakeLists.txt +++ b/deal.II/CMakeLists.txt @@ -146,7 +146,7 @@ ADD_SUBDIRECTORY(contrib) # has to be included after source ADD_SUBDIRECTORY(examples) IF(DEAL_II_HAVE_TESTS_DIRECTORY) - ADD_SUBDIRECTORY(${TEST_DIR} ${CMAKE_BINARY_DIR}/tests) + ADD_SUBDIRECTORY(${TEST_DIR} ${CMAKE_BINARY_DIR}/tests_ext) ENDIF() # diff --git a/deal.II/cmake/macros/macro_deal_ii_add_test.cmake b/deal.II/cmake/macros/macro_deal_ii_add_test.cmake new file mode 100644 index 0000000000..d19ca77bf3 --- /dev/null +++ b/deal.II/cmake/macros/macro_deal_ii_add_test.cmake @@ -0,0 +1,52 @@ +## --------------------------------------------------------------------- +## $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. +## +## --------------------------------------------------------------------- + +# +# Usage: +# DEAL_II_ADD_TEST(category test_name [configurations]) +# + +MACRO(DEAL_II_ADD_TEST _category _test_target) + + FOREACH(_build ${DEAL_II_BUILD_TYPES}) + + ITEM_MATCHES(_match "${_build}" ${ARGN}) + IF(_match OR "${ARGN}" STREQUAL "") + + STRING(TOLOWER ${_build} _build_lowercase) + ADD_EXECUTABLE(${_test_target}.${_build_lowercase} + ${_test_target}.cc + ) + SET_TARGET_PROPERTIES(${_test_target}.${_build_lowercase} PROPERTIES + LINK_FLAGS "${DEAL_II_LINKER_FLAGS} ${DEAL_II_LINKER_FLAGS_${_build}}" + COMPILE_DEFINITIONS "${DEAL_II_DEFINITIONS};${DEAL_II_DEFINITIONS_${_build}}" + COMPILE_FLAGS "${DEAL_II_CXX_FLAGS_${_build}}" + LINKER_LANGUAGE "CXX" + ) + SET_PROPERTY(TARGET ${_target} APPEND PROPERTY + INCLUDE_DIRECTORIES + "${CMAKE_BINARY_DIR}/include" + "${CMAKE_SOURCE_DIR}/include" + ) + + TARGET_LINK_LIBRARIES(${_test_target}.${_build_lowercase} + ${DEAL_II_BASE_NAME}${DEAL_II_${_build}_SUFFIX} + ) + ENDIF() + + ENDFOREACH() + +ENDMACRO() diff --git a/deal.II/contrib/CMakeLists.txt b/deal.II/contrib/CMakeLists.txt index f507b519eb..6e92950efa 100644 --- a/deal.II/contrib/CMakeLists.txt +++ b/deal.II/contrib/CMakeLists.txt @@ -22,5 +22,3 @@ IF(DEAL_II_COMPONENT_PARAMETER_GUI) ADD_SUBDIRECTORY(parameter_gui) ENDIF() -#ADD_SUBDIRECTORY(test_affinity) - diff --git a/deal.II/contrib/test_affinity/CMakeLists.txt b/deal.II/contrib/test_affinity/CMakeLists.txt deleted file mode 100644 index 83075153c0..0000000000 --- a/deal.II/contrib/test_affinity/CMakeLists.txt +++ /dev/null @@ -1,46 +0,0 @@ -## --------------------------------------------------------------------- -## $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) - -INCLUDE_DIRECTORIES( - BEFORE - ${CMAKE_SOURCE_DIR}/include/ - ${CMAKE_BINARY_DIR}/include/ - ) - -ADD_EXECUTABLE(test_affinity - test_affinity.cc - ) - -IF(CMAKE_BUILD_TYPE MATCHES "Debug") - SET(_build "DEBUG") -ELSE() - SET(_build "RELEASE") -ENDIF() - -SET_TARGET_PROPERTIES(test_affinity PROPERTIES - LINK_FLAGS "${DEAL_II_LINKER_FLAGS} ${DEAL_II_LINKER_FLAGS_${_build}}" - COMPILE_DEFINITIONS "${DEAL_II_DEFINITIONS};${DEAL_II_DEFINITIONS_${_build}}" - COMPILE_FLAGS "${DEAL_II_CXX_FLAGS_${_build}}" - LINKER_LANGUAGE "CXX" - ) - -TARGET_LINK_LIBRARIES(test_affinity ${DEAL_II_BASE_NAME}${DEAL_II_${_build}_SUFFIX}) - -IF(NOT CMAKE_CROSSCOMPILING) - ADD_CUSTOM_TARGET(run_test_affinity COMMAND test_affinity) -ENDIF() diff --git a/deal.II/contrib/test_affinity/test_affinity.cc b/deal.II/tests_tmp/threads/affinity.cc similarity index 100% rename from deal.II/contrib/test_affinity/test_affinity.cc rename to deal.II/tests_tmp/threads/affinity.cc diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index dcca0f909d..21aa49c925 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -1 +1,5 @@ -ADD_CUSTOM_TARGET(foobar) +MESSAGE(STATUS "Registering tests") +ADD_SUBDIRECTORY(base) +ADD_SUBDIRECTORY(bits) +ADD_SUBDIRECTORY(fe) +MESSAGE(STATUS "Tests") diff --git a/tests/base/CMakeLists.txt b/tests/base/CMakeLists.txt new file mode 100644 index 0000000000..34c42d8870 --- /dev/null +++ b/tests/base/CMakeLists.txt @@ -0,0 +1,8 @@ +GET_FILENAME_COMPONENT(_category ${CMAKE_CURRENT_SOURCE_DIR} NAME) + +FILE(GLOB _tests "*.cc") + +FOREACH(_test ${_tests}) + GET_FILENAME_COMPONENT(_test ${_test} NAME_WE) + DEAL_II_ADD_TEST(${_category} ${_test}) +ENDFOREACH() diff --git a/tests/bits/CMakeLists.txt b/tests/bits/CMakeLists.txt new file mode 100644 index 0000000000..34c42d8870 --- /dev/null +++ b/tests/bits/CMakeLists.txt @@ -0,0 +1,8 @@ +GET_FILENAME_COMPONENT(_category ${CMAKE_CURRENT_SOURCE_DIR} NAME) + +FILE(GLOB _tests "*.cc") + +FOREACH(_test ${_tests}) + GET_FILENAME_COMPONENT(_test ${_test} NAME_WE) + DEAL_II_ADD_TEST(${_category} ${_test}) +ENDFOREACH() diff --git a/tests/fe/CMakeLists.txt b/tests/fe/CMakeLists.txt new file mode 100644 index 0000000000..34c42d8870 --- /dev/null +++ b/tests/fe/CMakeLists.txt @@ -0,0 +1,8 @@ +GET_FILENAME_COMPONENT(_category ${CMAKE_CURRENT_SOURCE_DIR} NAME) + +FILE(GLOB _tests "*.cc") + +FOREACH(_test ${_tests}) + GET_FILENAME_COMPONENT(_test ${_test} NAME_WE) + DEAL_II_ADD_TEST(${_category} ${_test}) +ENDFOREACH() -- 2.39.5