Merge topic 'cpack-tests-fix'
1b13af46 Tests: Fix RunCMake.CPack_* tests to use proper CMake generator 981068b7 Tests: Avoid OS X 10.5 limitation warning in RunCMake.CPack* tests e8954d0b Tests: Add trailing newlines to generated sources in RunCMake.CPack_* tests
This commit is contained in:
commit
8deb0835e6
@ -10,47 +10,12 @@ function(run_cpack_test TEST_NAME types build)
|
||||
file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}")
|
||||
|
||||
# execute cmake
|
||||
execute_process(
|
||||
COMMAND "${CMAKE_COMMAND}" -DRunCMake_TEST=${TEST_NAME}
|
||||
-DGENERATOR_TYPE=${TEST_TYPE} "${RunCMake_SOURCE_DIR}"
|
||||
WORKING_DIRECTORY "${RunCMake_TEST_BINARY_DIR}"
|
||||
RESULT_VARIABLE res
|
||||
OUTPUT_FILE "${RunCMake_TEST_BINARY_DIR}/test_output.txt"
|
||||
ERROR_FILE "${RunCMake_TEST_BINARY_DIR}/test_error.txt"
|
||||
)
|
||||
|
||||
if(res)
|
||||
run_cmake_command(
|
||||
${TEST_TYPE}/${TEST_NAME}
|
||||
"${CMAKE_COMMAND}"
|
||||
-DRunCMake_TEST_STEP=configure
|
||||
-Dreturn_code=${res}
|
||||
"-Dbin_dir=${RunCMake_TEST_BINARY_DIR}"
|
||||
-P "${RunCMake_SOURCE_DIR}/PreTestError.cmake"
|
||||
)
|
||||
return()
|
||||
endif()
|
||||
set(RunCMake_TEST_OPTIONS "-DGENERATOR_TYPE=${TEST_TYPE}")
|
||||
run_cmake(${TEST_NAME})
|
||||
|
||||
# execute optional build step
|
||||
if(build)
|
||||
execute_process(
|
||||
COMMAND "${CMAKE_COMMAND}" --build "${RunCMake_TEST_BINARY_DIR}"
|
||||
RESULT_VARIABLE res
|
||||
OUTPUT_FILE "${RunCMake_TEST_BINARY_DIR}/test_output.txt"
|
||||
ERROR_FILE "${RunCMake_TEST_BINARY_DIR}/test_error.txt"
|
||||
)
|
||||
endif()
|
||||
|
||||
if(res)
|
||||
run_cmake_command(
|
||||
${TEST_TYPE}/${TEST_NAME}
|
||||
"${CMAKE_COMMAND}"
|
||||
-DRunCMake_TEST_STEP=build
|
||||
-Dreturn_code=${res}
|
||||
"-Dbin_dir=${RunCMake_TEST_BINARY_DIR}"
|
||||
-P "${RunCMake_SOURCE_DIR}/PreTestError.cmake"
|
||||
)
|
||||
return()
|
||||
run_cmake_command(${TEST_NAME}-Build "${CMAKE_COMMAND}" --build "${RunCMake_TEST_BINARY_DIR}")
|
||||
endif()
|
||||
|
||||
# execute cpack
|
||||
|
@ -1,11 +1,13 @@
|
||||
set(CMAKE_BUILD_WITH_INSTALL_RPATH 1)
|
||||
|
||||
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/test_lib.hpp"
|
||||
"int test_lib();")
|
||||
"int test_lib();\n")
|
||||
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/test_lib.cpp"
|
||||
"#include \"test_lib.hpp\"\nint test_lib() {return 0;}")
|
||||
"#include \"test_lib.hpp\"\nint test_lib() {return 0;}\n")
|
||||
add_library(test_lib SHARED "${CMAKE_CURRENT_BINARY_DIR}/test_lib.cpp")
|
||||
|
||||
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/main.cpp"
|
||||
"#include \"test_lib.hpp\"\nint main() {return test_lib();}")
|
||||
"#include \"test_lib.hpp\"\nint main() {return test_lib();}\n")
|
||||
add_executable(test_prog "${CMAKE_CURRENT_BINARY_DIR}/main.cpp")
|
||||
target_link_libraries(test_prog test_lib)
|
||||
|
||||
|
@ -1,7 +0,0 @@
|
||||
file(READ "${bin_dir}/test_output.txt" output)
|
||||
file(READ "${bin_dir}/test_error.txt" error)
|
||||
|
||||
message(FATAL_ERROR "Error in pre-test phase '${RunCMake_TEST_STEP}'!\n"
|
||||
"Return code: '${return_code}'\n"
|
||||
"Info output: '${output}'\n"
|
||||
"Error output: '${error}'")
|
Loading…
x
Reference in New Issue
Block a user