Skip to content

Commit 781fcfe

Browse files
committed
BUG: ExtensionBuildSystem: Fix issue preventing build of dependent extensions
To prevent extension test displaying string "ERROR:" from being considered as build failure and causing the overall build of all extensions to fail, this commit updates the execution of the build wrapper script to ensure its standard output and error streams are logged to file. Note that this was only observed when using Visual Studio generator on Windows because in that case, there are no CTest launcher. See https://cmake.org/cmake/help/latest/module/CTestUseLaunchers.html This commit also improves the extension build system tests to avoid future regressions. It is a follow up of r26223 (BUG: Extension build system: Sandbox download step and report download error) Fix https://issues.slicer.org/view.php?id=4247 git-svn-id: http://svn.slicer.org/Slicer4/trunk@27944 3bd1e089-480b-0410-8dfb-8563597acbee
1 parent 6b0faf9 commit 781fcfe

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

Extensions/CMake/SlicerBlockBuildPackageAndUploadExtensions.cmake

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,14 +233,20 @@ foreach(EXTENSION_NAME ${EXTENSION_LIST})
233233
#
234234
set(build_extension_wrapper_script
235235
${CMAKE_CURRENT_BINARY_DIR}/build_${proj}_wrapper_script.cmake)
236+
set(build_output_file "${CMAKE_CURRENT_BINARY_DIR}/build_${proj}output.txt")
237+
set(build_error_file "${CMAKE_CURRENT_BINARY_DIR}/build_${proj}_error.txt")
236238
#message(STATUS "Configuring extension upload wrapper script: ${build_extension_wrapper_script}")
237239
file(WRITE ${build_extension_wrapper_script} "
238240
execute_process(
239241
COMMAND ${wrapper_command}
240242
WORKING_DIR \"${EXTENSION_SUPERBUILD_BINARY_DIR}\"
243+
OUTPUT_FILE \"${build_output_file}\"
244+
ERROR_FILE \"${build_error_file}\"
241245
RESULT_VARIABLE result
242246
)
243247
message(STATUS \"build_${proj}_wrapper_script: Ignoring result \${result}\")
248+
message(STATUS \"build_${proj}_output_file: ${build_output_file}\")
249+
message(STATUS \"build_${proj}_error_file: ${build_error_file}\")
244250
")
245251

246252
# Add extension external project

Extensions/CMake/Testing/SlicerExtensionBuildSystemTest.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -286,8 +286,18 @@ def _prepare_test_binary_dir(self, test_binary_dir):
286286
# dependers of ExtensionsA can still configure/build/test without
287287
# any issues. See #4247
288288
module_dir = extension_dir + '/Mod%s' % suffix
289-
with open(module_dir + '/Testing/Python/CMakeLists.txt', 'a') as content:
290-
content.write("add_test(NAME FailingTest COMMAND invalid_test)")
289+
module_cmakelists = module_dir + '/Testing/Python/CMakeLists.txt'
290+
with open(module_cmakelists, 'a') as content:
291+
content.write("add_test(NAME FailingTest COMMAND invalid_test)\n")
292+
293+
display_error_script = module_dir + '/Testing/Python/slicerDisplayErrors.cmake'
294+
with open(display_error_script, 'w') as content:
295+
content.write(textwrap.dedent("""
296+
message("ERROR: In /path/to/Slicer/qSlicerCoreApplication.cxx, line 212
297+
vtkObject (0x25f2b30): This is an an error message from VTK")
298+
"""))
299+
with open(module_cmakelists, 'a') as content:
300+
content.write("add_test(NAME TestDisplayingError COMMAND ${CMAKE_COMMAND} -P \"%s\")\n" % display_error_script)
291301

292302
if suffix == 'B':
293303
project = ExtensionProject(extension_dir)

0 commit comments

Comments
 (0)