CPack Default component test for ZIP should be OK
This commit is contained in:
parent
88b7f4252c
commit
dd2a5aa69f
|
@ -540,8 +540,9 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
|
|||
|
||||
set(CPackRun_CPackGen "-DCPackGen=ZIP")
|
||||
set(CPackRun_CPackCommand "-DCPackCommand=${CMAKE_CPACK_COMMAND}")
|
||||
set(CPackRun_CPackComponentWay "-DCPackComponentWay=default")
|
||||
|
||||
ADD_TEST(CPackComponentsForAll-ZIP-NoComponent ${CMAKE_CTEST_COMMAND}
|
||||
ADD_TEST(CPackComponentsForAll-ZIP-default ${CMAKE_CTEST_COMMAND}
|
||||
--build-and-test
|
||||
"${CMake_SOURCE_DIR}/Tests/CPackComponentsForAll"
|
||||
"${CMake_BINARY_DIR}/Tests/CPackComponentsForAll/buildZIP-NoComponent"
|
||||
|
@ -556,6 +557,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
|
|||
"-DCPackComponentsForAll_BINARY_DIR:PATH=${CMake_BINARY_DIR}/Tests/CPackComponentsForAll/buildZIP-NoComponent"
|
||||
"${CPackRun_CPackCommand}"
|
||||
"${CPackRun_CPackGen}"
|
||||
"${CPackRun_CPackComponentWay}"
|
||||
-P "${CMake_SOURCE_DIR}/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake")
|
||||
|
||||
LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/CPackComponentsForAll")
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
# Depending on the CPack generator and on some CPACK_xxx var values
|
||||
# the generator may produce a single (NSIS, PackageMaker)
|
||||
# or several package files (Archive Generators, RPM, DEB)
|
||||
cmake_minimum_required(VERSION 2.8.3 FATAL_ERROR)
|
||||
cmake_minimum_required(VERSION 2.8.3.20101130 FATAL_ERROR)
|
||||
project(CPackComponentsForAll)
|
||||
|
||||
# Create the mylib library
|
||||
|
|
|
@ -13,7 +13,14 @@ endif(NOT CPackGen)
|
|||
if(NOT CPackCommand)
|
||||
message(FATAL_ERROR "CPackCommand not set")
|
||||
endif(NOT CPackCommand)
|
||||
|
||||
if(NOT CPackComponentWay)
|
||||
message(FATAL_ERROR "CPackComponentWay not set")
|
||||
endif(NOT CPackComponentWay)
|
||||
|
||||
set(expected_file_mask "")
|
||||
# The usual default behavior is to expect a single file
|
||||
set(expected_count 1)
|
||||
|
||||
execute_process(COMMAND ${CPackCommand} -G ${CPackGen}
|
||||
RESULT_VARIABLE result
|
||||
|
@ -23,10 +30,14 @@ execute_process(COMMAND ${CPackCommand} -G ${CPackGen}
|
|||
|
||||
if(CPackGen MATCHES "ZIP")
|
||||
set(expected_file_mask "${CPackComponentsForAll_BINARY_DIR}/MyLib-*.zip")
|
||||
set(expected_count 2)
|
||||
if (${CPackComponentWay} STREQUAL "default")
|
||||
set(expected_count 1)
|
||||
endif(${CPackComponentWay} STREQUAL "default")
|
||||
endif(CPackGen MATCHES "ZIP")
|
||||
|
||||
|
||||
# Now verify if the number of expected file is OK
|
||||
# - using expected_file_mask and
|
||||
# - expected_count
|
||||
if(expected_file_mask)
|
||||
file(GLOB expected_file "${expected_file_mask}")
|
||||
|
||||
|
@ -35,12 +46,12 @@ if(expected_file_mask)
|
|||
message(STATUS "expected_file_mask='${expected_file_mask}'")
|
||||
|
||||
if(NOT expected_file)
|
||||
message(FATAL_ERROR "error: expected_file does not exist: CPackComponentsForAll test fails.")
|
||||
message(FATAL_ERROR "error: expected_file=${expected_file} does not exist: CPackComponentsForAll test fails.")
|
||||
endif(NOT expected_file)
|
||||
|
||||
list(LENGTH expected_file actual_count)
|
||||
message(STATUS "actual_count='${actual_count}'")
|
||||
if(NOT actual_count EQUAL expected_count)
|
||||
message(FATAL_ERROR "error: expected_count does not match actual_count: CPackComponents test fails.")
|
||||
message(FATAL_ERROR "error: expected_count=${expected_count} does not match actual_count=${actual_count}: CPackComponents test fails.")
|
||||
endif(NOT actual_count EQUAL expected_count)
|
||||
endif(expected_file_mask)
|
||||
|
|
Loading…
Reference in New Issue