Skip to content

Commit dc41d5b

Browse files
committed
Ensure ctests are discoverable in the root of each build dir
1 parent 2e8a4b6 commit dc41d5b

File tree

5 files changed

+7
-26
lines changed

5 files changed

+7
-26
lines changed

episodes/3-fortran-unit-test-syntax/challenge/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,5 @@ file(GLOB PROJ_SRC_FILES "${PROJECT_SOURCE_DIR}/src/*.f90")
1414
# Build src executables
1515
add_executable("${PROJECT_NAME}" "${PROJ_SRC_FILES}")
1616

17+
enable_testing()
1718
add_subdirectory("test")

episodes/3-fortran-unit-test-syntax/solution/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,5 @@ file(GLOB PROJ_SRC_FILES "${PROJECT_SOURCE_DIR}/src/*.f90")
1414
# Build src executables
1515
add_executable("${PROJECT_NAME}" "${PROJ_SRC_FILES}")
1616

17+
enable_testing()
1718
add_subdirectory("test")

episodes/3-fortran-unit-test-syntax/solution/test/CMakeLists.txt

Lines changed: 4 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -9,44 +9,26 @@ file(CREATE_LINK "${PROJECT_SOURCE_DIR}/test/models"
99
# Create library for src code
1010
add_library (sut STATIC ${PROJ_SRC_FILES})
1111

12-
# List all test files
13-
file(GLOB
14-
test_srcs
15-
"${PROJECT_SOURCE_DIR}/test/*.pf"
16-
)
17-
1812
# evolve_board tests
19-
set(test_evolve_board_src ${test_srcs})
20-
list(FILTER test_evolve_board_src INCLUDE REGEX ".*test_evolve_board.pf")
21-
2213
add_pfunit_ctest (pfunit_evolve_board_tests
23-
TEST_SOURCES ${test_evolve_board_src}
14+
TEST_SOURCES "${PROJECT_SOURCE_DIR}/test/test_evolve_board.pf"
2415
LINK_LIBRARIES sut # your application library
2516
)
2617

2718
# check_for_steady_state tests
28-
set(test_check_for_steady_state_src ${test_srcs})
29-
list(FILTER test_check_for_steady_state_src INCLUDE REGEX ".*test_check_for_steady_state.pf")
30-
3119
add_pfunit_ctest (pfunit_check_for_steady_state_tests
32-
TEST_SOURCES ${test_check_for_steady_state_src}
20+
TEST_SOURCES "${PROJECT_SOURCE_DIR}/test/test_check_for_steady_state.pf"
3321
LINK_LIBRARIES sut # your application library
3422
)
3523

3624
# read_model_from_file tests
37-
set(test_read_model_from_file_src ${test_srcs})
38-
list(FILTER test_read_model_from_file_src INCLUDE REGEX ".*test_read_model_from_file.pf")
39-
4025
add_pfunit_ctest (pfunit_read_model_from_file_tests
41-
TEST_SOURCES ${test_read_model_from_file_src}
26+
TEST_SOURCES "${PROJECT_SOURCE_DIR}/test/test_read_model_from_file.pf"
4227
LINK_LIBRARIES sut # your application library
4328
)
4429

4530
# find_steady_state tests
46-
set(test_find_steady_state_src ${test_srcs})
47-
list(FILTER test_find_steady_state_src INCLUDE REGEX ".*test_find_steady_state.pf")
48-
4931
add_pfunit_ctest (pfunit_find_steady_state_tests
50-
TEST_SOURCES ${test_find_steady_state_src}
32+
TEST_SOURCES "${PROJECT_SOURCE_DIR}/test/test_find_steady_state.pf"
5133
LINK_LIBRARIES sut # your application library
5234
)

episodes/4-debugging-a-broken-test/challenge/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,5 @@ project(
1111
# Define src files
1212
file(GLOB PROJ_SRC_FILES "${PROJECT_SOURCE_DIR}/src/*.f90")
1313

14+
enable_testing()
1415
add_subdirectory("test")

episodes/5-testing-parallel-code/challenge/CMakeLists.txt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,4 @@ endif()
2828
target_link_libraries("${PROJECT_NAME}" "${TO_LINK_TO_SRC}")
2929

3030
enable_testing()
31-
32-
#--------------------------------------#
33-
# pFUnit #
34-
#--------------------------------------#
3531
add_subdirectory("test")

0 commit comments

Comments
 (0)