summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
Diffstat (limited to 'Tests')
-rw-r--r--Tests/CMakeLists.txt56
-rw-r--r--Tests/CMakeTests/StringTest.cmake.in2
-rw-r--r--Tests/CMakeTests/StringTestScript.cmake77
-rw-r--r--Tests/CPackComponentsForAll/CMakeLists.txt12
-rw-r--r--Tests/CPackComponentsForAll/MyLibCPackConfig-AllGroupsInOne.cmake.in18
-rw-r--r--Tests/CPackComponentsForAll/MyLibCPackConfig-AllInOne.cmake.in18
-rw-r--r--Tests/CPackComponentsForAll/MyLibCPackConfig-IgnoreGroup.cmake.in18
-rw-r--r--Tests/CPackComponentsForAll/MyLibCPackConfig-OnePackPerGroup.cmake.in18
-rw-r--r--Tests/CPackComponentsForAll/MyLibCPackConfig.cmake.in7
-rw-r--r--Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake12
10 files changed, 201 insertions, 37 deletions
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt
index cbca02d..2c11919 100644
--- a/Tests/CMakeLists.txt
+++ b/Tests/CMakeLists.txt
@@ -563,30 +563,40 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
IF(CTEST_RUN_CPackComponentsForAll)
set(CPackComponentsForAll_EXTRA_OPTIONS)
-
- set(CPackRun_CPackGen "-DCPackGen=ZIP")
set(CPackRun_CPackCommand "-DCPackCommand=${CMAKE_CPACK_COMMAND}")
- set(CPackRun_CPackComponentWay "-DCPackComponentWay=default")
-
- ADD_TEST(CPackComponentsForAll-ZIP-default ${CMAKE_CTEST_COMMAND}
- --build-and-test
- "${CMake_SOURCE_DIR}/Tests/CPackComponentsForAll"
- "${CMake_BINARY_DIR}/Tests/CPackComponentsForAll/buildZIP-NoComponent"
- --build-generator ${CMAKE_TEST_GENERATOR}
- --build-project CPackComponentsForAll
- --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
- --build-options
- -DCPACK_BINARY_ZIP:BOOL=ON
- ${CPackComponentsForAll_EXTRA_OPTIONS}
- --graphviz=CPackComponentsForAll.dot
- --test-command ${CMAKE_CMAKE_COMMAND}
- "-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")
+ # set up list of CPack generators
+ list(APPEND GENLST "ZIP")
+ # set up list of component packaging ways
+ list(APPEND CWAYLST "default")
+ list(APPEND CWAYLST "OnePackPerGroup")
+ list(APPEND CWAYLST "IgnoreGroup")
+ list(APPEND CWAYLST "AllInOne")
+ list(APPEND CWAYLST "AllGroupsInOne")
+ foreach(CPackGen ${GENLST})
+ set(CPackRun_CPackGen "-DCPackGen=${CPackGen}")
+ foreach(CPackComponentWay ${CWAYLST})
+ set(CPackRun_CPackComponentWay "-DCPackComponentWay=${CPackComponentWay}")
+ ADD_TEST(CPackComponentsForAll-${CPackGen}-${CPackComponentWay} ${CMAKE_CTEST_COMMAND}
+ --build-and-test
+ "${CMake_SOURCE_DIR}/Tests/CPackComponentsForAll"
+ "${CMake_BINARY_DIR}/Tests/CPackComponentsForAll/build${CPackGen}-${CPackComponentWay}"
+ --build-generator ${CMAKE_TEST_GENERATOR}
+ --build-project CPackComponentsForAll
+ --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
+ --build-options
+ -DCPACK_BINARY_${CPackGen}:BOOL=ON
+ ${CPackRun_CPackComponentWay}
+ ${CPackComponentsForAll_EXTRA_OPTIONS}
+ --graphviz=CPackComponentsForAll.dot
+ --test-command ${CMAKE_CMAKE_COMMAND}
+ "-DCPackComponentsForAll_BINARY_DIR:PATH=${CMake_BINARY_DIR}/Tests/CPackComponentsForAll/build${CPackGen}-${CPackComponentWay}"
+ "${CPackRun_CPackCommand}"
+ "${CPackRun_CPackGen}"
+ "${CPackRun_CPackComponentWay}"
+ -P "${CMake_SOURCE_DIR}/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake")
+ LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/CPackComponentsForAll/build${CPackGen}-${CPackComponentWay}")
+ endforeach(CPackComponentWay)
+ endforeach(CPackGen)
ENDIF(CTEST_RUN_CPackComponentsForAll)
# By default, turn this test off (because it takes a long time...)
diff --git a/Tests/CMakeTests/StringTest.cmake.in b/Tests/CMakeTests/StringTest.cmake.in
index 54fee7f..6bb60f4 100644
--- a/Tests/CMakeTests/StringTest.cmake.in
+++ b/Tests/CMakeTests/StringTest.cmake.in
@@ -1,7 +1,7 @@
# Execute each test listed in StringTestScript.cmake:
#
set(scriptname "@CMAKE_CURRENT_SOURCE_DIR@/StringTestScript.cmake")
-set(number_of_tests_expected 52)
+set(number_of_tests_expected 69)
include("@CMAKE_CURRENT_SOURCE_DIR@/ExecuteScriptTests.cmake")
execute_all_script_tests(${scriptname} number_of_tests_executed)
diff --git a/Tests/CMakeTests/StringTestScript.cmake b/Tests/CMakeTests/StringTestScript.cmake
index d1db2ee..7a264a0 100644
--- a/Tests/CMakeTests/StringTestScript.cmake
+++ b/Tests/CMakeTests/StringTestScript.cmake
@@ -196,6 +196,83 @@ elseif(testname STREQUAL random_with_various_alphabets) # pass
message(STATUS "CMAKE_SCRIPT_MODE_FILE='${CMAKE_SCRIPT_MODE_FILE}'")
+elseif(testname STREQUAL string_find_with_no_parameter) # fail
+ string(FIND)
+
+elseif(testname STREQUAL string_find_with_one_parameter) # fail
+ string(FIND "CMake is great.")
+
+elseif(testname STREQUAL string_find_with_two_parameters) # fail
+ string(FIND "CMake is great." "a")
+
+elseif(testname STREQUAL string_find_with_three_parameters) # pass
+ string(FIND "CMake is great." "a" v)
+ message(STATUS "v='${v}'")
+
+elseif(testname STREQUAL string_find_with_four_parameters) # fail
+ string(FIND "CMake is great." "a" v v2)
+
+elseif(testname STREQUAL string_find_reverse_with_no_parameter) # fail
+ string(FIND REVERSE)
+
+elseif(testname STREQUAL string_find_reverse_with_one_parameter) # fail
+ string(FIND "CMake is great." REVERSE)
+
+elseif(testname STREQUAL string_find_reverse_with_two_parameters) # fail
+ string(FIND "CMake is great." "a" REVERSE)
+
+elseif(testname STREQUAL string_find_reverse_with_three_parameters) # pass
+ string(FIND "CMake is great." "a" v REVERSE)
+ message(STATUS "v='${v}'")
+
+elseif(testname STREQUAL string_find_reverse_with_four_parameters_part1) # fail
+ string(FIND "CMake is great." "a" v v2 REVERSE)
+
+elseif(testname STREQUAL string_find_reverse_with_four_parameters_part2) # fail
+ string(FIND "CMake is great." "a" v REVERSE v2)
+
+elseif(testname STREQUAL string_find_with_no_possible_result) # pass
+ string(FIND "CMake is a great application." "z" v)
+ message(STATUS "v='${v}'")
+ if(NOT(-1 EQUAL ${v}))
+ message(SEND_ERROR "FIND sub-command should return -1 but returned ${v}.")
+ endif(NOT(-1 EQUAL ${v}))
+
+elseif(testname STREQUAL string_find_reverse_with_no_possible_result) # pass
+ string(FIND "CMake is a great application." "z" v REVERSE)
+ message(STATUS "v='${v}'")
+ if(NOT(-1 EQUAL ${v}))
+ message(SEND_ERROR "FIND REVERSE sub-command should return -1 but returned ${v}.")
+ endif(NOT(-1 EQUAL ${v}))
+
+elseif(testname STREQUAL string_find_with_required_result) # pass
+ string(FIND "CMake is a great application." "g" v)
+ message(STATUS "v='${v}'")
+ if(NOT(11 EQUAL ${v}))
+ message(SEND_ERROR "FIND sub-command should return 11 but returned ${v}.")
+ endif(NOT(11 EQUAL ${v}))
+
+elseif(testname STREQUAL string_find_reverse_with_required_result) # pass
+ string(FIND "CMake is a great application." "e" v REVERSE)
+ message(STATUS "v='${v}'")
+ if(NOT(13 EQUAL ${v}))
+ message(SEND_ERROR "FIND REVERSE sub-command should return 13 but returned ${v}.")
+ endif(NOT(13 EQUAL ${v}))
+
+elseif(testname STREQUAL string_find_word_reverse_with_required_result) # pass
+ string(FIND "The command should find REVERSE in this string. Or maybe this REVERSE?!" "REVERSE" v)
+ message(STATUS "v='${v}'")
+ if(NOT(24 EQUAL ${v}))
+ message(SEND_ERROR "FIND sub-command should return 24 but returned ${v}.")
+ endif(NOT(24 EQUAL ${v}))
+
+elseif(testname STREQUAL string_find_reverse_word_reverse_with_required_result) # pass
+ string(FIND "The command should find REVERSE in this string. Or maybe this REVERSE?!" "REVERSE" v REVERSE)
+ message(STATUS "v='${v}'")
+ if(NOT(62 EQUAL ${v}))
+ message(SEND_ERROR "FIND sub-command should return 62 but returned ${v}.")
+ endif(NOT(62 EQUAL ${v}))
+
else() # fail
message(FATAL_ERROR "testname='${testname}' - error: no such test in '${CMAKE_CURRENT_LIST_FILE}'")
diff --git a/Tests/CPackComponentsForAll/CMakeLists.txt b/Tests/CPackComponentsForAll/CMakeLists.txt
index 971b2dc..bcec509 100644
--- a/Tests/CPackComponentsForAll/CMakeLists.txt
+++ b/Tests/CPackComponentsForAll/CMakeLists.txt
@@ -107,14 +107,14 @@ set(CPACK_COMPONENT_HEADERS_INSTALL_TYPES Developer Full)
set(CPACK_COMPONENT_APPLICATIONS_INSTALL_TYPES Full)
# We may use the CPack specific config file in order
-# to tailor CPack behavio on a CPack generator specific way
+# to tailor CPack behavior on a CPack generator specific way
# (Behavior would be different for RPM or TGZ or DEB ...)
-if (USE_CPACK_PROJECT_CONFIG)
+if (NOT ("${CPackComponentWay}" STREQUAL "default"))
# Setup project specific CPack-time CPack Config file.
- configure_file(${MyLib_SOURCE_DIR}/MyLibCPackConfig.cmake.in
- ${MyLib_BINARY_DIR}/MyLibCPackConfig.cmake
+ configure_file(${CPackComponentsForAll_SOURCE_DIR}/MyLibCPackConfig-${CPackComponentWay}.cmake.in
+ ${CPackComponentsForAll_BINARY_DIR}/MyLibCPackConfig-${CPackComponentWay}.cmake
@ONLY)
- set(CPACK_PROJECT_CONFIG_FILE ${MyLib_BINARY_DIR}/MyLibCPackConfig.cmake)
-endif (USE_CPACK_PROJECT_CONFIG)
+ set(CPACK_PROJECT_CONFIG_FILE ${CPackComponentsForAll_BINARY_DIR}/MyLibCPackConfig-${CPackComponentWay}.cmake)
+endif (NOT ("${CPackComponentWay}" STREQUAL "default"))
# Include CPack to introduce the appropriate targets
include(CPack) \ No newline at end of file
diff --git a/Tests/CPackComponentsForAll/MyLibCPackConfig-AllGroupsInOne.cmake.in b/Tests/CPackComponentsForAll/MyLibCPackConfig-AllGroupsInOne.cmake.in
new file mode 100644
index 0000000..3a7119e
--- /dev/null
+++ b/Tests/CPackComponentsForAll/MyLibCPackConfig-AllGroupsInOne.cmake.in
@@ -0,0 +1,18 @@
+#
+# Activate component packaging
+#
+if(CPACK_GENERATOR MATCHES "ZIP")
+ set(CPACK_ARCHIVE_COMPONENT_INSTALL "ON")
+endif(CPACK_GENERATOR MATCHES "ZIP")
+
+if(CPACK_GENERATOR MATCHES "RPM")
+ set(CPACK_RPM_COMPONENT_INSTALL "ON")
+endif(CPACK_GENERATOR MATCHES "RPM")
+
+#
+# Choose grouping way
+#
+set(CPACK_COMPONENTS_ALL_GROUPS_IN_ONE_PACKAGE 1)
+#set(CPACK_COMPONENTS_GROUPING)
+#set(CPACK_COMPONENTS_IGNORE_GROUPS 1)
+#set(CPACK_COMPONENTS_ALL_IN_ONE_PACKAGE 1)
diff --git a/Tests/CPackComponentsForAll/MyLibCPackConfig-AllInOne.cmake.in b/Tests/CPackComponentsForAll/MyLibCPackConfig-AllInOne.cmake.in
new file mode 100644
index 0000000..9a40293
--- /dev/null
+++ b/Tests/CPackComponentsForAll/MyLibCPackConfig-AllInOne.cmake.in
@@ -0,0 +1,18 @@
+#
+# Activate component packaging
+#
+if(CPACK_GENERATOR MATCHES "ZIP")
+ set(CPACK_ARCHIVE_COMPONENT_INSTALL "ON")
+endif(CPACK_GENERATOR MATCHES "ZIP")
+
+if(CPACK_GENERATOR MATCHES "RPM")
+ set(CPACK_RPM_COMPONENT_INSTALL "ON")
+endif(CPACK_GENERATOR MATCHES "RPM")
+
+#
+# Choose grouping way
+#
+#set(CPACK_COMPONENTS_ALL_GROUPS_IN_ONE_PACKAGE 1)
+#set(CPACK_COMPONENTS_GROUPING)
+#set(CPACK_COMPONENTS_IGNORE_GROUPS 1)
+set(CPACK_COMPONENTS_ALL_IN_ONE_PACKAGE 1)
diff --git a/Tests/CPackComponentsForAll/MyLibCPackConfig-IgnoreGroup.cmake.in b/Tests/CPackComponentsForAll/MyLibCPackConfig-IgnoreGroup.cmake.in
new file mode 100644
index 0000000..92a97a5
--- /dev/null
+++ b/Tests/CPackComponentsForAll/MyLibCPackConfig-IgnoreGroup.cmake.in
@@ -0,0 +1,18 @@
+#
+# Activate component packaging
+#
+if(CPACK_GENERATOR MATCHES "ZIP")
+ set(CPACK_ARCHIVE_COMPONENT_INSTALL "ON")
+endif(CPACK_GENERATOR MATCHES "ZIP")
+
+if(CPACK_GENERATOR MATCHES "RPM")
+ set(CPACK_RPM_COMPONENT_INSTALL "ON")
+endif(CPACK_GENERATOR MATCHES "RPM")
+
+#
+# Choose grouping way
+#
+#set(CPACK_COMPONENTS_ALL_GROUPS_IN_ONE_PACKAGE)
+#set(CPACK_COMPONENTS_GROUPING)
+set(CPACK_COMPONENTS_IGNORE_GROUPS 1)
+#set(CPACK_COMPONENTS_ALL_IN_ONE_PACKAGE 1) \ No newline at end of file
diff --git a/Tests/CPackComponentsForAll/MyLibCPackConfig-OnePackPerGroup.cmake.in b/Tests/CPackComponentsForAll/MyLibCPackConfig-OnePackPerGroup.cmake.in
new file mode 100644
index 0000000..4180891
--- /dev/null
+++ b/Tests/CPackComponentsForAll/MyLibCPackConfig-OnePackPerGroup.cmake.in
@@ -0,0 +1,18 @@
+#
+# Activate component packaging
+#
+if(CPACK_GENERATOR MATCHES "ZIP")
+ set(CPACK_ARCHIVE_COMPONENT_INSTALL "ON")
+endif(CPACK_GENERATOR MATCHES "ZIP")
+
+if(CPACK_GENERATOR MATCHES "RPM")
+ set(CPACK_RPM_COMPONENT_INSTALL "ON")
+endif(CPACK_GENERATOR MATCHES "RPM")
+
+#
+# Choose grouping way
+#
+#set(CPACK_COMPONENTS_ALL_GROUPS_IN_ONE_PACKAGE)
+#set(CPACK_COMPONENTS_GROUPING)
+#set(CPACK_COMPONENTS_IGNORE_GROUPS)
+#set(CPACK_COMPONENTS_ALL_IN_ONE_PACKAGE) \ No newline at end of file
diff --git a/Tests/CPackComponentsForAll/MyLibCPackConfig.cmake.in b/Tests/CPackComponentsForAll/MyLibCPackConfig.cmake.in
deleted file mode 100644
index 7ffafae..0000000
--- a/Tests/CPackComponentsForAll/MyLibCPackConfig.cmake.in
+++ /dev/null
@@ -1,7 +0,0 @@
-if(CPACK_GENERATOR MATCHES "ZIP")
-# set(CPACK_COMPONENTS_ALL_IN_ONE_PACKAGE 1)
-endif(CPACK_GENERATOR MATCHES "ZIP")
-
-if(CPACK_GENERATOR MATCHES "TGZ")
- set(CPACK_MONOLITHIC_INSTALL 1)
-endif(CPACK_GENERATOR MATCHES "TGZ")
diff --git a/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake b/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake
index 11f72ec..d5137bd 100644
--- a/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake
+++ b/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake
@@ -49,6 +49,18 @@ if(CPackGen MATCHES "ZIP")
if (${CPackComponentWay} STREQUAL "default")
set(expected_count 1)
endif(${CPackComponentWay} STREQUAL "default")
+ if (${CPackComponentWay} STREQUAL "OnePackPerGroup")
+ set(expected_count 2)
+ endif (${CPackComponentWay} STREQUAL "OnePackPerGroup")
+ if (${CPackComponentWay} STREQUAL "IgnoreGroup")
+ set(expected_count 4)
+ endif (${CPackComponentWay} STREQUAL "IgnoreGroup")
+ if (${CPackComponentWay} STREQUAL "AllInOne")
+ set(expected_count 1)
+ endif (${CPackComponentWay} STREQUAL "AllInOne")
+ if (${CPackComponentWay} STREQUAL "AllGroupsInOne")
+ set(expected_count 1)
+ endif (${CPackComponentWay} STREQUAL "AllGroupsInOne")
endif(CPackGen MATCHES "ZIP")
# Now verify if the number of expected file is OK