Permalink
Browse files

BUG: Extension build system: Ignore extension CTest return code. Fixe…

…s #4247

This commit ensures each "EXTENSION_UPLOAD_COMMAND" responsible to configure,
build, test and package any given extension is completely "sandboxed" by
using a wrapper script.

This is required because simply setting the RETURN_VALUE parameter
to the ctest_test() command is not enough to avoid the script from
exiting with error code.

#
# The following wrapper script is required to workaround issue #4247
# and avoid the all extension build from failing if a test of
# extension fail.
#
# Note that as soon as CMake >= 3.6.7 is released, it should be possible
# to remove the wrapper script and simply specify CAPTURE_CMAKE_ERROR
# ctest_test option.
#
# See https://cmake.org/cmake/help/v3.7/command/ctest_test.html
#

Tested-by: Isaiah Norton <inorton@bwh.harvard.edu>
Tested-by: Johan Andruejol <johan.andruejol@kitware.com>
Tested-by: Nicole Aucoin <nicole@bwh.harvard.edu>
Tested-by: Steve Pieper <pieper@isomics.com>

Reported-by: Csaba Pinter <csaba.pinter@queensu.ca>
Reported-by: Andras Lasso <lasso@cs.queensu.ca>

Thanks: All of the above

git-svn-id: http://svn.slicer.org/Slicer4/trunk@25439 3bd1e089-480b-0410-8dfb-8563597acbee
  • Loading branch information...
jcfr committed Oct 13, 2016
1 parent 2e4ea62 commit c226f731bc6696bbbd92a268a0d3bdf265c8281f
Showing with 28 additions and 2 deletions.
  1. +28 −2 Extensions/CMake/SlicerBlockBuildPackageAndUploadExtensions.cmake
@@ -172,14 +172,40 @@ foreach(EXTENSION_NAME ${EXTENSION_LIST})
set(CTEST_MODEL "Experimental")
endif()
include(SlicerBlockUploadExtension)
# Add extension external project

set(proj ${EXTENSION_NAME})

set(upload_extension_wrapper_script
${CMAKE_CURRENT_BINARY_DIR}/upload_${proj}_wrapper_script.cmake)

#
# The following wrapper script is required to workaround issue #4247
# and avoid the overall extension build from failing if only one test
# of an extension being depended on fails.
#
# Note that as soon as CMake >= 3.6.7 is released, it should be possible
# to remove the wrapper script and simply specify CAPTURE_CMAKE_ERROR
# ctest_test option.
#
# See https://cmake.org/cmake/help/v3.7/command/ctest_test.html
#
message(STATUS "Configuring extension upload wrapper script: ${upload_extension_wrapper_script}")
file(WRITE ${upload_extension_wrapper_script} "
execute_process(
COMMAND ${EXTENSION_UPLOAD_COMMAND}
WORKING_DIR \"${EXTENSION_SUPERBUILD_BINARY_DIR}\"
RESULT_VARIABLE result
)
message(STATUS \"upload_${proj}_wrapper_script: Ignoring result \${result}\")
")

# Add extension external project
ExternalProject_Add(${proj}
${ext_ep_options_repository}
SOURCE_DIR ${EXTENSION_SOURCE_DIR}
BINARY_DIR ${EXTENSION_SUPERBUILD_BINARY_DIR}
CONFIGURE_COMMAND ""
BUILD_COMMAND ${EXTENSION_UPLOAD_COMMAND}
BUILD_COMMAND ${CMAKE_COMMAND} -P ${upload_extension_wrapper_script}
INSTALL_COMMAND ""
${EP_ARG_EXTENSION_DEPENDS}
)

0 comments on commit c226f73

Please sign in to comment.