Skip to content
This repository was archived by the owner on Jul 8, 2022. It is now read-only.

Commit 293a6d4

Browse files
committed
CXX Tests: Fix the success check of the test generation
The variable FAILED is never defined, therefore the if condition was never met. We now check for the existence of the generated file which and then output the result of the command.
1 parent 5a9d0bf commit 293a6d4

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

cpp_test_suite/cxxtest/CMakeLists.txt

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,16 @@ endif()
77

88
macro(CXX_GENERATE_TEST name)
99
message("Generate ${name}.cpp")
10+
set(GENERATED_FILE "${CMAKE_CURRENT_SOURCE_DIR}/${name}.cpp")
1011
execute_process(COMMAND "${PYTHON_INTERPRETER}" cxxtestgen.py
1112
--template=${CMAKE_CURRENT_SOURCE_DIR}/template/tango_template.tpl
12-
-o ${CMAKE_CURRENT_SOURCE_DIR}/${name}.cpp
13+
-o ${GENERATED_FILE}
1314
../../new_tests/${name}.cpp
14-
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/bin)
15+
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/bin
16+
RESULT_VARIABLE GENERATOR_OUTPUT)
1517

16-
if(${FAILED})
17-
message(SEND_ERROR " Failed to generate ${name}.cpp. rv=${FAILED}")
18+
if(NOT EXISTS ${GENERATED_FILE})
19+
message(SEND_ERROR " Failed to generate ${name}.cpp due to \"${GENERATOR_OUTPUT}\".")
1820
endif()
1921

2022
add_executable(${name} $<TARGET_OBJECTS:compare_test_object> ${name}.cpp)

0 commit comments

Comments
 (0)