]> https://gitweb.dealii.org/ - dealii.git/commitdiff
CMake: prepend quick_tests_ to quick test targets
authorMatthias Maier <tamiko@43-1.org>
Tue, 29 Nov 2022 06:29:03 +0000 (00:29 -0600)
committerMatthias Maier <tamiko@43-1.org>
Tue, 29 Nov 2022 16:16:47 +0000 (10:16 -0600)
tests/CMakeLists.txt
tests/quick_tests/CMakeLists.txt

index ca5603ea9929e2230c4d9c79de76c43f5aefb18e..d759f69dd8e7658ccd0aca50b9a53e644711bad5 100644 (file)
@@ -95,7 +95,9 @@ else()
   set(_options "-DDEAL_II_DIR=${DEAL_II_PATH}")
 endif()
 
-file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/CTestTestfile.cmake "")
+file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/CTestTestfile.cmake
+    "subdirs(quick_tests)\n"
+    )
 
 #
 # Always undefine the following variables in the setup_tests target:
index 4ebe62aeac41c53687aac70a98a2cbc3dc1e6423..880173408ff993a42f7c939920ab9f420a1d801b 100644 (file)
@@ -34,8 +34,10 @@ set(ALL_TESTS) # clean variable
 # define a macro to set up a quick test:
 macro(make_quicktest test_basename build_name mpi_run)
   string(TOLOWER ${build_name} _build_lowercase)
-  set(_target ${test_basename}.${_build_lowercase})
-  list(APPEND ALL_TESTS "${_target}")
+  set(_test "quick_tests/${test_basename}.${_build_lowercase}")
+  set(_target "quick_tests_${test_basename}_${_build_lowercase}")
+
+  list(APPEND ALL_TESTS "${_test}")
   add_executable(${_target} EXCLUDE_FROM_ALL ${test_basename}.cc)
   insource_setup_target(${_target} ${build_name})
 
@@ -48,7 +50,7 @@ macro(make_quicktest test_basename build_name mpi_run)
       set(_command ${MPIEXEC} ${MPIEXEC_NUMPROC_FLAG} ${mpi_run} ${MPIEXEC_PREFLAGS} ./${_target})
     endif()
   endif()
-  add_custom_target(${_target}.run
+  add_custom_target(${_target}_run
     DEPENDS ${_target}
     COMMAND
       ${_command} > ${_target}-OK 2>&1
@@ -56,25 +58,25 @@ macro(make_quicktest test_basename build_name mpi_run)
          && cat ${_target}-OK
          && rm ${_target}-OK
          && exit 1)
-    COMMAND echo "${_target}: PASSED."
+    COMMAND echo "${_test}: PASSED."
     WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
     )
 
-  # this is a hack to make sure the -OK file is deleted
-  # even if compilation fails.
-  add_custom_target(reset-${_target}-OK
+  # this is a hack to make sure the -OK file is deleted even if compilation
+  # fails.
+  add_custom_target(reset_${_target}
     COMMAND ${CMAKE_COMMAND} -E remove -f ${_target}-OK
     WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
     )
-  add_dependencies(${_target} reset-${_target}-OK)
+  add_dependencies(${_target} reset_${_target})
 
-  add_test(NAME ${_target}
-    COMMAND ${CMAKE_COMMAND} -DTRGT=${_target}.run -DTEST=${_target}
+  add_test(NAME ${_test}
+    COMMAND ${CMAKE_COMMAND} -DTRGT=${_target}_run -DTEST=${_test}
       -DBINARY_DIR=${CMAKE_BINARY_DIR}
       -P ${CMAKE_SOURCE_DIR}/cmake/scripts/run_test.cmake
     WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
     )
-  set_tests_properties(${_target} PROPERTIES
+  set_tests_properties(${_test} PROPERTIES
     LABEL "sanity checks"
     ENVIRONMENT "OMPI_MCA_rmaps_base_oversubscribe=1")
   # ^^^ Allow oversubscription for MPI (needed for Openmpi@3.0)

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.