Skip to content
This repository was archived by the owner on Mar 20, 2023. It is now read-only.

Commit a0bd5c9

Browse files
authored
Enable CoreNEURON tests in NEURON (#495)
- CoreNEURON's CTest tests are now run as part of the top-level `make test` target even when CoreNEURON is built as a submodule of NEURON. - Removed some trivial usage of file(GLOB ...) to collect lists of source files. The CMake documentation advises against this pattern: https://cmake.org/cmake/help/v3.19/command/file.html#glob
1 parent d16248b commit a0bd5c9

File tree

5 files changed

+10
-26
lines changed

5 files changed

+10
-26
lines changed

CMakeLists.txt

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ list(APPEND CMAKE_MODULE_PATH ${CORENEURON_PROJECT_SOURCE_DIR}/CMake
4343
# HPC Coding Conventions
4444
# =============================================================================
4545
set(CODING_CONV_PREFIX "CORENRN")
46+
set(CORENRN_3RDPARTY_DIR "external")
4647
set(CORENRN_ClangFormat_EXCLUDES_RE
4748
".*/external/.*$$"
4849
CACHE STRING "list of regular expressions to exclude C/C++ files from formatting" FORCE)
@@ -94,10 +95,6 @@ set(LIKWID_DIR
9495
""
9596
CACHE PATH "Path to likwid performance analysis suite")
9697

97-
if(CORENEURON_AS_SUBPROJECT)
98-
set(CORENRN_ENABLE_UNIT_TESTS OFF)
99-
endif()
100-
10198
# =============================================================================
10299
# Project version from git and project directories
103100
# =============================================================================

tests/unit/alignment/CMakeLists.txt

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,13 @@
33
#
44
# See top-level LICENSE file for details.
55
# =============================================================================
6-
76
include_directories(${CMAKE_SOURCE_DIR}/coreneuron ${Boost_INCLUDE_DIRS})
8-
file(GLOB alignment_test_src "*.cpp")
97

10-
add_executable(alignment_test_bin ${alignment_test_src})
8+
add_executable(alignment_test_bin alignment.cpp)
119
target_link_libraries(alignment_test_bin ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY})
1210

1311
if(CORENRN_ENABLE_GPU)
1412
target_link_libraries(alignment_test_bin ${link_cudacoreneuron} ${CUDA_LIBRARIES})
1513
endif()
1614

17-
add_test(NAME alignment_test COMMAND ${TEST_EXEC_PREFIX}
18-
${CMAKE_CURRENT_BINARY_DIR}/alignment_test_bin)
15+
add_test(NAME alignment_test COMMAND ${TEST_EXEC_PREFIX} $<TARGET_FILE:alignment_test_bin>)

tests/unit/cmdline_interface/CMakeLists.txt

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,7 @@
33
#
44
# See top-level LICENSE file for details.
55
# =============================================================================
6-
7-
file(GLOB cmd_interface_test_src "*.cpp")
8-
9-
add_executable(cmd_interface_test_bin ${cmd_interface_test_src})
6+
add_executable(cmd_interface_test_bin test_cmdline_interface.cpp)
107
target_link_libraries(
118
cmd_interface_test_bin
129
${MPI_CXX_LIBRARIES}
@@ -19,5 +16,4 @@ target_include_directories(cmd_interface_test_bin SYSTEM
1916
PRIVATE ${CORENEURON_PROJECT_SOURCE_DIR}/external/CLI11/include)
2017
add_dependencies(cmd_interface_test_bin nrniv-core)
2118

22-
add_test(NAME cmd_interface_test COMMAND ${TEST_EXEC_PREFIX}
23-
${CMAKE_CURRENT_BINARY_DIR}/cmd_interface_test_bin)
19+
add_test(NAME cmd_interface_test COMMAND ${TEST_EXEC_PREFIX} $<TARGET_FILE:cmd_interface_test_bin>)

tests/unit/interleave_info/CMakeLists.txt

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,7 @@
33
#
44
# See top-level LICENSE file for details.
55
# =============================================================================
6-
7-
file(GLOB interleave_info_src "*.cpp")
8-
9-
add_executable(interleave_info_bin ${interleave_info_src})
6+
add_executable(interleave_info_bin check_constructors.cpp)
107
target_link_libraries(
118
interleave_info_bin
129
${MPI_CXX_LIBRARIES}
@@ -17,5 +14,5 @@ target_link_libraries(
1714
${sonatareport_LIBRARY})
1815
add_dependencies(interleave_info_bin nrniv-core)
1916

20-
add_test(NAME interleave_info_constructor_test
21-
COMMAND ${TEST_EXEC_PREFIX} ${CMAKE_CURRENT_BINARY_DIR}/interleave_info_bin)
17+
add_test(NAME interleave_info_constructor_test COMMAND ${TEST_EXEC_PREFIX}
18+
$<TARGET_FILE:interleave_info_bin>)

tests/unit/queueing/CMakeLists.txt

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,7 @@
33
#
44
# See top-level LICENSE file for details.
55
# =============================================================================
6-
7-
file(GLOB queuing_test_src "*.cpp")
8-
9-
add_executable(queuing_test_bin ${queuing_test_src})
6+
add_executable(queuing_test_bin test_queueing.cpp)
107
target_link_libraries(
118
queuing_test_bin
129
${Boost_UNIT_TEST_FRAMEWORK_LIBRARY}
@@ -17,4 +14,4 @@ target_link_libraries(
1714
${sonatareport_LIBRARY})
1815
add_dependencies(queuing_test_bin nrniv-core)
1916

20-
add_test(NAME queuing_test COMMAND ${TEST_EXEC_PREFIX} ${CMAKE_CURRENT_BINARY_DIR}/queuing_test_bin)
17+
add_test(NAME queuing_test COMMAND ${TEST_EXEC_PREFIX} $<TARGET_FILE:queuing_test_bin>)

0 commit comments

Comments
 (0)