This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake".
The branch, next has been updated via f137f00243965ee0f7312f8fcafb8b233689e199 (commit) via 568e75e2001297830f836c817b808fc6d5ac12f6 (commit) from 63b7ee1583b6ae3cdf5566b90d86454730ed61c3 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f137f00243965ee0f7312f8fcafb8b233689e199 commit f137f00243965ee0f7312f8fcafb8b233689e199 Merge: 63b7ee1 568e75e Author: Domen Vrankar <domen.vran...@gmail.com> AuthorDate: Tue Jun 9 17:26:22 2015 -0400 Commit: CMake Topic Stage <kwro...@kitware.com> CommitDate: Tue Jun 9 17:26:22 2015 -0400 Merge topic 'cpack-rpm-and-deb-runcmake-tests' into next 568e75e2 Fixup! CPack Deb and RPM RunCMake tests diff --cc Tests/RunCMake/CMakeLists.txt index 646eb71,43df312..eee7bb4 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@@ -258,5 -261,6 +261,7 @@@ endif( if("${CMAKE_GENERATOR}" MATCHES "Make|Ninja") add_executable(pseudo_iwyu pseudo_iwyu.c) add_RunCMake_test(IncludeWhatYouUse -DPSEUDO_IWYU=$<TARGET_FILE:pseudo_iwyu>) + add_RunCMake_test(CompilerLauncher) endif() + + add_RunCMake_test_group(CPack "DEB;RPM") http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=568e75e2001297830f836c817b808fc6d5ac12f6 commit 568e75e2001297830f836c817b808fc6d5ac12f6 Author: Domen Vrankar <domen.vran...@gmail.com> AuthorDate: Tue Jun 9 23:24:08 2015 +0200 Commit: Domen Vrankar <domen.vran...@gmail.com> CommitDate: Tue Jun 9 23:24:08 2015 +0200 Fixup! CPack Deb and RPM RunCMake tests CTest has less information about the environment as CMake so prerequirements such as programs should be set in CMake. Example where this was a problem is MAC OS where /sw/bin is not necessarily in path but dpkg program is detected there by CMake while CTest misses it. diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index 4a4f54f..43df312 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -27,20 +27,35 @@ macro(add_RunCMake_test test) endmacro() function(add_RunCMake_test_group test types) - set(Test_Dir ${test}) + # create directory for common content + set(BASE_TEST_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/${test}") + file(REMOVE_RECURSE "${BASE_TEST_BINARY_DIR}") + file(MAKE_DIRECTORY "${BASE_TEST_BINARY_DIR}") foreach(type IN LISTS types) - add_test(NAME RunCMake.${test}_${type} COMMAND ${CMAKE_CMAKE_COMMAND} - -DTEST_TYPE=${type} - -DCMAKE_MODULE_PATH=${CMAKE_CURRENT_SOURCE_DIR} - -DRunCMake_GENERATOR=${CMAKE_GENERATOR} - -DRunCMake_GENERATOR_PLATFORM=${CMAKE_GENERATOR_PLATFORM} - -DRunCMake_GENERATOR_TOOLSET=${CMAKE_GENERATOR_TOOLSET} - -DRunCMake_MAKE_PROGRAM=${CMake_TEST_EXPLICIT_MAKE_PROGRAM} - -DRunCMake_SOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR}/${Test_Dir} - -DRunCMake_BINARY_DIR=${CMAKE_CURRENT_BINARY_DIR}/${type}/${test} - -P "${CMAKE_CURRENT_SOURCE_DIR}/${Test_Dir}/RunCMakeTest.cmake" - ) + # generate prerequirements config file in cmake as ctest doesn't have as + # much system information so it is easier to set programs and environment + # values here + unset(${test}_${type}_FOUND_PREREQUIREMENTS) + include("${CMAKE_CURRENT_SOURCE_DIR}/${test}/${type}/Prerequirements.cmake") + get_test_prerequirements("${test}_${type}_FOUND_PREREQUIREMENTS" + "${BASE_TEST_BINARY_DIR}/${type}_config.cmake") + + # only add the test if prerequirements are met + if(${test}_${type}_FOUND_PREREQUIREMENTS) + add_test(NAME RunCMake.${test}_${type} COMMAND ${CMAKE_CMAKE_COMMAND} + -DTEST_TYPE=${type} + -DCMAKE_MODULE_PATH=${CMAKE_CURRENT_SOURCE_DIR} + -DRunCMake_GENERATOR=${CMAKE_GENERATOR} + -DRunCMake_GENERATOR_PLATFORM=${CMAKE_GENERATOR_PLATFORM} + -DRunCMake_GENERATOR_TOOLSET=${CMAKE_GENERATOR_TOOLSET} + -DRunCMake_MAKE_PROGRAM=${CMake_TEST_EXPLICIT_MAKE_PROGRAM} + -DRunCMake_SOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR}/${test} + -DRunCMake_BINARY_DIR=${CMAKE_CURRENT_BINARY_DIR}/${type}/${test} + -Dconfig_file=${BASE_TEST_BINARY_DIR}/${type}_config.cmake + -P "${CMAKE_CURRENT_SOURCE_DIR}/${test}/RunCMakeTest.cmake" + ) + endif() endforeach() endfunction() @@ -224,18 +239,6 @@ add_RunCMake_test(IfacePaths_INCLUDE_DIRECTORIES TEST_DIR IfacePaths) set(IfacePaths_SOURCES_ARGS -DTEST_PROP=SOURCES) add_RunCMake_test(IfacePaths_SOURCES TEST_DIR IfacePaths) -# CPack related tests -if(RPMBUILD_EXECUTABLE) - list(APPEND CPACK_TEST_GENERATORS "RPM") -endif() - -if(DPKG_EXECUTABLE) - list(APPEND CPACK_TEST_GENERATORS "DEB") -endif() - -add_RunCMake_test_group(CPack "${CPACK_TEST_GENERATORS}") -# end of CPack related tests - add_RunCMake_test(COMPILE_LANGUAGE-genex) # Matlab module related tests @@ -259,3 +262,5 @@ if("${CMAKE_GENERATOR}" MATCHES "Make|Ninja") add_executable(pseudo_iwyu pseudo_iwyu.c) add_RunCMake_test(IncludeWhatYouUse -DPSEUDO_IWYU=$<TARGET_FILE:pseudo_iwyu>) endif() + +add_RunCMake_test_group(CPack "DEB;RPM") diff --git a/Tests/RunCMake/CPack/CPackTestHelpers.cmake b/Tests/RunCMake/CPack/CPackTestHelpers.cmake index 395fe22..7ea2a24 100644 --- a/Tests/RunCMake/CPack/CPackTestHelpers.cmake +++ b/Tests/RunCMake/CPack/CPackTestHelpers.cmake @@ -69,6 +69,7 @@ function(run_cpack_test TEST_NAME types build) -DGENERATOR_TYPE=${TEST_TYPE} "-Dsrc_dir=${RunCMake_SOURCE_DIR}" "-Dbin_dir=${RunCMake_TEST_BINARY_DIR}" + "-Dconfig_file=${config_file}" -P "${RunCMake_SOURCE_DIR}/VerifyResult.cmake" ) endif() diff --git a/Tests/RunCMake/CPack/DEB/Helpers.cmake b/Tests/RunCMake/CPack/DEB/Helpers.cmake index f0fa932..4ed3fbd 100644 --- a/Tests/RunCMake/CPack/DEB/Helpers.cmake +++ b/Tests/RunCMake/CPack/DEB/Helpers.cmake @@ -1,12 +1,7 @@ set(ALL_FILES_GLOB "*.deb") -find_program(DEB_EXECUTABLE dpkg) -if(NOT DEB_EXECUTABLE) - message(FATAL_ERROR "error: missing dpkg executable required by the test") -endif() - function(getPackageContent FILE RESULT_VAR) - execute_process(COMMAND ${DEB_EXECUTABLE} -c ${FILE} + execute_process(COMMAND ${DPKG_EXECUTABLE} -c ${FILE} OUTPUT_VARIABLE package_content_ ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE) diff --git a/Tests/RunCMake/CPack/DEB/Prerequirements.cmake b/Tests/RunCMake/CPack/DEB/Prerequirements.cmake new file mode 100644 index 0000000..197b99d --- /dev/null +++ b/Tests/RunCMake/CPack/DEB/Prerequirements.cmake @@ -0,0 +1,8 @@ +function(get_test_prerequirements found_var config_file) + find_program(DPKG_EXECUTABLE dpkg) + + if(DPKG_EXECUTABLE) + file(WRITE "${config_file}" "set(DPKG_EXECUTABLE \"${DPKG_EXECUTABLE}\")") + set(${found_var} true PARENT_SCOPE) + endif() +endfunction() diff --git a/Tests/RunCMake/CPack/README.txt b/Tests/RunCMake/CPack/README.txt index d00f688..365c737 100644 --- a/Tests/RunCMake/CPack/README.txt +++ b/Tests/RunCMake/CPack/README.txt @@ -10,7 +10,7 @@ CPack test root directory: 'Tests/RunCMake/CPack'. All phases are executed separately for each generator that is bound to a test. Tests for each generator are subtests of test 'RunCMake.CPack_<generator_name>'. -Each test must also be added to 'RunCMakeTest.cmake' script located in Cpack +Each test must also be added to 'RunCMakeTest.cmake' script located in CPack test root directory. Line that adds a test is: run_cpack_test(<test_name> "<generator_name>") @@ -58,18 +58,18 @@ CMake script '<generator_name>/<test_name>-ExpectedFiles.cmake' is required by this step and must contain - EXPECTED_FILES_COUNT variable that contains the number of expected files that will be generated (0 or more) -- EXPECTED_FILE_<file_number_starting_with_1> that contains globbing expression - that uniquelly defines expected file name (will be used to find expected file) +- EXPECTED_FILE_<file_number_starting_with_1> that contains globing expression + that uniquely defines expected file name (will be used to find expected file) and should be present once for each expected file - EXPECTED_FILE_CONTENT_<file_number_starting_with_1> that contains regular expression of files that should be present in generated file and should be present once for each expected file -Optional verification phase is generator speciffic and is optionaly executed. +Optional verification phase is generator specific and is optionaly executed. This phase is executed if '<generator_name>/<test_name>-VerifyResult.cmake' script exists. In case that the script doesn't exist VerifyResult.cmake script automatically -prints out standard outpu and standard error from CPack execution phase that +prints out standard output and standard error from CPack execution phase that is compared with '<generator_name>/<test_name>-stdout.txt' regular expression and '<generator_name>/<test_name>-stderr.txt' regular expresson respectively. @@ -86,6 +86,14 @@ To add a new generator we must listed + RESULT_VAR that will tell the function which variable in parent scope should contain the result (list of files inside package file) +- add 'Prerequirements.cmake' script to generator directory. In this script a + function named 'get_test_prerequirements' must exist. This function should + set a variable in parent scope (name of the variable is the first parameter) + that tells if prerequirements for test execution are met (certain programs, + OS specifics, ...) and create a config file (name of the variable which + contains file name and path is provided with the second parameter) that + should contain 'set' commands for variables that will later be used in tests + (e.g. location of dpkg program for DEB packages) - add tests the same way as described above - add generator to 'add_RunCMake_test_group' function call that is located in RunCMake CMakeLists.txt file diff --git a/Tests/RunCMake/CPack/RPM/Helpers.cmake b/Tests/RunCMake/CPack/RPM/Helpers.cmake index 0e2dca9..98cdad8 100644 --- a/Tests/RunCMake/CPack/RPM/Helpers.cmake +++ b/Tests/RunCMake/CPack/RPM/Helpers.cmake @@ -1,10 +1,5 @@ set(ALL_FILES_GLOB "*.rpm") -find_program(RPM_EXECUTABLE rpm) -if(NOT RPM_EXECUTABLE) - message(FATAL_ERROR "error: missing rpm executable required by the test") -endif() - function(getPackageContent FILE RESULT_VAR) execute_process(COMMAND ${RPM_EXECUTABLE} -pql ${FILE} OUTPUT_VARIABLE package_content_ diff --git a/Tests/RunCMake/CPack/RPM/Prerequirements.cmake b/Tests/RunCMake/CPack/RPM/Prerequirements.cmake new file mode 100644 index 0000000..51b77a9 --- /dev/null +++ b/Tests/RunCMake/CPack/RPM/Prerequirements.cmake @@ -0,0 +1,8 @@ +function(get_test_prerequirements found_var config_file) + find_program(RPM_EXECUTABLE rpm) + + if(RPM_EXECUTABLE) + file(WRITE "${config_file}" "set(RPM_EXECUTABLE \"${RPM_EXECUTABLE}\")") + set(${found_var} true PARENT_SCOPE) + endif() +endfunction() diff --git a/Tests/RunCMake/CPack/VerifyResult.cmake b/Tests/RunCMake/CPack/VerifyResult.cmake index d9f32c5..0cc32d4 100644 --- a/Tests/RunCMake/CPack/VerifyResult.cmake +++ b/Tests/RunCMake/CPack/VerifyResult.cmake @@ -1,5 +1,6 @@ cmake_policy(SET CMP0007 NEW) +include("${config_file}") include("${src_dir}/${GENERATOR_TYPE}/Helpers.cmake") # check that expected generated files exist and contain expected content ----------------------------------------------------------------------- Summary of changes: Tests/RunCMake/CMakeLists.txt | 53 +++++++++++++----------- Tests/RunCMake/CPack/CPackTestHelpers.cmake | 1 + Tests/RunCMake/CPack/DEB/Helpers.cmake | 7 +--- Tests/RunCMake/CPack/DEB/Prerequirements.cmake | 8 ++++ Tests/RunCMake/CPack/README.txt | 18 +++++--- Tests/RunCMake/CPack/RPM/Helpers.cmake | 5 --- Tests/RunCMake/CPack/RPM/Prerequirements.cmake | 8 ++++ Tests/RunCMake/CPack/VerifyResult.cmake | 1 + 8 files changed, 61 insertions(+), 40 deletions(-) create mode 100644 Tests/RunCMake/CPack/DEB/Prerequirements.cmake create mode 100644 Tests/RunCMake/CPack/RPM/Prerequirements.cmake hooks/post-receive -- CMake _______________________________________________ Cmake-commits mailing list Cmake-commits@cmake.org http://public.kitware.com/mailman/listinfo/cmake-commits