-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ENH: Add infrastructure to test GenerateCLP install rules. See #44
* Introduced "GenerateCLP-Install.cmake" script that is deleting the directory associated with CMAKE_INSTALL_PREFIX, and re-installing the files building the "install" target. * Introduced variable TEST_TREETYPE set to either "BuildTree" or "InstallTree". This variable allows to conditionally update the testing context in Configure, Build or Test steps associated with each examples. * For the "BuildTree" case, GenerateCLP_DIR is hardcoded in GenerateCLPTestPrerequisites whereas it is passed as test argument for the "InstallTree" case. Co-authored-by: Nicole Aucoin <[email protected]>
- Loading branch information
Showing
4 changed files
with
101 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
|
||
# -------------------------------------------------------------------------- | ||
# Sanity checks | ||
|
||
foreach(varname TEST_CMAKE_DIR TEST_BINARY_DIR TEST_INSTALL_DIR) | ||
if(NOT DEFINED ${varname}) | ||
message(FATAL_ERROR "Variable ${varname} is not DEFINED") | ||
endif() | ||
endforeach() | ||
|
||
include(${TEST_CMAKE_DIR}/GenerateCLPTestMacros.cmake) | ||
|
||
# -------------------------------------------------------------------------- | ||
# Delete install directory if it exists | ||
execute_process( | ||
COMMAND ${CMAKE_COMMAND} -E remove_directory ${TEST_INSTALL_DIR} | ||
) | ||
|
||
# -------------------------------------------------------------------------- | ||
# Create install directory | ||
execute_process( | ||
COMMAND ${CMAKE_COMMAND} -E make_directory ${TEST_INSTALL_DIR} | ||
) | ||
|
||
# -------------------------------------------------------------------------- | ||
# Debug flags - Set to True to display the command as string | ||
set(PRINT_COMMAND 0) | ||
|
||
# -------------------------------------------------------------------------- | ||
# Install | ||
set(install_target install) | ||
if(WIN32) | ||
set(install_target INSTALL) | ||
endif() | ||
set(command ${CMAKE_COMMAND} --build ${TEST_BINARY_DIR} --config Release --target ${install_target}) | ||
execute_process( | ||
COMMAND ${command} | ||
WORKING_DIRECTORY ${TEST_BINARY_DIR} | ||
OUTPUT_VARIABLE ov | ||
RESULT_VARIABLE rv | ||
) | ||
|
||
print_command_as_string("${command}") | ||
|
||
if(rv) | ||
message(FATAL_ERROR "Failed to install Test:\n${ov}") | ||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters