From 99a9a2bd66a630d9efaaade7091138f8bd96b3e6 Mon Sep 17 00:00:00 2001 From: Matthias Maier Date: Fri, 18 Jul 2014 01:20:26 +0200 Subject: [PATCH] Testsuite: Port to new repository layout Update run_testsuite.cmake and all places in the build system to the new file system layout. Remove TESTS_DIR and hardwire ${CMAKE_SOURCE_DIR}/tests --- CMakeLists.txt | 10 ++-- cmake/scripts/run_testsuite.cmake | 5 +- tests/CMakeLists.txt | 98 ++++++++++++++----------------- tests/README | 2 +- tests/run_testsuite.cmake | 12 +--- tests/submit_results.cmake | 3 +- 6 files changed, 55 insertions(+), 75 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7105a28406..e9b4e3a5ee 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -64,11 +64,7 @@ IF(EXISTS ${CMAKE_SOURCE_DIR}/doc/CMakeLists.txt) SET(DEAL_II_HAVE_DOC_DIRECTORY TRUE) ENDIF() -IF(NOT DEFINED TEST_DIR) - GET_FILENAME_COMPONENT(TEST_DIR "${CMAKE_SOURCE_DIR}" PATH) - SET(TEST_DIR "${TEST_DIR}/tests") -ENDIF() -IF(EXISTS ${TEST_DIR}/CMakeLists.txt) +IF(EXISTS ${CMAKE_SOURCE_DIR}/tests/CMakeLists.txt) SET(DEAL_II_HAVE_TESTS_DIRECTORY TRUE) ENDIF() @@ -157,7 +153,9 @@ ADD_SUBDIRECTORY(cmake/config) # has to be included after source ADD_SUBDIRECTORY(contrib) # has to be included after source ADD_SUBDIRECTORY(examples) -ADD_SUBDIRECTORY(tests) +IF(DEAL_II_HAVE_TESTS_DIRECTORY) + ADD_SUBDIRECTORY(tests) +ENDIF() # # And finally, print the configuration: diff --git a/cmake/scripts/run_testsuite.cmake b/cmake/scripts/run_testsuite.cmake index 0092c27029..9883a278a7 100644 --- a/cmake/scripts/run_testsuite.cmake +++ b/cmake/scripts/run_testsuite.cmake @@ -137,9 +137,8 @@ IF("${CTEST_SOURCE_DIRECTORY}" STREQUAL "") IF(NOT EXISTS ${CTEST_SOURCE_DIRECTORY}/CMakeLists.txt) MESSAGE(FATAL_ERROR " Could not find a suitable source directory. There is no source directory -\"../deal.II\" or \"../../\" relative to the location of this script. -Please, set CTEST_SOURCE_DIRECTORY manually to the appropriate source -directory. +\"../../\" relative to the location of this script. Please, set +CTEST_SOURCE_DIRECTORY manually to the appropriate source directory. " ) ENDIF() diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index a42a1f6bda..4fb9b299a5 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -37,7 +37,6 @@ ADD_SUBDIRECTORY(quick_tests) # CMAKE_BINARY_DIR/tests: # -MESSAGE(STATUS "Testsuite will be set up with TEST_DIR=${TEST_DIR}") MESSAGE(STATUS "Setting up testsuite") FILE(WRITE ${CMAKE_BINARY_DIR}/CTestTestfile.cmake "SUBDIRS(tests)") @@ -60,13 +59,12 @@ FOREACH(_var ENDIF() ENDFOREACH() -# -# Glob together a list of all subfolders to set up: -# - -FILE(GLOB _categories RELATIVE ${TEST_DIR} ${TEST_DIR}/*) -SET(_categories all-headers build_tests mesh_converter ${_categories}) -LIST(REMOVE_DUPLICATES _categories) +SET(_categories + a-framework algorithms all-headers aniso base bits build_tests codim_one + deal.II distributed_grids fe gla grid hp integrators lac lapack manifold + matrix_free mesh_converter metis mpi multigrid mumps petsc serialization + slepc trilinos umfpack + ) # # Custom targets for the testsuite: @@ -85,52 +83,44 @@ ADD_CUSTOM_TARGET(regen_tests) ADD_CUSTOM_TARGET(clean_tests) FOREACH(_category ${_categories}) - IF(EXISTS ${CMAKE_SOURCE_DIR}/tests/${_category}/CMakeLists.txt) - SET(_category_dir ${CMAKE_SOURCE_DIR}/tests/${_category}) - ELSEIF(EXISTS ${TEST_DIR}/${_category}/CMakeLists.txt) - SET(_category_dir ${TEST_DIR}/${_category}) - ELSE() - SET(_category_dir) - ENDIF() - - IF(NOT "${_category_dir}" STREQUAL "") - ADD_CUSTOM_TARGET(setup_tests_${_category} - COMMAND ${CMAKE_COMMAND} -E make_directory - ${CMAKE_BINARY_DIR}/tests/${_category} - COMMAND cd ${CMAKE_BINARY_DIR}/tests/${_category} && - ${CMAKE_COMMAND} -G${CMAKE_GENERATOR} ${_options} ${_category_dir} - > /dev/null - COMMENT "Processing tests/${_category}" - ) - ADD_DEPENDENCIES(setup_tests setup_tests_${_category}) - - ADD_CUSTOM_TARGET(prune_tests_${_category} - COMMAND ${CMAKE_COMMAND} -E remove_directory - ${CMAKE_BINARY_DIR}/tests/${_category} - COMMENT "Processing tests/${_category}" - ) - ADD_DEPENDENCIES(prune_tests prune_tests_${_category}) - - ADD_CUSTOM_TARGET(regen_tests_${_category} - COMMAND - test ! -d ${CMAKE_BINARY_DIR}/tests/${_category} || ${CMAKE_COMMAND} - --build ${CMAKE_BINARY_DIR}/tests/${_category} --target regenerate - COMMENT "Processing tests/${_category}" - ) - ADD_DEPENDENCIES(regen_tests regen_tests_${_category}) - - ADD_CUSTOM_TARGET(clean_tests_${_category} - COMMAND - test ! -d ${CMAKE_BINARY_DIR}/tests/${_category} || ${CMAKE_COMMAND} - --build ${CMAKE_BINARY_DIR}/tests/${_category} --target clean - COMMENT "Processing tests/${_category}" - ) - ADD_DEPENDENCIES(clean_tests clean_tests_${_category}) - - FILE(APPEND ${CMAKE_BINARY_DIR}/tests/CTestTestfile.cmake - "SUBDIRS(${_category})\n" - ) - ENDIF() + SET(_category_dir ${CMAKE_SOURCE_DIR}/tests/${_category}) + + ADD_CUSTOM_TARGET(setup_tests_${_category} + COMMAND ${CMAKE_COMMAND} -E make_directory + ${CMAKE_BINARY_DIR}/tests/${_category} + COMMAND cd ${CMAKE_BINARY_DIR}/tests/${_category} && + ${CMAKE_COMMAND} -G${CMAKE_GENERATOR} ${_options} ${_category_dir} + > /dev/null + COMMENT "Processing tests/${_category}" + ) + ADD_DEPENDENCIES(setup_tests setup_tests_${_category}) + + ADD_CUSTOM_TARGET(prune_tests_${_category} + COMMAND ${CMAKE_COMMAND} -E remove_directory + ${CMAKE_BINARY_DIR}/tests/${_category} + COMMENT "Processing tests/${_category}" + ) + ADD_DEPENDENCIES(prune_tests prune_tests_${_category}) + + ADD_CUSTOM_TARGET(regen_tests_${_category} + COMMAND + test ! -d ${CMAKE_BINARY_DIR}/tests/${_category} || ${CMAKE_COMMAND} + --build ${CMAKE_BINARY_DIR}/tests/${_category} --target regenerate + COMMENT "Processing tests/${_category}" + ) + ADD_DEPENDENCIES(regen_tests regen_tests_${_category}) + + ADD_CUSTOM_TARGET(clean_tests_${_category} + COMMAND + test ! -d ${CMAKE_BINARY_DIR}/tests/${_category} || ${CMAKE_COMMAND} + --build ${CMAKE_BINARY_DIR}/tests/${_category} --target clean + COMMENT "Processing tests/${_category}" + ) + ADD_DEPENDENCIES(clean_tests clean_tests_${_category}) + + FILE(APPEND ${CMAKE_BINARY_DIR}/tests/CTestTestfile.cmake + "SUBDIRS(${_category})\n" + ) ENDFOREACH() MESSAGE(STATUS "Setting up testsuite - Done") diff --git a/tests/README b/tests/README index dfc75f80e9..7fbfbe1e99 100644 --- a/tests/README +++ b/tests/README @@ -1,5 +1,5 @@ Further information: The testsuite documentation is located at - ../deal.II/doc/developers/testsuite.html. + ../doc/developers/testsuite.html. Alternatively, have a look at http://www.dealii.org/ diff --git a/tests/run_testsuite.cmake b/tests/run_testsuite.cmake index 5efc0979e3..10c3f3692d 100644 --- a/tests/run_testsuite.cmake +++ b/tests/run_testsuite.cmake @@ -28,22 +28,16 @@ set CTEST_BINARY_DIRECTORY accordingly. ) ENDIF() -# -# Try to find the source directory and invoke -# ./cmake/scripts/run_testsuite.cmake from this location: -# - IF("${CTEST_SOURCE_DIRECTORY}" STREQUAL "") # If CTEST_SOURCE_DIRECTORY is not set we just assume that this script - # was called residing under ../tests relative to the source directory. - GET_FILENAME_COMPONENT(_path "${CMAKE_CURRENT_LIST_DIR}" PATH) - SET(CTEST_SOURCE_DIRECTORY ${_path}/deal.II) + # was called residing under ./tests relative to the source directory. + GET_FILENAME_COMPONENT(CTEST_SOURCE_DIRECTORY "${CMAKE_CURRENT_LIST_DIR}" PATH) ENDIF() IF(NOT EXISTS ${CTEST_SOURCE_DIRECTORY}/cmake/scripts/run_testsuite.cmake) MESSAGE(FATAL_ERROR " Could not find a suitable source directory. -There is no source directory \"../deal.II\" relative to the location of +There is no source directory under \"../\" relative to the location of this script. Please, set CTEST_SOURCE_DIRECTORY manually to the appropriate source directory. " diff --git a/tests/submit_results.cmake b/tests/submit_results.cmake index f3d2b416f2..d6ff033a36 100644 --- a/tests/submit_results.cmake +++ b/tests/submit_results.cmake @@ -28,8 +28,7 @@ # IF("${CTEST_SOURCE_DIRECTORY}" STREQUAL "") - GET_FILENAME_COMPONENT(_path "${CMAKE_CURRENT_LIST_DIR}" PATH) - SET(CTEST_SOURCE_DIRECTORY ${_path}/deal.II) + GET_FILENAME_COMPONENT(CTEST_SOURCE_DIRECTORY "${CMAKE_CURRENT_LIST_DIR}" PATH) IF(NOT EXISTS ${CTEST_SOURCE_DIRECTORY}/CTestConfig.cmake) SET(CTEST_SOURCE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) ENDIF() -- 2.39.5