Skip to content

Commit 2decf3f

Browse files
revert
1 parent c86f604 commit 2decf3f

File tree

1 file changed

+20
-13
lines changed

1 file changed

+20
-13
lines changed

code/tests/CMakeLists.txt

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,31 @@
1-
if (WITH_TEST)
1+
# code/tests/CMakeLists.txt
2+
3+
option(WITH_TEST "Enable testing" OFF)
4+
5+
if(WITH_TEST)
6+
find_package(Python3 REQUIRED)
7+
8+
# Run the Python script to generate the runner
29
execute_process(
3-
COMMAND python3 ${CMAKE_SOURCE_DIR}/tools/generate-runner.py
4-
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
5-
RESULT_VARIABLE RUNNER_GENERATION_RESULT
10+
COMMAND Python3_EXECUTABLE ${CMAKE_SOURCE_DIR}/tools/generate-runner.py
11+
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
12+
RESULT_VARIABLE RUNNER_GEN_RESULT
613
)
7-
if(NOT RUNNER_GENERATION_RESULT EQUAL 0)
8-
message(FATAL_ERROR "Failed to generate runner")
14+
if(NOT RUNNER_GEN_RESULT EQUAL 0)
15+
message(FATAL_ERROR "Failed to generate test runner")
916
endif()
1017

11-
set(TEST_C unit_runner.c)
18+
set(TEST_C "unit_runner.c")
1219
set(TEST_CASES sample bdd tdd ddd mark mock)
1320

14-
foreach(CASE IN LISTS TEST_CASES)
15-
list(APPEND TEST_C cases/test_${CASE}.c)
16-
list(APPEND TEST_C cases/test_${CASE}.cpp)
21+
foreach(CASE ${TEST_CASES})
22+
list(APPEND TEST_C "cases/test_${CASE}.c")
23+
list(APPEND TEST_C "cases/test_${CASE}.cpp")
1724
endforeach()
1825

1926
add_executable(testbed-c ${TEST_C})
20-
target_include_directories(testbed-c PRIVATE ${DIR})
27+
target_include_directories(testbed-c PRIVATE ${CMAKE_SOURCE_DIR}/include)
2128
target_link_libraries(testbed-c PRIVATE fossil_test_dep)
2229

23-
add_test(NAME "fossil testing C" COMMAND testbed-c)
24-
endif()
30+
add_test(NAME "fossil_testing_C" COMMAND testbed-c)
31+
endif()

0 commit comments

Comments
 (0)