diff options
Diffstat (limited to 'Tests')
88 files changed, 477 insertions, 137 deletions
diff --git a/Tests/CMakeCommands/target_compile_options/CMakeLists.txt b/Tests/CMakeCommands/target_compile_options/CMakeLists.txt index 35dd276..1dedbae 100644 --- a/Tests/CMakeCommands/target_compile_options/CMakeLists.txt +++ b/Tests/CMakeCommands/target_compile_options/CMakeLists.txt @@ -23,18 +23,19 @@ add_executable(consumer "${CMAKE_CURRENT_SOURCE_DIR}/consumer.cpp" ) -if (NOT CMAKE_GENERATOR MATCHES "Visual Studio") - target_sources(consumer PRIVATE - "${CMAKE_CURRENT_SOURCE_DIR}/consumer.c" - ) - target_compile_options(consumer - PRIVATE - -DCONSUMER_LANG_$<COMPILE_LANGUAGE> - -DLANG_IS_CXX=$<COMPILE_LANGUAGE:CXX> - -DLANG_IS_C=$<COMPILE_LANGUAGE:C> - ) +target_sources(consumer PRIVATE + "${CMAKE_CURRENT_SOURCE_DIR}/consumer.c" +) +target_compile_options(consumer + PRIVATE + -DCONSUMER_LANG_$<COMPILE_LANGUAGE> + -DLANG_IS_CXX=$<COMPILE_LANGUAGE:CXX> + -DLANG_IS_C=$<COMPILE_LANGUAGE:C> +) + +if(CMAKE_GENERATOR MATCHES "Visual Studio") target_compile_definitions(consumer - PRIVATE -DTEST_LANG_DEFINES + PRIVATE TEST_LANG_DEFINES_FOR_VISUAL_STUDIO ) endif() diff --git a/Tests/CMakeCommands/target_compile_options/consumer.c b/Tests/CMakeCommands/target_compile_options/consumer.c index 7931a6f..420b4cc 100644 --- a/Tests/CMakeCommands/target_compile_options/consumer.c +++ b/Tests/CMakeCommands/target_compile_options/consumer.c @@ -1,5 +1,23 @@ -#ifdef TEST_LANG_DEFINES +// Visual Studio allows only one set of flags for C and C++. +// In a target using C++ we pick the C++ flags even for C sources. +#ifdef TEST_LANG_DEFINES_FOR_VISUAL_STUDIO +#ifndef CONSUMER_LANG_CXX +#error Expected CONSUMER_LANG_CXX +#endif + +#ifdef CONSUMER_LANG_C +#error Unexpected CONSUMER_LANG_C +#endif + +#if !LANG_IS_CXX +#error Expected LANG_IS_CXX +#endif + +#if LANG_IS_C +#error Unexpected LANG_IS_C +#endif +#else #ifdef CONSUMER_LANG_CXX #error Unexpected CONSUMER_LANG_CXX #endif diff --git a/Tests/CMakeCommands/target_compile_options/consumer.cpp b/Tests/CMakeCommands/target_compile_options/consumer.cpp index 71a6098..7750950 100644 --- a/Tests/CMakeCommands/target_compile_options/consumer.cpp +++ b/Tests/CMakeCommands/target_compile_options/consumer.cpp @@ -15,7 +15,6 @@ #endif -#ifdef TEST_LANG_DEFINES #ifndef CONSUMER_LANG_CXX #error Expected CONSUMER_LANG_CXX #endif @@ -31,7 +30,6 @@ #if LANG_IS_C #error Unexpected LANG_IS_C #endif -#endif int main() { diff --git a/Tests/CudaOnly/SeparateCompilation/CMakeLists.txt b/Tests/CudaOnly/SeparateCompilation/CMakeLists.txt index 7ef626f..cfca823 100644 --- a/Tests/CudaOnly/SeparateCompilation/CMakeLists.txt +++ b/Tests/CudaOnly/SeparateCompilation/CMakeLists.txt @@ -13,7 +13,13 @@ string(APPEND CMAKE_CUDA_FLAGS " -gencode arch=compute_30,code=compute_30") set(CMAKE_CXX_STANDARD 11) set(CMAKE_CUDA_STANDARD 11) +set(CMAKE_CUDA_SEPARABLE_COMPILATION ON) add_library(CUDASeparateLibA STATIC file1.cu file2.cu file3.cu) +get_property(sep_comp TARGET CUDASeparateLibA PROPERTY CUDA_SEPARABLE_COMPILATION) +if(NOT sep_comp) + message(FATAL_ERROR "CUDA_SEPARABLE_COMPILATION not initialized") +endif() +unset(CMAKE_CUDA_SEPARABLE_COMPILATION) if(CMAKE_CUDA_SIMULATE_ID STREQUAL "MSVC") # Test adding a flag that is not in our CUDA flag table for VS. diff --git a/Tests/CudaOnly/WithDefs/CMakeLists.txt b/Tests/CudaOnly/WithDefs/CMakeLists.txt index 9b82366..5bd93a4 100644 --- a/Tests/CudaOnly/WithDefs/CMakeLists.txt +++ b/Tests/CudaOnly/WithDefs/CMakeLists.txt @@ -32,6 +32,8 @@ add_executable(CudaOnlyWithDefs ${main}) target_compile_options(CudaOnlyWithDefs PRIVATE + -DCOMPILE_LANG_$<COMPILE_LANGUAGE> + -DLANG_IS_CUDA=$<COMPILE_LANGUAGE:CUDA> -Xcompiler=-DHOST_DEFINE $<$<CONFIG:DEBUG>:$<BUILD_INTERFACE:${debug_compile_flags}>> ) diff --git a/Tests/CudaOnly/WithDefs/main.notcu b/Tests/CudaOnly/WithDefs/main.notcu index d2eff3f..bfb3577 100644 --- a/Tests/CudaOnly/WithDefs/main.notcu +++ b/Tests/CudaOnly/WithDefs/main.notcu @@ -10,6 +10,18 @@ #error "PACKED_DEFINE not defined!" #endif +#ifndef COMPILE_LANG_CUDA +#error "COMPILE_LANG_CUDA not defined!" +#endif + +#ifndef LANG_IS_CUDA +#error "LANG_IS_CUDA not defined!" +#endif + +#if !LANG_IS_CUDA +#error "Expected LANG_IS_CUDA" +#endif + static __global__ void DetermineIfValidCudaDevice() { } diff --git a/Tests/FindOpenGL/Test/CMakeLists.txt b/Tests/FindOpenGL/Test/CMakeLists.txt index 3b5ffee..9004a98 100644 --- a/Tests/FindOpenGL/Test/CMakeLists.txt +++ b/Tests/FindOpenGL/Test/CMakeLists.txt @@ -1,4 +1,5 @@ -cmake_minimum_required(VERSION 3.9) +cmake_minimum_required(VERSION 3.10) +cmake_policy(SET CMP0072 NEW) project(TestFindOpenGL C) include(CTest) diff --git a/Tests/FindPackageTest/CMakeLists.txt b/Tests/FindPackageTest/CMakeLists.txt index 1a6f204..ac3df65 100644 --- a/Tests/FindPackageTest/CMakeLists.txt +++ b/Tests/FindPackageTest/CMakeLists.txt @@ -565,6 +565,84 @@ endif() ####################### +write_basic_package_version_file(${CMAKE_CURRENT_BINARY_DIR}/Zot123ConfigVersion.cmake + VERSION 1.2.3.17 + COMPATIBILITY SameMinorVersion) + +unset(PACKAGE_VERSION_UNSUITABLE) +set(PACKAGE_VERSION_EXACT FALSE) +set(PACKAGE_FIND_VERSION 2.3.4) +set(PACKAGE_FIND_VERSION_MAJOR 2) +set(PACKAGE_FIND_VERSION_MINOR 3) +include(${CMAKE_CURRENT_BINARY_DIR}/Zot123ConfigVersion.cmake) +if(PACKAGE_VERSION_COMPATIBLE) + message(SEND_ERROR "Found Zot123 with version 1.2.3.17, but 2.3.4 was requested !") +endif() +if(PACKAGE_VERSION_EXACT) + message(SEND_ERROR "PACKAGE_VERSION_EXACT set, although it should not be !") +endif() + +set(PACKAGE_FIND_VERSION 0.0.1) +set(PACKAGE_FIND_VERSION_MAJOR 0) +set(PACKAGE_FIND_VERSION_MINOR 0) +include(${CMAKE_CURRENT_BINARY_DIR}/Zot123ConfigVersion.cmake) +if(PACKAGE_VERSION_COMPATIBLE) + message(SEND_ERROR "Found Zot123 with version 1.2.3.17, but 0.0.1 was requested !") +endif() +if(PACKAGE_VERSION_EXACT) + message(SEND_ERROR "PACKAGE_VERSION_EXACT set, although it should not be !") +endif() + +set(PACKAGE_FIND_VERSION 1.0.0) +set(PACKAGE_FIND_VERSION_MAJOR 1) +set(PACKAGE_FIND_VERSION_MINOR 0) +include(${CMAKE_CURRENT_BINARY_DIR}/Zot123ConfigVersion.cmake) +if(PACKAGE_VERSION_COMPATIBLE) + message(SEND_ERROR "Found Zot123 with version 1.2.3.17 (1.0.0 was requested) !") +endif() +if(PACKAGE_VERSION_EXACT) + message(SEND_ERROR "PACKAGE_VERSION_EXACT set, although it should not be !") +endif() + +set(PACKAGE_FIND_VERSION 1.2.0) +set(PACKAGE_FIND_VERSION_MAJOR 1) +set(PACKAGE_FIND_VERSION_MINOR 2) +include(${CMAKE_CURRENT_BINARY_DIR}/Zot123ConfigVersion.cmake) +if(NOT PACKAGE_VERSION_COMPATIBLE) + message(SEND_ERROR "Did not find Zot123 with version 1.2.3.17 (1.2.0 was requested) !") +endif() +if(PACKAGE_VERSION_EXACT) + message(SEND_ERROR "PACKAGE_VERSION_EXACT set, although it should not be !") +endif() + +set(PACKAGE_FIND_VERSION 1.2.3) +set(PACKAGE_FIND_VERSION_MAJOR 1) +set(PACKAGE_FIND_VERSION_MINOR 2) +include(${CMAKE_CURRENT_BINARY_DIR}/Zot123ConfigVersion.cmake) +if(NOT PACKAGE_VERSION_COMPATIBLE) + message(SEND_ERROR "Did not find Zot123 with version 1.2.3.17 (1.2.3 was requested) !") +endif() +if(PACKAGE_VERSION_EXACT) + message(SEND_ERROR "PACKAGE_VERSION_EXACT set, although it should not be !") +endif() + +set(PACKAGE_FIND_VERSION 1.2.3.17) +set(PACKAGE_FIND_VERSION_MAJOR 1) +set(PACKAGE_FIND_VERSION_MINOR 2) +include(${CMAKE_CURRENT_BINARY_DIR}/Zot123ConfigVersion.cmake) +if(NOT PACKAGE_VERSION_COMPATIBLE) + message(SEND_ERROR "Did not find Zot123 with version 1.2.3.17 (1.2.3.17 was requested) !") +endif() +if(NOT PACKAGE_VERSION_EXACT) + message(SEND_ERROR "PACKAGE_VERSION_EXACT not set, although it should be !") +endif() + +if(PACKAGE_VERSION_UNSUITABLE) + message(SEND_ERROR "PACKAGE_VERSION_UNSUITABLE set, but must not be !") +endif() + +####################### + write_basic_package_version_file(${CMAKE_CURRENT_BINARY_DIR}/Bar123ConfigVersion.cmake VERSION 1.2.3.17 COMPATIBILITY ExactVersion) @@ -574,7 +652,7 @@ set(PACKAGE_VERSION_EXACT FALSE) set(PACKAGE_FIND_VERSION 2.3.4) include(${CMAKE_CURRENT_BINARY_DIR}/Bar123ConfigVersion.cmake) if(PACKAGE_VERSION_COMPATIBLE) - message(SEND_ERROR "Found Bar123 with version 1.2.3 (2.3.4 was requested) !") + message(SEND_ERROR "Found Bar123 with version 1.2.3.17 (2.3.4 was requested) !") endif() if(PACKAGE_VERSION_EXACT) message(SEND_ERROR "PACKAGE_VERSION_EXACT set, although it should not be !") @@ -583,7 +661,7 @@ endif() set(PACKAGE_FIND_VERSION 1.2) include(${CMAKE_CURRENT_BINARY_DIR}/Bar123ConfigVersion.cmake) if(PACKAGE_VERSION_COMPATIBLE) - message(SEND_ERROR "Found Bar123 with version 1.2.3 (1.2 was requested) !") + message(SEND_ERROR "Found Bar123 with version 1.2.3.17 (1.2 was requested) !") endif() if(PACKAGE_VERSION_EXACT) message(SEND_ERROR "PACKAGE_VERSION_EXACT set, although it should not be !") @@ -592,7 +670,7 @@ endif() set(PACKAGE_FIND_VERSION 1) include(${CMAKE_CURRENT_BINARY_DIR}/Bar123ConfigVersion.cmake) if(PACKAGE_VERSION_COMPATIBLE) - message(SEND_ERROR "Found Bar123 with version 1.2.3 (1 was requested) !") + message(SEND_ERROR "Found Bar123 with version 1.2.3.17 (1 was requested) !") endif() if(PACKAGE_VERSION_EXACT) message(SEND_ERROR "PACKAGE_VERSION_EXACT set, although it should not be !") @@ -601,7 +679,7 @@ endif() set(PACKAGE_FIND_VERSION 1.2.3.4) include(${CMAKE_CURRENT_BINARY_DIR}/Bar123ConfigVersion.cmake) if(NOT PACKAGE_VERSION_COMPATIBLE) - message(SEND_ERROR "Did not find Bar123 with version 1.2.3 (1.2.3.4 was requested) !") + message(SEND_ERROR "Did not find Bar123 with version 1.2.3.17 (1.2.3.4 was requested) !") endif() if(PACKAGE_VERSION_EXACT) message(SEND_ERROR "PACKAGE_VERSION_EXACT set, although it should not be !") @@ -612,19 +690,18 @@ set(PACKAGE_VERSION_EXACT FALSE) set(PACKAGE_VERSION_COMPATIBLE FALSE) include(${CMAKE_CURRENT_BINARY_DIR}/Bar123ConfigVersion.cmake) if(NOT PACKAGE_VERSION_COMPATIBLE) - message(SEND_ERROR "Did not find Bar123 with version 1.2.3 (1.2.3 was requested) !") + message(SEND_ERROR "Did not find Bar123 with version 1.2.3.17 (1.2.3 was requested) !") endif() if(PACKAGE_VERSION_EXACT) message(SEND_ERROR "PACKAGE_VERSION_EXACT set, although it should not be !") endif() - set(PACKAGE_FIND_VERSION 1.2.3.17) set(PACKAGE_VERSION_EXACT FALSE) set(PACKAGE_VERSION_COMPATIBLE FALSE) include(${CMAKE_CURRENT_BINARY_DIR}/Bar123ConfigVersion.cmake) if(NOT PACKAGE_VERSION_COMPATIBLE) - message(SEND_ERROR "Did not find Bar123 with version 1.2.3 (1.2.3.17 was requested) !") + message(SEND_ERROR "Did not find Bar123 with version 1.2.3.17 (1.2.3.17 was requested) !") endif() if(NOT PACKAGE_VERSION_EXACT) message(SEND_ERROR "PACKAGE_VERSION_EXACT not set, although it should be !") diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index 6b7b723..aa075b0 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -144,6 +144,7 @@ add_RunCMake_test(ExternalData) add_RunCMake_test(FeatureSummary) add_RunCMake_test(FPHSA) add_RunCMake_test(FindBoost) +add_RunCMake_test(FindOpenGL) if(NOT CMAKE_C_COMPILER_ID MATCHES "Watcom") add_RunCMake_test(GenerateExportHeader) endif() @@ -384,6 +385,9 @@ if("${CMAKE_GENERATOR}" MATCHES "Make|Ninja") if(DEFINED CMake_TEST_CUDA) list(APPEND CompilerLauncher_ARGS -DCMake_TEST_CUDA=${CMake_TEST_CUDA}) endif() + if(CMAKE_Fortran_COMPILER) + list(APPEND CompilerLauncher_ARGS -DCMake_TEST_Fortran=1) + endif() add_RunCMake_test(CompilerLauncher) add_RunCMake_test(ctest_labels_for_subprojects) endif() diff --git a/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileDefinitions-stderr-VS.txt b/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileDefinitions-stderr-VS.txt index 73b66ac..42c1485 100644 --- a/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileDefinitions-stderr-VS.txt +++ b/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileDefinitions-stderr-VS.txt @@ -3,6 +3,7 @@ CMake Error at CompileDefinitions.cmake:5 \(target_compile_definitions\): \$<COMPILE_LANGUAGE:CXX> - \$<COMPILE_LANGUAGE:...> may not be used with Visual Studio generators. + \$<COMPILE_LANGUAGE:...> may only be used for COMPILE_OPTIONS and + file\(GENERATE\) with the Visual Studio generator. Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileDefinitions-stderr-Xcode.txt b/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileDefinitions-stderr-Xcode.txt index a1ed633..7879a79 100644 --- a/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileDefinitions-stderr-Xcode.txt +++ b/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileDefinitions-stderr-Xcode.txt @@ -3,7 +3,7 @@ CMake Error at CompileDefinitions.cmake:5 \(target_compile_definitions\): \$<COMPILE_LANGUAGE:CXX> - \$<COMPILE_LANGUAGE:...> may only be used with COMPILE_OPTIONS with the - Xcode generator. + \$<COMPILE_LANGUAGE:...> may only be used for COMPILE_OPTIONS and + file\(GENERATE\) with the Xcode generator. Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileOptions-stderr-VS.txt b/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileOptions-stderr-VS.txt deleted file mode 100644 index e9e8e9f..0000000 --- a/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileOptions-stderr-VS.txt +++ /dev/null @@ -1,8 +0,0 @@ -CMake Error at CompileOptions.cmake:5 \(target_compile_options\): - Error evaluating generator expression: - - \$<COMPILE_LANGUAGE:CXX> - - \$<COMPILE_LANGUAGE:...> may not be used with Visual Studio generators. -Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileOptions.cmake b/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileOptions.cmake deleted file mode 100644 index 6c92abc..0000000 --- a/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileOptions.cmake +++ /dev/null @@ -1,5 +0,0 @@ - -enable_language(CXX) - -add_executable(main main.cpp) -target_compile_options(main PRIVATE $<$<COMPILE_LANGUAGE:CXX>:-DANYTHING>) diff --git a/Tests/RunCMake/COMPILE_LANGUAGE-genex/IncludeDirectories-stderr-VS.txt b/Tests/RunCMake/COMPILE_LANGUAGE-genex/IncludeDirectories-stderr-VS.txt index ec15068..3806ed1 100644 --- a/Tests/RunCMake/COMPILE_LANGUAGE-genex/IncludeDirectories-stderr-VS.txt +++ b/Tests/RunCMake/COMPILE_LANGUAGE-genex/IncludeDirectories-stderr-VS.txt @@ -3,6 +3,7 @@ CMake Error at IncludeDirectories.cmake:5 \(target_include_directories\): \$<COMPILE_LANGUAGE:CXX> - \$<COMPILE_LANGUAGE:...> may not be used with Visual Studio generators. + \$<COMPILE_LANGUAGE:...> may only be used for COMPILE_OPTIONS and + file\(GENERATE\) with the Visual Studio generator. Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/COMPILE_LANGUAGE-genex/IncludeDirectories-stderr-Xcode.txt b/Tests/RunCMake/COMPILE_LANGUAGE-genex/IncludeDirectories-stderr-Xcode.txt index fdf92b2..a3fb9c5 100644 --- a/Tests/RunCMake/COMPILE_LANGUAGE-genex/IncludeDirectories-stderr-Xcode.txt +++ b/Tests/RunCMake/COMPILE_LANGUAGE-genex/IncludeDirectories-stderr-Xcode.txt @@ -3,7 +3,7 @@ CMake Error at IncludeDirectories.cmake:5 \(target_include_directories\): \$<COMPILE_LANGUAGE:CXX> - \$<COMPILE_LANGUAGE:...> may only be used with COMPILE_OPTIONS with the - Xcode generator. + \$<COMPILE_LANGUAGE:...> may only be used for COMPILE_OPTIONS and + file\(GENERATE\) with the Xcode generator. Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/COMPILE_LANGUAGE-genex/RunCMakeTest.cmake b/Tests/RunCMake/COMPILE_LANGUAGE-genex/RunCMakeTest.cmake index 5e0a5f5..421fa73 100644 --- a/Tests/RunCMake/COMPILE_LANGUAGE-genex/RunCMakeTest.cmake +++ b/Tests/RunCMake/COMPILE_LANGUAGE-genex/RunCMakeTest.cmake @@ -1,9 +1,5 @@ include(RunCMake) -if (RunCMake_GENERATOR MATCHES "Visual Studio") - set(RunCMake-stderr-file CompileOptions-stderr-VS.txt) - run_cmake(CompileOptions) -endif() if (RunCMake_GENERATOR STREQUAL "Xcode") set(RunCMake-stderr-file CompileDefinitions-stderr-Xcode.txt) run_cmake(CompileDefinitions) diff --git a/Tests/RunCMake/CPack/ArchiveCommon/common_helpers.cmake b/Tests/RunCMake/CPack/ArchiveCommon/common_helpers.cmake index 99d3155..948c6ab 100644 --- a/Tests/RunCMake/CPack/ArchiveCommon/common_helpers.cmake +++ b/Tests/RunCMake/CPack/ArchiveCommon/common_helpers.cmake @@ -45,13 +45,22 @@ function(toExpectedContentList FILE_NO CONTENT_VAR) unset(prefix_) endif() - if(NOT DEFINED TEST_MAIN_INSTALL_PREFIX_PATH) - set(TEST_MAIN_INSTALL_PREFIX_PATH "/usr") + # add install prefix to expected paths + if(DEFINED EXPECTED_FILE_${FILE_NO}_PACKAGING_PREFIX) + set(EXPECTED_FILE_PACKAGING_PREFIX + "${EXPECTED_FILE_${FILE_NO}_PACKAGING_PREFIX}") + elseif(NOT DEFINED EXPECTED_FILE_PACKAGING_PREFIX) + # default CPack Archive packaging install prefix + set(EXPECTED_FILE_PACKAGING_PREFIX "/") endif() + set(prepared_ "${EXPECTED_FILE_PACKAGING_PREFIX}") + foreach(part_ IN LISTS ${CONTENT_VAR}) + list(APPEND prepared_ "${EXPECTED_FILE_PACKAGING_PREFIX}${part_}") + endforeach() unset(filtered_) - foreach(part_ IN LISTS ${CONTENT_VAR}) - string(REGEX REPLACE "^${TEST_MAIN_INSTALL_PREFIX_PATH}(/|$)" "" part_ "${part_}") + foreach(part_ IN LISTS prepared_) + string(REGEX REPLACE "^/" "" part_ "${part_}") if(part_) list(APPEND filtered_ "${prefix_}${part_}") diff --git a/Tests/RunCMake/CPack/CPackTestHelpers.cmake b/Tests/RunCMake/CPack/CPackTestHelpers.cmake index 5337b2c..447b08b 100644 --- a/Tests/RunCMake/CPack/CPackTestHelpers.cmake +++ b/Tests/RunCMake/CPack/CPackTestHelpers.cmake @@ -35,10 +35,27 @@ function(run_cpack_test_common_ TEST_NAME types build SUBTEST_SUFFIX source PACK "-DRunCMake_TEST_FILE_PREFIX=${TEST_NAME}" "-DRunCMake_SUBTEST_SUFFIX=${SUBTEST_SUFFIX}" "-DPACKAGING_TYPE=${PACKAGING_TYPE}") + + foreach(o out err) + if(SUBTEST_SUFFIX AND EXISTS ${RunCMake_SOURCE_DIR}/tests/${TEST_NAME}/configure-${PACKAGING_TYPE}-${SUBTEST_SUFFIX}-std${o}.txt) + set(RunCMake-std${o}-file "tests/${TEST_NAME}/configure-${PACKAGING_TYPE}-${SUBTEST_SUFFIX}-std${o}.txt") + elseif(SUBTEST_SUFFIX AND EXISTS ${RunCMake_SOURCE_DIR}/tests/${TEST_NAME}/configure-${SUBTEST_SUFFIX}-std${o}.txt) + set(RunCMake-std${o}-file "tests/${TEST_NAME}/configure-${SUBTEST_SUFFIX}-std${o}.txt") + elseif(EXISTS ${RunCMake_SOURCE_DIR}/tests/${TEST_NAME}/configure-${PACKAGING_TYPE}-std${o}.txt) + set(RunCMake-std${o}-file "tests/${TEST_NAME}/configure-${PACKAGING_TYPE}-std${o}.txt") + elseif(EXISTS ${RunCMake_SOURCE_DIR}/tests/${TEST_NAME}/configure-std${o}.txt) + set(RunCMake-std${o}-file "tests/${TEST_NAME}/configure-std${o}.txt") + else() + unset(RunCMake-std${o}-file) + endif() + endforeach() + run_cmake(${full_test_name_}) # execute optional build step if(build) + unset(RunCMake-stdout-file) + unset(RunCMake-stderr-file) run_cmake_command(${full_test_name_}-Build "${CMAKE_COMMAND}" --build "${RunCMake_TEST_BINARY_DIR}") endif() @@ -72,6 +89,8 @@ function(run_cpack_test_common_ TEST_NAME types build SUBTEST_SUFFIX source PACK set(RunCMake-std${o}-file "tests/${TEST_NAME}/${SUBTEST_SUFFIX}-std${o}.txt") elseif(EXISTS ${RunCMake_SOURCE_DIR}/${TEST_TYPE}/default_expected_std${o}.txt) set(RunCMake-std${o}-file "${TEST_TYPE}/default_expected_std${o}.txt") + else() + unset(RunCMake-std${o}-file) endif() endforeach() diff --git a/Tests/RunCMake/CPack/DEB/Helpers.cmake b/Tests/RunCMake/CPack/DEB/Helpers.cmake index 6d8e84a..f7c5c84 100644 --- a/Tests/RunCMake/CPack/DEB/Helpers.cmake +++ b/Tests/RunCMake/CPack/DEB/Helpers.cmake @@ -47,7 +47,20 @@ function(getPackageContentList FILE RESULT_VAR) endfunction() function(toExpectedContentList FILE_NO CONTENT_VAR) - # no need to do anything + # add install prefix to expected paths + if(DEFINED EXPECTED_FILE_${FILE_NO}_PACKAGING_PREFIX) + set(EXPECTED_FILE_PACKAGING_PREFIX + "${EXPECTED_FILE_${FILE_NO}_PACKAGING_PREFIX}") + elseif(NOT DEFINED EXPECTED_FILE_PACKAGING_PREFIX) + # default CPackDeb packaging install prefix + set(EXPECTED_FILE_PACKAGING_PREFIX "/usr") + endif() + set(prepared_ "${EXPECTED_FILE_PACKAGING_PREFIX}") + foreach(part_ IN LISTS ${CONTENT_VAR}) + list(APPEND prepared_ "${EXPECTED_FILE_PACKAGING_PREFIX}${part_}") + endforeach() + + set(${CONTENT_VAR} "${prepared_}" PARENT_SCOPE) endfunction() function(getMissingShlibsErrorExtra FILE RESULT_VAR) diff --git a/Tests/RunCMake/CPack/README.txt b/Tests/RunCMake/CPack/README.txt index 5877f97..2e2abdf 100644 --- a/Tests/RunCMake/CPack/README.txt +++ b/Tests/RunCMake/CPack/README.txt @@ -96,6 +96,14 @@ the test has to run some functions after CPack.cmake is included. In such cases a function run_after_include_cpack can be declared in test.cmake file and that function will run after the inclusion of CPack.cmake. +NOTE: During CMake configure stage developer warnings may be expected. In such +cases an expected output regular expression can be provided by creating +'<test_name>/configure-stdout.txt' and/or '<test_name>/configure-stderr.txt' +file. There are also more specialized versions of the file available: +- configure-${PACKAGING_TYPE}-${SUBTEST_SUFFIX}-std${o}.txt +- configure-${SUBTEST_SUFFIX}-std${o}.txt +- configure-${PACKAGING_TYPE}-std${o}.txt + build phase (optional and not available for source package tests) ----------------------------------------------------------------- @@ -153,13 +161,19 @@ this step and must contain is later changed automatically depending on the generator so expected package content can be written only once per test for all generators. +- EXPECTED_FILE_PACKAGING_PREFIX and + EXPECTED_FILE_<file_number_starting_with_1>_PACKAGING_PREFIX variables can be + set to explicitly specified CPACK_PACKAGING_PREFIX value. By default this + variable does not need to be set as it is implicitly set to package generator + specific prefix. + Optional verification phase is generator specific and is optionaly executed. This phase is executed if '<test_name>/VerifyResult.cmake' script exists. VerifyResult.cmake script also automatically prints out standard output and standard error from CPack execution phase that is compared with '<test_name>/<generator_name>-stdout.txt' regular expression and -and '<test_name>/<generator_name>-stderr.txt' regular expresson respectively. +'<test_name>/<generator_name>-stderr.txt' regular expresson respectively. NOTE: For subtests generator name can also be suffixed with subtest name and/or packaging type (MONOLITHIC, COMPONENT, GROUP) and in such cases the preferences of which file will be used are as follows: diff --git a/Tests/RunCMake/CPack/RPM/Helpers.cmake b/Tests/RunCMake/CPack/RPM/Helpers.cmake index 88fc231..a29c020 100644 --- a/Tests/RunCMake/CPack/RPM/Helpers.cmake +++ b/Tests/RunCMake/CPack/RPM/Helpers.cmake @@ -47,14 +47,29 @@ function(getPackageContentList FILE RESULT_VAR) endfunction() function(toExpectedContentList FILE_NO CONTENT_VAR) - if(NOT DEFINED TEST_INSTALL_PREFIX_PATHS) - set(TEST_INSTALL_PREFIX_PATHS "/usr") + # add install prefix to expected paths + if(DEFINED EXPECTED_FILE_${FILE_NO}_PACKAGING_PREFIX) + set(EXPECTED_FILE_PACKAGING_PREFIX + "${EXPECTED_FILE_${FILE_NO}_PACKAGING_PREFIX}") + elseif(NOT DEFINED EXPECTED_FILE_PACKAGING_PREFIX) + # default CPackRPM packaging install prefix + set(EXPECTED_FILE_PACKAGING_PREFIX "/usr") endif() + set(prepared_ "${EXPECTED_FILE_PACKAGING_PREFIX}") + foreach(part_ IN LISTS ${CONTENT_VAR}) + list(APPEND prepared_ "${EXPECTED_FILE_PACKAGING_PREFIX}${part_}") + endforeach() + # remove paths that are excluded from auto packaging + if(NOT DEFINED CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST) + set(CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST + /etc /etc/init.d /usr /usr/bin /usr/include /usr/lib + /usr/libx32 /usr/lib64 /usr/share /usr/share/aclocal /usr/share/doc) + endif() unset(filtered_) - foreach(part_ IN LISTS ${CONTENT_VAR}) + foreach(part_ IN LISTS prepared_) unset(dont_add_) - foreach(for_removal_ IN LISTS TEST_INSTALL_PREFIX_PATHS) + foreach(for_removal_ IN LISTS CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST) if(part_ STREQUAL for_removal_) set(dont_add_ TRUE) break() diff --git a/Tests/RunCMake/CPack/STGZ/Helpers.cmake b/Tests/RunCMake/CPack/STGZ/Helpers.cmake index 68b1eab..1756645 100644 --- a/Tests/RunCMake/CPack/STGZ/Helpers.cmake +++ b/Tests/RunCMake/CPack/STGZ/Helpers.cmake @@ -47,18 +47,29 @@ function(toExpectedContentList FILE_NO CONTENT_VAR) string(SUBSTRING "${prefix_}" 0 ${pos_} prefix_) endif() - if(NOT DEFINED TEST_MAIN_INSTALL_PREFIX_PATH) - set(TEST_MAIN_INSTALL_PREFIX_PATH "/usr") + # add install prefix to expected paths + if(DEFINED EXPECTED_FILE_${FILE_NO}_PACKAGING_PREFIX) + set(EXPECTED_FILE_PACKAGING_PREFIX + "${EXPECTED_FILE_${FILE_NO}_PACKAGING_PREFIX}") + elseif(NOT DEFINED EXPECTED_FILE_PACKAGING_PREFIX) + # default CPack Archive packaging install prefix + set(EXPECTED_FILE_PACKAGING_PREFIX "/") endif() - set(filtered_ "${prefix_}") - foreach(part_ IN LISTS ${CONTENT_VAR}) - string(REGEX REPLACE "^${TEST_MAIN_INSTALL_PREFIX_PATH}(/|$)" "" part_ "${part_}") + # remove trailing slash otherwise path concatenation will cause double slashes + string(REGEX REPLACE "/$" "" EXPECTED_FILE_PACKAGING_PREFIX + "${EXPECTED_FILE_PACKAGING_PREFIX}") + + if(EXPECTED_FILE_PACKAGING_PREFIX) + set(prepared_ "${prefix_}") + else() + unset(prepared_) + endif() - if(part_) - list(APPEND filtered_ "${prefix_}/${part_}") - endif() + list(APPEND prepared_ "${prefix_}${EXPECTED_FILE_PACKAGING_PREFIX}") + foreach(part_ IN LISTS ${CONTENT_VAR}) + list(APPEND prepared_ "${prefix_}${EXPECTED_FILE_PACKAGING_PREFIX}${part_}") endforeach() - set(${CONTENT_VAR} "${filtered_}" PARENT_SCOPE) + set(${CONTENT_VAR} "${prepared_}" PARENT_SCOPE) endfunction() diff --git a/Tests/RunCMake/CPack/tests/CPACK_INSTALL_SCRIPT/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/CPACK_INSTALL_SCRIPT/ExpectedFiles.cmake index 5cb12c3..02a7821 100644 --- a/Tests/RunCMake/CPack/tests/CPACK_INSTALL_SCRIPT/ExpectedFiles.cmake +++ b/Tests/RunCMake/CPack/tests/CPACK_INSTALL_SCRIPT/ExpectedFiles.cmake @@ -1,3 +1,3 @@ set(EXPECTED_FILES_COUNT "1") -set(EXPECTED_FILE_CONTENT_1_LIST "/usr;/usr/foo;/usr/foo/abc.txt") +set(EXPECTED_FILE_CONTENT_1_LIST "/foo;/foo/abc.txt") diff --git a/Tests/RunCMake/CPack/tests/CUSTOM_BINARY_SPEC_FILE/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/CUSTOM_BINARY_SPEC_FILE/ExpectedFiles.cmake index 694dc00..6d895ec 100644 --- a/Tests/RunCMake/CPack/tests/CUSTOM_BINARY_SPEC_FILE/ExpectedFiles.cmake +++ b/Tests/RunCMake/CPack/tests/CUSTOM_BINARY_SPEC_FILE/ExpectedFiles.cmake @@ -1,9 +1,9 @@ set(EXPECTED_FILES_COUNT "1") -set(EXPECTED_FILE_CONTENT_1_LIST "/usr;/usr/foo;/usr/foo/CMakeLists.txt") +set(EXPECTED_FILE_CONTENT_1_LIST "/foo;/foo/CMakeLists.txt") if(PACKAGING_TYPE STREQUAL "COMPONENT") set(EXPECTED_FILES_COUNT "2") set(EXPECTED_FILE_1_COMPONENT "test") set(EXPECTED_FILE_2_COMPONENT "test2") - set(EXPECTED_FILE_CONTENT_2_LIST "/usr;/usr/bar;/usr/bar/CMakeLists.txt") + set(EXPECTED_FILE_CONTENT_2_LIST "/bar;/bar/CMakeLists.txt") endif() diff --git a/Tests/RunCMake/CPack/tests/CUSTOM_NAMES/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/CUSTOM_NAMES/ExpectedFiles.cmake index 5cb280c..07226df 100644 --- a/Tests/RunCMake/CPack/tests/CUSTOM_NAMES/ExpectedFiles.cmake +++ b/Tests/RunCMake/CPack/tests/CUSTOM_NAMES/ExpectedFiles.cmake @@ -1,10 +1,10 @@ set(EXPECTED_FILES_COUNT "3") set(EXPECTED_FILES_NAME_GENERATOR_SPECIFIC_FORMAT TRUE) set(EXPECTED_FILE_1_COMPONENT "pkg_1") -set(EXPECTED_FILE_CONTENT_1_LIST "/usr;/usr/foo;/usr/foo/CMakeLists.txt") +set(EXPECTED_FILE_CONTENT_1_LIST "/foo;/foo/CMakeLists.txt") set(EXPECTED_FILE_2_NAME "second") -set(EXPECTED_FILE_CONTENT_2_LIST "/usr;/usr/foo;/usr/foo/CMakeLists.txt") -set(EXPECTED_FILE_CONTENT_3_LIST "/usr;/usr/foo;/usr/foo/CMakeLists.txt") +set(EXPECTED_FILE_CONTENT_2_LIST "/foo;/foo/CMakeLists.txt") +set(EXPECTED_FILE_CONTENT_3_LIST "/foo;/foo/CMakeLists.txt") if(GENERATOR_TYPE STREQUAL "DEB" OR GENERATOR_TYPE STREQUAL "RPM") string(TOLOWER "${GENERATOR_TYPE}" file_extension_) diff --git a/Tests/RunCMake/CPack/tests/DEBUGINFO/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/DEBUGINFO/ExpectedFiles.cmake index 3d8de74..b26c6c7 100644 --- a/Tests/RunCMake/CPack/tests/DEBUGINFO/ExpectedFiles.cmake +++ b/Tests/RunCMake/CPack/tests/DEBUGINFO/ExpectedFiles.cmake @@ -5,11 +5,11 @@ set(EXPECTED_FILES_NAME_GENERATOR_SPECIFIC_FORMAT TRUE) set(EXPECTED_FILE_1_NAME "Debuginfo") set(EXPECTED_FILE_1_COMPONENT "applications") -set(EXPECTED_FILE_CONTENT_1_LIST "/usr;/usr/foo;/usr/foo/test_prog") +set(EXPECTED_FILE_CONTENT_1_LIST "/foo;/foo/test_prog") set(EXPECTED_FILE_2 "TestDinfo-pkg*-headers.rpm") -set(EXPECTED_FILE_CONTENT_2_LIST "/usr;/usr/bar;/usr/bar/CMakeLists.txt") +set(EXPECTED_FILE_CONTENT_2_LIST "/bar;/bar/CMakeLists.txt") set(EXPECTED_FILE_3 "TestDinfo-pkg*-libs.rpm") -set(EXPECTED_FILE_CONTENT_3_LIST "/usr;/usr/bas;/usr/bas/libtest_lib.so") +set(EXPECTED_FILE_CONTENT_3_LIST "/bas;/bas/libtest_lib.so") set(EXPECTED_FILE_4_NAME "Debuginfo") set(EXPECTED_FILE_4_COMPONENT "applications-debuginfo") diff --git a/Tests/RunCMake/CPack/tests/DEB_PACKAGE_VERSION_BACK_COMPATIBILITY/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/DEB_PACKAGE_VERSION_BACK_COMPATIBILITY/ExpectedFiles.cmake index 6142eb3..d1a3a5f 100644 --- a/Tests/RunCMake/CPack/tests/DEB_PACKAGE_VERSION_BACK_COMPATIBILITY/ExpectedFiles.cmake +++ b/Tests/RunCMake/CPack/tests/DEB_PACKAGE_VERSION_BACK_COMPATIBILITY/ExpectedFiles.cmake @@ -1,2 +1,2 @@ set(EXPECTED_FILES_COUNT "1") -set(EXPECTED_FILE_CONTENT_1_LIST "/usr;/usr/foo;/usr/foo/CMakeLists.txt") +set(EXPECTED_FILE_CONTENT_1_LIST "/foo;/foo/CMakeLists.txt") diff --git a/Tests/RunCMake/CPack/tests/DEFAULT_PERMISSIONS/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/DEFAULT_PERMISSIONS/ExpectedFiles.cmake index 9b8205b..b6fcc17 100644 --- a/Tests/RunCMake/CPack/tests/DEFAULT_PERMISSIONS/ExpectedFiles.cmake +++ b/Tests/RunCMake/CPack/tests/DEFAULT_PERMISSIONS/ExpectedFiles.cmake @@ -2,5 +2,5 @@ if(${RunCMake_SUBTEST_SUFFIX} MATCHES "invalid_.*_var") set(EXPECTED_FILES_COUNT "0") else() set(EXPECTED_FILES_COUNT "1") - set(EXPECTED_FILE_CONTENT_1_LIST "/usr;/usr/foo;/usr/foo/CMakeLists.txt") + set(EXPECTED_FILE_CONTENT_1_LIST "/foo;/foo/CMakeLists.txt") endif() diff --git a/Tests/RunCMake/CPack/tests/DEPENDENCIES/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/DEPENDENCIES/ExpectedFiles.cmake index 3b280ba..be7ba07 100644 --- a/Tests/RunCMake/CPack/tests/DEPENDENCIES/ExpectedFiles.cmake +++ b/Tests/RunCMake/CPack/tests/DEPENDENCIES/ExpectedFiles.cmake @@ -1,14 +1,14 @@ set(EXPECTED_FILES_COUNT "5") set(EXPECTED_FILE_1_COMPONENT "applications") -set(EXPECTED_FILE_CONTENT_1_LIST "/usr;/usr/foo;/usr/foo/test_prog") +set(EXPECTED_FILE_CONTENT_1_LIST "/foo;/foo/test_prog") set(EXPECTED_FILE_2_COMPONENT "applications_auto") -set(EXPECTED_FILE_CONTENT_2_LIST "/usr;/usr/foo_auto;/usr/foo_auto/test_prog") +set(EXPECTED_FILE_CONTENT_2_LIST "/foo_auto;/foo_auto/test_prog") set(EXPECTED_FILE_3_COMPONENT "headers") -set(EXPECTED_FILE_CONTENT_3_LIST "/usr;/usr/bar;/usr/bar/CMakeLists.txt") +set(EXPECTED_FILE_CONTENT_3_LIST "/bar;/bar/CMakeLists.txt") set(EXPECTED_FILE_4_COMPONENT "libs") -set(EXPECTED_FILE_CONTENT_4_LIST "/usr/bas;/usr/bas/libtest_lib.so") +set(EXPECTED_FILE_CONTENT_4_LIST "/bas;/bas/libtest_lib.so") set(EXPECTED_FILE_5_COMPONENT "libs_auto") -set(EXPECTED_FILE_CONTENT_5_LIST "/usr;/usr/bas_auto;/usr/bas_auto/libtest_lib.so") +set(EXPECTED_FILE_CONTENT_5_LIST "/bas_auto;/bas_auto/libtest_lib.so") if(GENERATOR_TYPE STREQUAL "DEB") set(whitespaces_ "[\t\n\r ]*") diff --git a/Tests/RunCMake/CPack/tests/DIST/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/DIST/ExpectedFiles.cmake index 6142eb3..d1a3a5f 100644 --- a/Tests/RunCMake/CPack/tests/DIST/ExpectedFiles.cmake +++ b/Tests/RunCMake/CPack/tests/DIST/ExpectedFiles.cmake @@ -1,2 +1,2 @@ set(EXPECTED_FILES_COUNT "1") -set(EXPECTED_FILE_CONTENT_1_LIST "/usr;/usr/foo;/usr/foo/CMakeLists.txt") +set(EXPECTED_FILE_CONTENT_1_LIST "/foo;/foo/CMakeLists.txt") diff --git a/Tests/RunCMake/CPack/tests/EMPTY_DIR/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/EMPTY_DIR/ExpectedFiles.cmake index 650687c..8df6831 100644 --- a/Tests/RunCMake/CPack/tests/EMPTY_DIR/ExpectedFiles.cmake +++ b/Tests/RunCMake/CPack/tests/EMPTY_DIR/ExpectedFiles.cmake @@ -1,6 +1,6 @@ set(EXPECTED_FILES_COUNT "1") set(EXPECTED_FILES_NAME_GENERATOR_SPECIFIC_FORMAT TRUE) -set(EXPECTED_FILE_CONTENT_1_LIST "/usr;/usr/empty") +set(EXPECTED_FILE_CONTENT_1_LIST "/empty") if(PACKAGING_TYPE STREQUAL "COMPONENT") set(EXPECTED_FILE_1_COMPONENT "test") diff --git a/Tests/RunCMake/CPack/tests/EXTRA/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/EXTRA/ExpectedFiles.cmake index ded2923..407cbe6 100644 --- a/Tests/RunCMake/CPack/tests/EXTRA/ExpectedFiles.cmake +++ b/Tests/RunCMake/CPack/tests/EXTRA/ExpectedFiles.cmake @@ -1,8 +1,8 @@ set(EXPECTED_FILES_COUNT "3") set(EXPECTED_FILES_NAME_GENERATOR_SPECIFIC_FORMAT TRUE) set(EXPECTED_FILE_1_COMPONENT "foo") -set(EXPECTED_FILE_CONTENT_1_LIST "/usr;/usr/foo;/usr/foo/CMakeLists.txt") +set(EXPECTED_FILE_CONTENT_1_LIST "/foo;/foo/CMakeLists.txt") set(EXPECTED_FILE_2_COMPONENT "bar") -set(EXPECTED_FILE_CONTENT_2_LIST "/usr;/usr/bar;/usr/bar/CMakeLists.txt") +set(EXPECTED_FILE_CONTENT_2_LIST "/bar;/bar/CMakeLists.txt") set(EXPECTED_FILE_3_COMPONENT "bas") -set(EXPECTED_FILE_CONTENT_3_LIST "/usr;/usr/bas;/usr/bas/CMakeLists.txt") +set(EXPECTED_FILE_CONTENT_3_LIST "/bas;/bas/CMakeLists.txt") diff --git a/Tests/RunCMake/CPack/tests/EXTRA_SLASH_IN_PATH/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/EXTRA_SLASH_IN_PATH/ExpectedFiles.cmake index a45b38d..974df22 100644 --- a/Tests/RunCMake/CPack/tests/EXTRA_SLASH_IN_PATH/ExpectedFiles.cmake +++ b/Tests/RunCMake/CPack/tests/EXTRA_SLASH_IN_PATH/ExpectedFiles.cmake @@ -2,6 +2,7 @@ set(whitespaces_ "[\t\n\r ]*") set(EXPECTED_FILES_COUNT "5") set(EXPECTED_FILES_NAME_GENERATOR_SPECIFIC_FORMAT TRUE) +set(EXPECTED_FILE_PACKAGING_PREFIX "") set(EXPECTED_FILE_1_COMPONENT "applications") set(EXPECTED_FILE_CONTENT_1_LIST "/foo;/foo/test_prog") diff --git a/Tests/RunCMake/CPack/tests/INSTALL_SCRIPTS/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/INSTALL_SCRIPTS/ExpectedFiles.cmake index 44346ab..de38df9 100644 --- a/Tests/RunCMake/CPack/tests/INSTALL_SCRIPTS/ExpectedFiles.cmake +++ b/Tests/RunCMake/CPack/tests/INSTALL_SCRIPTS/ExpectedFiles.cmake @@ -1,5 +1,5 @@ set(EXPECTED_FILES_COUNT "2") set(EXPECTED_FILE_1_COMPONENT "foo") -set(EXPECTED_FILE_CONTENT_1_LIST "/usr;/usr/foo;/usr/foo/CMakeLists.txt") +set(EXPECTED_FILE_CONTENT_1_LIST "/foo;/foo/CMakeLists.txt") set(EXPECTED_FILE_2_COMPONENT "bar") -set(EXPECTED_FILE_CONTENT_2_LIST "/usr;/usr/bar;/usr/bar/CMakeLists.txt") +set(EXPECTED_FILE_CONTENT_2_LIST "/bar;/bar/CMakeLists.txt") diff --git a/Tests/RunCMake/CPack/tests/LONG_FILENAMES/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/LONG_FILENAMES/ExpectedFiles.cmake index 631d957..4cb8dd0 100644 --- a/Tests/RunCMake/CPack/tests/LONG_FILENAMES/ExpectedFiles.cmake +++ b/Tests/RunCMake/CPack/tests/LONG_FILENAMES/ExpectedFiles.cmake @@ -1,3 +1,3 @@ set(EXPECTED_FILES_COUNT "1") set(EXPECTED_FILES_NAME_GENERATOR_SPECIFIC_FORMAT TRUE) -set(EXPECTED_FILE_CONTENT_1_LIST "/usr;/usr/foo;/usr/foo/llllllllll_oooooooooo_nnnnnnnnnn_gggggggggg_ffffffffff_iiiiiiiiii_llllllllll_eeeeeeeeee_nnnnnnnnnn_aaaaaaaaaa_mmmmmmmmmm_eeeeeeeeee.txt") +set(EXPECTED_FILE_CONTENT_1_LIST "/foo;/foo/llllllllll_oooooooooo_nnnnnnnnnn_gggggggggg_ffffffffff_iiiiiiiiii_llllllllll_eeeeeeeeee_nnnnnnnnnn_aaaaaaaaaa_mmmmmmmmmm_eeeeeeeeee.txt") diff --git a/Tests/RunCMake/CPack/tests/MAIN_COMPONENT/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/MAIN_COMPONENT/ExpectedFiles.cmake index 6bfb0c1..629be9e 100644 --- a/Tests/RunCMake/CPack/tests/MAIN_COMPONENT/ExpectedFiles.cmake +++ b/Tests/RunCMake/CPack/tests/MAIN_COMPONENT/ExpectedFiles.cmake @@ -3,9 +3,9 @@ set(EXPECTED_FILES_COUNT "0") if(NOT RunCMake_SUBTEST_SUFFIX STREQUAL "invalid") set(EXPECTED_FILES_COUNT "3") set(EXPECTED_FILE_1 "main_component-0.1.1-1.*.rpm") - set(EXPECTED_FILE_CONTENT_1_LIST "/usr;/usr/foo;/usr/foo/CMakeLists.txt") + set(EXPECTED_FILE_CONTENT_1_LIST "/foo;/foo/CMakeLists.txt") set(EXPECTED_FILE_2_COMPONENT "headers") - set(EXPECTED_FILE_CONTENT_2_LIST "/usr;/usr/bar;/usr/bar/CMakeLists.txt") + set(EXPECTED_FILE_CONTENT_2_LIST "/bar;/bar/CMakeLists.txt") set(EXPECTED_FILE_3_COMPONENT "libs") - set(EXPECTED_FILE_CONTENT_3_LIST "/usr;/usr/bas;/usr/bas/CMakeLists.txt") + set(EXPECTED_FILE_CONTENT_3_LIST "/bas;/bas/CMakeLists.txt") endif() diff --git a/Tests/RunCMake/CPack/tests/MD5SUMS/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/MD5SUMS/ExpectedFiles.cmake index 6142eb3..d1a3a5f 100644 --- a/Tests/RunCMake/CPack/tests/MD5SUMS/ExpectedFiles.cmake +++ b/Tests/RunCMake/CPack/tests/MD5SUMS/ExpectedFiles.cmake @@ -1,2 +1,2 @@ set(EXPECTED_FILES_COUNT "1") -set(EXPECTED_FILE_CONTENT_1_LIST "/usr;/usr/foo;/usr/foo/CMakeLists.txt") +set(EXPECTED_FILE_CONTENT_1_LIST "/foo;/foo/CMakeLists.txt") diff --git a/Tests/RunCMake/CPack/tests/MINIMAL/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/MINIMAL/ExpectedFiles.cmake index 6142eb3..d1a3a5f 100644 --- a/Tests/RunCMake/CPack/tests/MINIMAL/ExpectedFiles.cmake +++ b/Tests/RunCMake/CPack/tests/MINIMAL/ExpectedFiles.cmake @@ -1,2 +1,2 @@ set(EXPECTED_FILES_COUNT "1") -set(EXPECTED_FILE_CONTENT_1_LIST "/usr;/usr/foo;/usr/foo/CMakeLists.txt") +set(EXPECTED_FILE_CONTENT_1_LIST "/foo;/foo/CMakeLists.txt") diff --git a/Tests/RunCMake/CPack/tests/PACKAGE_CHECKSUM/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/PACKAGE_CHECKSUM/ExpectedFiles.cmake index eed5b92..c375aca 100644 --- a/Tests/RunCMake/CPack/tests/PACKAGE_CHECKSUM/ExpectedFiles.cmake +++ b/Tests/RunCMake/CPack/tests/PACKAGE_CHECKSUM/ExpectedFiles.cmake @@ -2,5 +2,5 @@ set(EXPECTED_FILES_COUNT "0") if(NOT ${RunCMake_SUBTEST_SUFFIX} MATCHES "invalid") set(EXPECTED_FILES_COUNT "1") - set(EXPECTED_FILE_CONTENT_1_LIST "/usr;/usr/foo;/usr/foo/CMakeLists.txt") + set(EXPECTED_FILE_CONTENT_1_LIST "/foo;/foo/CMakeLists.txt") endif() diff --git a/Tests/RunCMake/CPack/tests/PARTIALLY_RELOCATABLE_WARNING/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/PARTIALLY_RELOCATABLE_WARNING/ExpectedFiles.cmake index ae58c4b..137da47 100644 --- a/Tests/RunCMake/CPack/tests/PARTIALLY_RELOCATABLE_WARNING/ExpectedFiles.cmake +++ b/Tests/RunCMake/CPack/tests/PARTIALLY_RELOCATABLE_WARNING/ExpectedFiles.cmake @@ -1,2 +1,4 @@ set(EXPECTED_FILES_COUNT "1") +# don't set the prefix here as we have absolute paths that should not be prefixed +set(EXPECTED_FILE_PACKAGING_PREFIX "") set(EXPECTED_FILE_CONTENT_1_LIST "/not_relocatable;/not_relocatable/CMakeLists.txt;/opt") diff --git a/Tests/RunCMake/CPack/tests/PER_COMPONENT_FIELDS/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/PER_COMPONENT_FIELDS/ExpectedFiles.cmake index 9bdb176..26fa1df 100644 --- a/Tests/RunCMake/CPack/tests/PER_COMPONENT_FIELDS/ExpectedFiles.cmake +++ b/Tests/RunCMake/CPack/tests/PER_COMPONENT_FIELDS/ExpectedFiles.cmake @@ -1,8 +1,8 @@ set(EXPECTED_FILES_COUNT "3") set(EXPECTED_FILES_NAME_GENERATOR_SPECIFIC_FORMAT TRUE) set(EXPECTED_FILE_1_COMPONENT "pkg_1") -set(EXPECTED_FILE_CONTENT_1_LIST "/usr;/usr/foo;/usr/foo/CMakeLists.txt") +set(EXPECTED_FILE_CONTENT_1_LIST "/foo;/foo/CMakeLists.txt") set(EXPECTED_FILE_2_NAME "second") -set(EXPECTED_FILE_CONTENT_2_LIST "/usr;/usr/foo;/usr/foo/CMakeLists.txt") +set(EXPECTED_FILE_CONTENT_2_LIST "/foo;/foo/CMakeLists.txt") set(EXPECTED_FILE_3_COMPONENT "pkg_3") -set(EXPECTED_FILE_CONTENT_3_LIST "/usr;/usr/foo;/usr/foo/CMakeLists.txt") +set(EXPECTED_FILE_CONTENT_3_LIST "/foo;/foo/CMakeLists.txt") diff --git a/Tests/RunCMake/CPack/tests/SINGLE_DEBUGINFO/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/SINGLE_DEBUGINFO/ExpectedFiles.cmake index ca866ea..8170d39 100644 --- a/Tests/RunCMake/CPack/tests/SINGLE_DEBUGINFO/ExpectedFiles.cmake +++ b/Tests/RunCMake/CPack/tests/SINGLE_DEBUGINFO/ExpectedFiles.cmake @@ -5,25 +5,25 @@ set(EXPECTED_FILES_NAME_GENERATOR_SPECIFIC_FORMAT TRUE) if(RunCMake_SUBTEST_SUFFIX STREQUAL "valid" OR RunCMake_SUBTEST_SUFFIX STREQUAL "no_debuginfo") set(EXPECTED_FILES_COUNT "4") set(EXPECTED_FILE_1 "single_debuginfo-0.1.1-1.*.rpm") - set(EXPECTED_FILE_CONTENT_1_LIST "/usr;/usr/foo;/usr/foo/test_prog") + set(EXPECTED_FILE_CONTENT_1_LIST "/foo;/foo/test_prog") set(EXPECTED_FILE_2 "single_debuginfo*-headers.rpm") - set(EXPECTED_FILE_CONTENT_2_LIST "/usr;/usr/bar;/usr/bar/CMakeLists.txt") + set(EXPECTED_FILE_CONTENT_2_LIST "/bar;/bar/CMakeLists.txt") set(EXPECTED_FILE_3 "single_debuginfo*-libs.rpm") - set(EXPECTED_FILE_CONTENT_3_LIST "/usr;/usr/bas;/usr/bas/libtest_lib.so") + set(EXPECTED_FILE_CONTENT_3_LIST "/bas;/bas/libtest_lib.so") set(EXPECTED_FILE_4_COMPONENT "debuginfo") set(EXPECTED_FILE_CONTENT_4 ".*/src${whitespaces_}/src/src_1${whitespaces_}/src/src_1/main.cpp${whitespaces_}/src/src_1/test_lib.cpp.*") elseif(RunCMake_SUBTEST_SUFFIX STREQUAL "one_component" OR RunCMake_SUBTEST_SUFFIX STREQUAL "one_component_no_debuginfo") set(EXPECTED_FILES_COUNT "2") set(EXPECTED_FILE_1 "single_debuginfo-0*-applications.rpm") - set(EXPECTED_FILE_CONTENT_1_LIST "/usr;/usr/foo;/usr/foo/test_prog") + set(EXPECTED_FILE_CONTENT_1_LIST "/foo;/foo/test_prog") set(EXPECTED_FILE_2 "single_debuginfo-applications-debuginfo*.rpm") set(EXPECTED_FILE_CONTENT_2 ".*/src${whitespaces_}/src/src_1${whitespaces_}/src/src_1/main.cpp.*") elseif(RunCMake_SUBTEST_SUFFIX STREQUAL "one_component_main" OR RunCMake_SUBTEST_SUFFIX STREQUAL "no_components") set(EXPECTED_FILES_COUNT "2") set(EXPECTED_FILE_1 "single_debuginfo-0*.rpm") - set(EXPECTED_FILE_CONTENT_1_LIST "/usr;/usr/foo;/usr/foo/test_prog") + set(EXPECTED_FILE_CONTENT_1_LIST "/foo;/foo/test_prog") set(EXPECTED_FILE_2 "single_debuginfo-debuginfo*.rpm") set(EXPECTED_FILE_CONTENT_2 ".*/src${whitespaces_}/src/src_1${whitespaces_}/src/src_1/main.cpp.*") diff --git a/Tests/RunCMake/CPack/tests/SOURCE_PACKAGE/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/SOURCE_PACKAGE/ExpectedFiles.cmake index 0a3e426..d78f222 100644 --- a/Tests/RunCMake/CPack/tests/SOURCE_PACKAGE/ExpectedFiles.cmake +++ b/Tests/RunCMake/CPack/tests/SOURCE_PACKAGE/ExpectedFiles.cmake @@ -1,2 +1,3 @@ set(EXPECTED_FILES_COUNT "1") +set(EXPECTED_FILE_PACKAGING_PREFIX "") set(EXPECTED_FILE_CONTENT_1_LIST "source_package-0.1.1.tar.gz;source_package.spec") diff --git a/Tests/RunCMake/CPack/tests/SUGGESTS/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/SUGGESTS/ExpectedFiles.cmake index 6142eb3..d1a3a5f 100644 --- a/Tests/RunCMake/CPack/tests/SUGGESTS/ExpectedFiles.cmake +++ b/Tests/RunCMake/CPack/tests/SUGGESTS/ExpectedFiles.cmake @@ -1,2 +1,2 @@ set(EXPECTED_FILES_COUNT "1") -set(EXPECTED_FILE_CONTENT_1_LIST "/usr;/usr/foo;/usr/foo/CMakeLists.txt") +set(EXPECTED_FILE_CONTENT_1_LIST "/foo;/foo/CMakeLists.txt") diff --git a/Tests/RunCMake/CPack/tests/SYMLINKS/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/SYMLINKS/ExpectedFiles.cmake index 05be748..e8281a8 100644 --- a/Tests/RunCMake/CPack/tests/SYMLINKS/ExpectedFiles.cmake +++ b/Tests/RunCMake/CPack/tests/SYMLINKS/ExpectedFiles.cmake @@ -1,12 +1,11 @@ set(EXPECTED_FILES_COUNT "1") set(EXPECTED_FILE_CONTENT_1_LIST - "/usr" - "/usr/empty_dir" - "/usr/non_empty_dir" - "/usr/non_empty_dir/CMakeLists.txt" - "/usr/symlink_to_empty_dir" - "/usr/symlink_to_non_empty_dir") + "/empty_dir" + "/non_empty_dir" + "/non_empty_dir/CMakeLists.txt" + "/symlink_to_empty_dir" + "/symlink_to_non_empty_dir") if(PACKAGING_TYPE STREQUAL "COMPONENT") set(EXPECTED_FILE_1_COMPONENT "links") diff --git a/Tests/RunCMake/CPack/tests/USER_FILELIST/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/USER_FILELIST/ExpectedFiles.cmake index aabe537..8420986 100644 --- a/Tests/RunCMake/CPack/tests/USER_FILELIST/ExpectedFiles.cmake +++ b/Tests/RunCMake/CPack/tests/USER_FILELIST/ExpectedFiles.cmake @@ -1,2 +1,2 @@ set(EXPECTED_FILES_COUNT "1") -set(EXPECTED_FILE_CONTENT_1_LIST "/usr/one;/usr/one/foo.txt;/usr/one/two;/usr/one/two/bar.txt;/usr/three;/usr/three/baz.txt;/usr/three/qux.txt") +set(EXPECTED_FILE_CONTENT_1_LIST "/one;/one/foo.txt;/one/two;/one/two/bar.txt;/three;/three/baz.txt;/three/qux.txt") diff --git a/Tests/RunCMake/CPack/tests/VERSION/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/VERSION/ExpectedFiles.cmake index 85c571c..372f71b 100644 --- a/Tests/RunCMake/CPack/tests/VERSION/ExpectedFiles.cmake +++ b/Tests/RunCMake/CPack/tests/VERSION/ExpectedFiles.cmake @@ -1,3 +1,3 @@ set(EXPECTED_FILES_COUNT "1") -set(EXPECTED_FILE_CONTENT_1_LIST "/usr;/usr/foo;/usr/foo/CMakeLists.txt") +set(EXPECTED_FILE_CONTENT_1_LIST "/foo;/foo/CMakeLists.txt") set(EXPECTED_FILE_1_REVISION "1") diff --git a/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileOptions-result.txt b/Tests/RunCMake/CheckModules/CheckIncludeFilesMissingLanguage-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileOptions-result.txt +++ b/Tests/RunCMake/CheckModules/CheckIncludeFilesMissingLanguage-result.txt diff --git a/Tests/RunCMake/CheckModules/CheckIncludeFilesMissingLanguage-stderr.txt b/Tests/RunCMake/CheckModules/CheckIncludeFilesMissingLanguage-stderr.txt new file mode 100644 index 0000000..36c28f9 --- /dev/null +++ b/Tests/RunCMake/CheckModules/CheckIncludeFilesMissingLanguage-stderr.txt @@ -0,0 +1,8 @@ +CMake Error at .*/Modules/CheckIncludeFiles.cmake:[0-9]+. \(message\): + No languages listed for LANGUAGE option. + + Supported languages: C, CXX. + +Call Stack \(most recent call first\): + CheckIncludeFilesMissingLanguage.cmake:[0-9]+ \(check_include_files\) + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/CheckModules/CheckIncludeFilesMissingLanguage.cmake b/Tests/RunCMake/CheckModules/CheckIncludeFilesMissingLanguage.cmake new file mode 100644 index 0000000..59accb0 --- /dev/null +++ b/Tests/RunCMake/CheckModules/CheckIncludeFilesMissingLanguage.cmake @@ -0,0 +1,3 @@ +enable_language(C) +include(CheckIncludeFiles) +check_include_files("stddef.h;stdlib.h" HAVE_MISSING_ARGUMENT_H LANGUAGE) diff --git a/Tests/RunCMake/CheckModules/CheckIncludeFilesOk.cmake b/Tests/RunCMake/CheckModules/CheckIncludeFilesOk.cmake new file mode 100644 index 0000000..0891ec6 --- /dev/null +++ b/Tests/RunCMake/CheckModules/CheckIncludeFilesOk.cmake @@ -0,0 +1,6 @@ +enable_language(C) +enable_language(CXX) +include(CheckIncludeFiles) +check_include_files("stddef.h;stdlib.h" HAVE_STDLIB_H) +check_include_files("stddef.h;stdlib.h" HAVE_STDLIB_H2 LANGUAGE C) +check_include_files("cstddef;cstdlib" HAVE_CSTDLIB_H LANGUAGE CXX) diff --git a/Tests/RunCMake/CheckModules/CheckIncludeFilesOkNoC.cmake b/Tests/RunCMake/CheckModules/CheckIncludeFilesOkNoC.cmake new file mode 100644 index 0000000..a1d2843 --- /dev/null +++ b/Tests/RunCMake/CheckModules/CheckIncludeFilesOkNoC.cmake @@ -0,0 +1,4 @@ +enable_language(CXX) +include(CheckIncludeFiles) +check_include_files("cstddef;cstdlib" HAVE_CSTDLIB_H3 LANGUAGE CXX) +check_include_files("cstddef;cstdlib" HAVE_CSTDLIB_H4) diff --git a/Tests/RunCMake/CheckModules/CheckIncludeFilesUnknownArgument-result.txt b/Tests/RunCMake/CheckModules/CheckIncludeFilesUnknownArgument-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CheckModules/CheckIncludeFilesUnknownArgument-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CheckModules/CheckIncludeFilesUnknownArgument-stderr.txt b/Tests/RunCMake/CheckModules/CheckIncludeFilesUnknownArgument-stderr.txt new file mode 100644 index 0000000..098da79 --- /dev/null +++ b/Tests/RunCMake/CheckModules/CheckIncludeFilesUnknownArgument-stderr.txt @@ -0,0 +1,8 @@ +CMake Error at .*/Modules/CheckIncludeFiles.cmake:[0-9]+. \(message\): + Unknown arguments: + + FOOBAR + +Call Stack \(most recent call first\): + CheckIncludeFilesUnknownArgument.cmake:[0-9]+ \(check_include_files\) + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/CheckModules/CheckIncludeFilesUnknownArgument.cmake b/Tests/RunCMake/CheckModules/CheckIncludeFilesUnknownArgument.cmake new file mode 100644 index 0000000..dfc2b93 --- /dev/null +++ b/Tests/RunCMake/CheckModules/CheckIncludeFilesUnknownArgument.cmake @@ -0,0 +1,3 @@ +enable_language(C) +include(CheckIncludeFiles) +check_include_files("stddef.h;stdlib.h" HAVE_UNKNOWN_ARGUMENT_H FOOBAR) diff --git a/Tests/RunCMake/CheckModules/CheckIncludeFilesUnknownLanguage-result.txt b/Tests/RunCMake/CheckModules/CheckIncludeFilesUnknownLanguage-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CheckModules/CheckIncludeFilesUnknownLanguage-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CheckModules/CheckIncludeFilesUnknownLanguage-stderr.txt b/Tests/RunCMake/CheckModules/CheckIncludeFilesUnknownLanguage-stderr.txt new file mode 100644 index 0000000..5d4a9ec --- /dev/null +++ b/Tests/RunCMake/CheckModules/CheckIncludeFilesUnknownLanguage-stderr.txt @@ -0,0 +1,10 @@ +CMake Error at .*/Modules/CheckIncludeFiles.cmake:[0-9]+. \(message\): + Unknown language: + + FOOBAR + + Supported languages: C, CXX. + +Call Stack \(most recent call first\): + CheckIncludeFilesUnknownLanguage.cmake:[0-9]+ \(check_include_files\) + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/CheckModules/CheckIncludeFilesUnknownLanguage.cmake b/Tests/RunCMake/CheckModules/CheckIncludeFilesUnknownLanguage.cmake new file mode 100644 index 0000000..3a77cf9 --- /dev/null +++ b/Tests/RunCMake/CheckModules/CheckIncludeFilesUnknownLanguage.cmake @@ -0,0 +1,3 @@ +enable_language(C) +include(CheckIncludeFiles) +check_include_files("stddef.h;stdlib.h" HAVE_UNKNOWN_ARGUMENT_H LANGUAGE FOOBAR) diff --git a/Tests/RunCMake/CheckModules/RunCMakeTest.cmake b/Tests/RunCMake/CheckModules/RunCMakeTest.cmake index 5b4e57e..c5aaa64 100644 --- a/Tests/RunCMake/CheckModules/RunCMakeTest.cmake +++ b/Tests/RunCMake/CheckModules/RunCMakeTest.cmake @@ -14,3 +14,9 @@ run_cmake(CheckTypeSizeUnknownArgument) run_cmake(CheckTypeSizeMixedArgs) run_cmake(CheckTypeSizeOkNoC) + +run_cmake(CheckIncludeFilesOk) +run_cmake(CheckIncludeFilesOkNoC) +run_cmake(CheckIncludeFilesMissingLanguage) +run_cmake(CheckIncludeFilesUnknownArgument) +run_cmake(CheckIncludeFilesUnknownLanguage) diff --git a/Tests/RunCMake/CompilerLauncher/Fortran-Build-stdout.txt b/Tests/RunCMake/CompilerLauncher/Fortran-Build-stdout.txt new file mode 100644 index 0000000..3313e31 --- /dev/null +++ b/Tests/RunCMake/CompilerLauncher/Fortran-Build-stdout.txt @@ -0,0 +1 @@ +.*-E env USED_LAUNCHER=1.* diff --git a/Tests/RunCMake/CompilerLauncher/Fortran-launch-Build-stdout.txt b/Tests/RunCMake/CompilerLauncher/Fortran-launch-Build-stdout.txt new file mode 100644 index 0000000..3313e31 --- /dev/null +++ b/Tests/RunCMake/CompilerLauncher/Fortran-launch-Build-stdout.txt @@ -0,0 +1 @@ +.*-E env USED_LAUNCHER=1.* diff --git a/Tests/RunCMake/CompilerLauncher/Fortran-launch.cmake b/Tests/RunCMake/CompilerLauncher/Fortran-launch.cmake new file mode 100644 index 0000000..7e9a564 --- /dev/null +++ b/Tests/RunCMake/CompilerLauncher/Fortran-launch.cmake @@ -0,0 +1,3 @@ +set(CTEST_USE_LAUNCHERS 1) +include(CTestUseLaunchers) +include(Fortran.cmake) diff --git a/Tests/RunCMake/CompilerLauncher/Fortran.cmake b/Tests/RunCMake/CompilerLauncher/Fortran.cmake new file mode 100644 index 0000000..72cc03e --- /dev/null +++ b/Tests/RunCMake/CompilerLauncher/Fortran.cmake @@ -0,0 +1,4 @@ +enable_language(Fortran) +set(CMAKE_Fortran_COMPILER_LAUNCHER "${CMAKE_COMMAND};-E;env;USED_LAUNCHER=1") +set(CMAKE_VERBOSE_MAKEFILE TRUE) +add_executable(main main.F) diff --git a/Tests/RunCMake/CompilerLauncher/RunCMakeTest.cmake b/Tests/RunCMake/CompilerLauncher/RunCMakeTest.cmake index ab26512..bb8da03 100644 --- a/Tests/RunCMake/CompilerLauncher/RunCMakeTest.cmake +++ b/Tests/RunCMake/CompilerLauncher/RunCMakeTest.cmake @@ -19,6 +19,9 @@ set(langs C CXX) if(CMake_TEST_CUDA) list(APPEND langs CUDA) endif() +if(CMake_TEST_Fortran) + list(APPEND langs Fortran) +endif() foreach(lang ${langs}) run_compiler_launcher(${lang}) diff --git a/Tests/RunCMake/CompilerLauncher/main.F b/Tests/RunCMake/CompilerLauncher/main.F new file mode 100644 index 0000000..53ec0d1 --- /dev/null +++ b/Tests/RunCMake/CompilerLauncher/main.F @@ -0,0 +1,2 @@ + PROGRAM MAIN + END diff --git a/Tests/RunCMake/File_Generate/COMPILE_LANGUAGE-genex-result.txt b/Tests/RunCMake/File_Generate/COMPILE_LANGUAGE-genex-result.txt deleted file mode 100644 index 573541a..0000000 --- a/Tests/RunCMake/File_Generate/COMPILE_LANGUAGE-genex-result.txt +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/Tests/RunCMake/File_Generate/COMPILE_LANGUAGE-genex.cmake b/Tests/RunCMake/File_Generate/COMPILE_LANGUAGE-genex.cmake index 59ccf19..bead2af 100644 --- a/Tests/RunCMake/File_Generate/COMPILE_LANGUAGE-genex.cmake +++ b/Tests/RunCMake/File_Generate/COMPILE_LANGUAGE-genex.cmake @@ -1,12 +1,6 @@ - enable_language(CXX C) -add_library(empty empty.cpp empty.c) -target_compile_options(empty - PRIVATE LANG_IS_$<COMPILE_LANGUAGE> -) - file(GENERATE OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/opts-$<COMPILE_LANGUAGE>.txt - CONTENT "$<TARGET_PROPERTY:empty,COMPILE_OPTIONS>\n" + CONTENT "LANG_IS_$<COMPILE_LANGUAGE>\n" ) diff --git a/Tests/RunCMake/File_Generate/CarryPermissions-result.txt b/Tests/RunCMake/File_Generate/CarryPermissions-result.txt deleted file mode 100644 index 573541a..0000000 --- a/Tests/RunCMake/File_Generate/CarryPermissions-result.txt +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/Tests/RunCMake/File_Generate/GenerateSource-result.txt b/Tests/RunCMake/File_Generate/GenerateSource-result.txt deleted file mode 100644 index 573541a..0000000 --- a/Tests/RunCMake/File_Generate/GenerateSource-result.txt +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/Tests/RunCMake/File_Generate/OutputNameMatchesOtherSources-result.txt b/Tests/RunCMake/File_Generate/OutputNameMatchesOtherSources-result.txt deleted file mode 100644 index 573541a..0000000 --- a/Tests/RunCMake/File_Generate/OutputNameMatchesOtherSources-result.txt +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/Tests/RunCMake/File_Generate/ReRunCMake-result.txt b/Tests/RunCMake/File_Generate/ReRunCMake-result.txt deleted file mode 100644 index 573541a..0000000 --- a/Tests/RunCMake/File_Generate/ReRunCMake-result.txt +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/Tests/RunCMake/File_Generate/RunCMakeTest.cmake b/Tests/RunCMake/File_Generate/RunCMakeTest.cmake index b660463..616e210 100644 --- a/Tests/RunCMake/File_Generate/RunCMakeTest.cmake +++ b/Tests/RunCMake/File_Generate/RunCMakeTest.cmake @@ -21,15 +21,13 @@ if (NOT file_contents MATCHES "generated.cpp.rule") message(SEND_ERROR "Rule file not in target sources! ${file_contents}") endif() -if (NOT RunCMake_GENERATOR MATCHES "Visual Studio") - run_cmake(COMPILE_LANGUAGE-genex) - foreach(l CXX C) - file(READ "${RunCMake_BINARY_DIR}/COMPILE_LANGUAGE-genex-build/opts-${l}.txt" l_defs) - if (NOT l_defs STREQUAL "LANG_IS_${l}\n") - message(FATAL_ERROR "File content does not match: ${l_defs}") - endif() - endforeach() -endif() +run_cmake(COMPILE_LANGUAGE-genex) +foreach(l CXX C) + file(READ "${RunCMake_BINARY_DIR}/COMPILE_LANGUAGE-genex-build/opts-${l}.txt" l_defs) + if (NOT l_defs STREQUAL "LANG_IS_${l}\n") + message(FATAL_ERROR "File content does not match: ${l_defs}") + endif() +endforeach() set(timeformat "%Y%j%H%M%S") diff --git a/Tests/RunCMake/File_Generate/WriteIfDifferent-result.txt b/Tests/RunCMake/File_Generate/WriteIfDifferent-result.txt deleted file mode 100644 index 573541a..0000000 --- a/Tests/RunCMake/File_Generate/WriteIfDifferent-result.txt +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/Tests/RunCMake/FindOpenGL/CMP0072-NEW-stdout.txt b/Tests/RunCMake/FindOpenGL/CMP0072-NEW-stdout.txt new file mode 100644 index 0000000..f5ee220 --- /dev/null +++ b/Tests/RunCMake/FindOpenGL/CMP0072-NEW-stdout.txt @@ -0,0 +1,3 @@ +-- OpenGL_GL_PREFERENCE='GLVND' +-- OPENGL_gl_LIBRARY='' +-- OPENGL_LIBRARIES='OpenGL;GLX;GLU' diff --git a/Tests/RunCMake/FindOpenGL/CMP0072-NEW.cmake b/Tests/RunCMake/FindOpenGL/CMP0072-NEW.cmake new file mode 100644 index 0000000..6cbbeec --- /dev/null +++ b/Tests/RunCMake/FindOpenGL/CMP0072-NEW.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0072 NEW) +include(CMP0072-common.cmake) diff --git a/Tests/RunCMake/FindOpenGL/CMP0072-OLD-stdout.txt b/Tests/RunCMake/FindOpenGL/CMP0072-OLD-stdout.txt new file mode 100644 index 0000000..22df1b1 --- /dev/null +++ b/Tests/RunCMake/FindOpenGL/CMP0072-OLD-stdout.txt @@ -0,0 +1,3 @@ +-- OpenGL_GL_PREFERENCE='LEGACY' +-- OPENGL_gl_LIBRARY='GL' +-- OPENGL_LIBRARIES='GL;GLU' diff --git a/Tests/RunCMake/FindOpenGL/CMP0072-OLD.cmake b/Tests/RunCMake/FindOpenGL/CMP0072-OLD.cmake new file mode 100644 index 0000000..6d57004 --- /dev/null +++ b/Tests/RunCMake/FindOpenGL/CMP0072-OLD.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0072 OLD) +include(CMP0072-common.cmake) diff --git a/Tests/RunCMake/FindOpenGL/CMP0072-WARN-stderr.txt b/Tests/RunCMake/FindOpenGL/CMP0072-WARN-stderr.txt new file mode 100644 index 0000000..f26f217 --- /dev/null +++ b/Tests/RunCMake/FindOpenGL/CMP0072-WARN-stderr.txt @@ -0,0 +1,21 @@ +^CMake Warning \(dev\) at .*/Modules/FindOpenGL.cmake:[0-9]+ \(message\): + Policy CMP0072 is not set: FindOpenGL prefers GLVND by default when + available. Run "cmake --help-policy CMP0072" for policy details. Use the + cmake_policy command to set the policy and suppress this warning. + + FindOpenGL found both a legacy GL library: + + OPENGL_gl_LIBRARY: GL + + and GLVND libraries for OpenGL and GLX: + + OPENGL_opengl_LIBRARY: OpenGL + OPENGL_glx_LIBRARY: GLX + + OpenGL_GL_PREFERENCE has not been set to "GLVND" or "LEGACY", so for + compatibility with CMake 3.10 and below the legacy GL library will be used. +Call Stack \(most recent call first\): + CMP0072-common.cmake:[0-9]+ \(find_package\) + CMP0072-WARN.cmake:[0-9]+ \(include\) + CMakeLists.txt:[0-9]+ \(include\) +This warning is for project developers. Use -Wno-dev to suppress it.$ diff --git a/Tests/RunCMake/FindOpenGL/CMP0072-WARN-stdout.txt b/Tests/RunCMake/FindOpenGL/CMP0072-WARN-stdout.txt new file mode 100644 index 0000000..22df1b1 --- /dev/null +++ b/Tests/RunCMake/FindOpenGL/CMP0072-WARN-stdout.txt @@ -0,0 +1,3 @@ +-- OpenGL_GL_PREFERENCE='LEGACY' +-- OPENGL_gl_LIBRARY='GL' +-- OPENGL_LIBRARIES='GL;GLU' diff --git a/Tests/RunCMake/FindOpenGL/CMP0072-WARN.cmake b/Tests/RunCMake/FindOpenGL/CMP0072-WARN.cmake new file mode 100644 index 0000000..459c458 --- /dev/null +++ b/Tests/RunCMake/FindOpenGL/CMP0072-WARN.cmake @@ -0,0 +1 @@ +include(CMP0072-common.cmake) diff --git a/Tests/RunCMake/FindOpenGL/CMP0072-common.cmake b/Tests/RunCMake/FindOpenGL/CMP0072-common.cmake new file mode 100644 index 0000000..3fe8030 --- /dev/null +++ b/Tests/RunCMake/FindOpenGL/CMP0072-common.cmake @@ -0,0 +1,13 @@ +set(CYGWIN 0) +set(WIN32 0) +set(APPLE 0) +set(OPENGL_INCLUDE_DIR GL/include) +set(OPENGL_GLX_INCLUDE_DIR GLX/include) +set(OPENGL_gl_LIBRARY GL) +set(OPENGL_opengl_LIBRARY OpenGL) +set(OPENGL_glx_LIBRARY GLX) +set(OPENGL_glu_LIBRARY GLU) +find_package(OpenGL) +message(STATUS "OpenGL_GL_PREFERENCE='${OpenGL_GL_PREFERENCE}'") +message(STATUS "OPENGL_gl_LIBRARY='${OPENGL_gl_LIBRARY}'") +message(STATUS "OPENGL_LIBRARIES='${OPENGL_LIBRARIES}'") diff --git a/Tests/RunCMake/FindOpenGL/CMakeLists.txt b/Tests/RunCMake/FindOpenGL/CMakeLists.txt new file mode 100644 index 0000000..bf2ef15 --- /dev/null +++ b/Tests/RunCMake/FindOpenGL/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.10) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/FindOpenGL/RunCMakeTest.cmake b/Tests/RunCMake/FindOpenGL/RunCMakeTest.cmake new file mode 100644 index 0000000..fcc130f --- /dev/null +++ b/Tests/RunCMake/FindOpenGL/RunCMakeTest.cmake @@ -0,0 +1,5 @@ +include(RunCMake) + +run_cmake(CMP0072-WARN) +run_cmake(CMP0072-OLD) +run_cmake(CMP0072-NEW) diff --git a/Tests/RunCMake/GoogleTest/GoogleTest-test-stdout.txt b/Tests/RunCMake/GoogleTest/GoogleTest-test1-stdout.txt index 5f7753d..5f7753d 100644 --- a/Tests/RunCMake/GoogleTest/GoogleTest-test-stdout.txt +++ b/Tests/RunCMake/GoogleTest/GoogleTest-test1-stdout.txt diff --git a/Tests/RunCMake/GoogleTest/GoogleTest-test2-stdout.txt b/Tests/RunCMake/GoogleTest/GoogleTest-test2-stdout.txt new file mode 100644 index 0000000..960c0b9 --- /dev/null +++ b/Tests/RunCMake/GoogleTest/GoogleTest-test2-stdout.txt @@ -0,0 +1,25 @@ +Test project .* + Start 9: TEST:basic\.case_foo!2 +1/8 Test #9: TEST:basic\.case_foo!2 \.+ +Passed +[0-9.]+ sec + Start 10: TEST:basic\.case_bar!2 +2/8 Test #10: TEST:basic\.case_bar!2 \.+ +Passed +[0-9.]+ sec + Start 11: TEST:basic\.disabled_case!2 +3/8 Test #11: TEST:basic\.disabled_case!2 \.+\*+Not Run \(Disabled\) +[0-9.]+ sec + Start 12: TEST:disabled\.case!2 +4/8 Test #12: TEST:disabled\.case!2 \.+\*+Not Run \(Disabled\) +[0-9.]+ sec + Start 13: TEST:typed/short\.case!2 +5/8 Test #13: TEST:typed/short\.case!2 \.+ +Passed +[0-9.]+ sec + Start 14: TEST:typed/float\.case!2 +6/8 Test #14: TEST:typed/float\.case!2 \.+ +Passed +[0-9.]+ sec + Start 15: TEST:value/test\.case/1!2 +7/8 Test #15: TEST:value/test\.case/1!2 \.+ +Passed +[0-9.]+ sec + Start 16: TEST:value/test\.case/"foo"!2 +8/8 Test #16: TEST:value/test\.case/"foo"!2 \.+ +Passed +[0-9.]+ sec + +100% tests passed, 0 tests failed out of 6 + +Total Test time \(real\) = +[0-9.]+ sec + +The following tests did not run: +.*11 - TEST:basic\.disabled_case!2 \(Disabled\) +.*12 - TEST:disabled\.case!2 \(Disabled\) diff --git a/Tests/RunCMake/GoogleTest/GoogleTest.cmake b/Tests/RunCMake/GoogleTest/GoogleTest.cmake index 9a3677f..58f4196 100644 --- a/Tests/RunCMake/GoogleTest/GoogleTest.cmake +++ b/Tests/RunCMake/GoogleTest/GoogleTest.cmake @@ -11,5 +11,13 @@ gtest_discover_tests( TEST_PREFIX TEST: TEST_SUFFIX !1 EXTRA_ARGS how now "\"brown\" cow" - PROPERTIES LABELS TEST + PROPERTIES LABELS TEST1 +) + +gtest_discover_tests( + fake_gtest + TEST_PREFIX TEST: + TEST_SUFFIX !2 + EXTRA_ARGS how now "\"brown\" cow" + PROPERTIES LABELS TEST2 ) diff --git a/Tests/RunCMake/GoogleTest/RunCMakeTest.cmake b/Tests/RunCMake/GoogleTest/RunCMakeTest.cmake index aec8568..b79af26 100644 --- a/Tests/RunCMake/GoogleTest/RunCMakeTest.cmake +++ b/Tests/RunCMake/GoogleTest/RunCMakeTest.cmake @@ -15,10 +15,16 @@ function(run_GoogleTest) --build . --config Debug ) - run_cmake_command(GoogleTest-test + run_cmake_command(GoogleTest-test1 ${CMAKE_CTEST_COMMAND} -C Debug - -L TEST + -L TEST1 + --no-label-summary + ) + run_cmake_command(GoogleTest-test2 + ${CMAKE_CTEST_COMMAND} + -C Debug + -L TEST2 --no-label-summary ) endfunction() diff --git a/Tests/RunCMake/ctest_fixtures/CMakeLists.txt.in b/Tests/RunCMake/ctest_fixtures/CMakeLists.txt.in index 5cb0b4e..6b11cff 100644 --- a/Tests/RunCMake/ctest_fixtures/CMakeLists.txt.in +++ b/Tests/RunCMake/ctest_fixtures/CMakeLists.txt.in @@ -27,7 +27,11 @@ passTest(two) # 6 passTest(cleanupBar) # 7 passTest(three) # 8 failTest(setupFails) # 9 -passTest(wontRun) # 10 + +# Special case, test executable always missing to verify fixture dependencies +# are checked before existence of test executable to be run +add_test(NAME wontRun COMMAND iDoNotExist) # 10 + passTest(cyclicSetup) # 11 passTest(cyclicCleanup) # 12 passTest(cleanupUnused) # 13 |