diff options
Diffstat (limited to 'Tests')
293 files changed, 2099 insertions, 353 deletions
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 8865063..d95a5f4 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -17,8 +17,6 @@ macro(ADD_TEST_MACRO NAME COMMAND) list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/${dir}") endmacro() -include(${CMAKE_CURRENT_SOURCE_DIR}/RegexEscapeString.cmake) - include(${CMAKE_CURRENT_SOURCE_DIR}/CheckFortran.cmake) # Fake a user home directory to avoid polluting the real one. @@ -260,6 +258,12 @@ if(BUILD_TESTING) ADD_TEST_MACRO(MissingSourceFile MissingSourceFile) set_tests_properties(MissingSourceFile PROPERTIES PASS_REGULAR_EXPRESSION "CMake Error at CMakeLists.txt:3 \\(add_executable\\):[ \r\n]*Cannot find source file:[ \r\n]*DoesNotExist/MissingSourceFile.c") + if(CMake_TEST_XCODE_VERSION AND NOT CMake_TEST_XCODE_VERSION VERSION_LESS 6.1) + if(CMAKE_GENERATOR STREQUAL "Xcode") + ADD_TEST_MACRO(SwiftMix SwiftMix) + ADD_TEST_MACRO(SwiftOnly SwiftOnly) + endif() + endif() if(CMAKE_Fortran_COMPILER) ADD_TEST_MACRO(FortranOnly FortranOnly) endif() @@ -2424,37 +2428,6 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release set_tests_properties(CTestTestEmptyBinaryDirectory PROPERTIES PASS_REGULAR_EXPRESSION "TEST_SUCCESS") - configure_file( - "${CMake_SOURCE_DIR}/Tests/CTestTestConfigFileInBuildDir/test1.cmake.in" - "${CMake_BINARY_DIR}/Tests/CTestTestConfigFileInBuildDir1/test1.cmake" - @ONLY ESCAPE_QUOTES) - add_test(CTestTestConfigFileInBuildDir1 ${CMAKE_CTEST_COMMAND} - -S "${CMake_BINARY_DIR}/Tests/CTestTestConfigFileInBuildDir1/test1.cmake" -V - --output-log "${CMake_BINARY_DIR}/Tests/CTestTestConfigFileInBuildDir1/testOut1.log" - ) - REGEX_ESCAPE_STRING(CTEST_TEST_ESCAPED_SOURCE_DIR "${CMake_SOURCE_DIR}") - set_tests_properties(CTestTestConfigFileInBuildDir1 PROPERTIES DEPENDS CTestTestNoBuild - PASS_REGULAR_EXPRESSION - "Reading ctest configuration file: ${CTEST_TEST_ESCAPED_SOURCE_DIR}.Tests.CTestTestConfigFileInBuildDir.CTestConfig.cmake") - - configure_file( - "${CMake_SOURCE_DIR}/Tests/CTestTestConfigFileInBuildDir/test2.cmake.in" - "${CMake_BINARY_DIR}/Tests/CTestTestConfigFileInBuildDir2/test2.cmake" - @ONLY ESCAPE_QUOTES) - configure_file( - "${CMake_SOURCE_DIR}/Tests/CTestTestConfigFileInBuildDir/CTestConfig.cmake" - "${CMake_BINARY_DIR}/Tests/CTestTestConfigFileInBuildDir2/CTestConfig.cmake" - @ONLY ESCAPE_QUOTES COPYONLY) - add_test(CTestTestConfigFileInBuildDir2 ${CMAKE_CTEST_COMMAND} - -S "${CMake_BINARY_DIR}/Tests/CTestTestConfigFileInBuildDir2/test2.cmake" -V - --output-log "${CMake_BINARY_DIR}/Tests/CTestTestConfigFileInBuildDir2/testOut2.log" - ) - REGEX_ESCAPE_STRING(CTEST_TEST_ESCAPED_BINARY_DIR "${CMake_BINARY_DIR}") - set_tests_properties(CTestTestConfigFileInBuildDir2 PROPERTIES DEPENDS CTestTestNoBuild - REQUIRED_FILES ${CMake_BINARY_DIR}/Tests/CTestTestConfigFileInBuildDir2/CTestConfig.cmake - PASS_REGULAR_EXPRESSION - "Reading ctest configuration file: ${CTEST_TEST_ESCAPED_BINARY_DIR}.Tests.CTestTestConfigFileInBuildDir2.CTestConfig.cmake") - # test coverage for mumps # create a MumpsCoverage dir in the binary tree under Testing to # avoid the .NoDartCoverage files in the cmake testing tree diff --git a/Tests/CMakeTests/GetPropertyTest.cmake.in b/Tests/CMakeTests/GetPropertyTest.cmake.in index e99193e..1ad8956 100644 --- a/Tests/CMakeTests/GetPropertyTest.cmake.in +++ b/Tests/CMakeTests/GetPropertyTest.cmake.in @@ -1,5 +1,3 @@ -include("@CMAKE_CURRENT_SOURCE_DIR@/CheckCMakeTest.cmake") - get_property(FOO_BRIEF GLOBAL PROPERTY FOO BRIEF_DOCS) get_property(FOO_FULL GLOBAL PROPERTY FOO FULL_DOCS) @@ -16,97 +14,3 @@ get_property(result VARIABLE PROPERTY test_var) if(NOT result STREQUAL "alpha") message(SEND_ERROR "bad value of VARIABLE PROPERTY test_var: got '${result}' instead of 'alpha'") endif() - -include("@CMAKE_CURRENT_SOURCE_DIR@/../RegexEscapeString.cmake") -REGEX_ESCAPE_STRING(CTEST_ESCAPED_CMAKE_CURRENT_SOURCE_DIR "@CMAKE_CURRENT_SOURCE_DIR@") - -set(Missing-Argument-RESULT 1) -set(Missing-Argument-STDERR ".*CMake Error at (${CTEST_ESCAPED_CMAKE_CURRENT_SOURCE_DIR}/)?GetProperty-Missing-Argument.cmake:1 \\(get_property\\):.*get_property called with incorrect number of arguments.*") - -check_cmake_test(GetProperty - Missing-Argument -) - -set(Bad-Scope-RESULT 1) -set(Bad-Scope-STDERR ".*CMake Error at (${CTEST_ESCAPED_CMAKE_CURRENT_SOURCE_DIR}/)?GetProperty-Bad-Scope.cmake:1 \\(get_property\\):.*get_property given invalid scope FOO\\..*") - -check_cmake_test(GetProperty - Bad-Scope -) - -set(Bad-Argument-RESULT 1) -set(Bad-Argument-STDERR ".*CMake Error at (${CTEST_ESCAPED_CMAKE_CURRENT_SOURCE_DIR}/)?GetProperty-Bad-Argument.cmake:1 \\(get_property\\):.*get_property given invalid argument \"FOO\"\\..*") - -check_cmake_test(GetProperty - Bad-Argument -) - -set(No-Property-RESULT 1) -set(No-Property-STDERR ".*CMake Error at (${CTEST_ESCAPED_CMAKE_CURRENT_SOURCE_DIR}/)?GetProperty-No-Property.cmake:1 \\(get_property\\):.*get_property not given a PROPERTY <name> argument\\..*") - -check_cmake_test(GetProperty - No-Property -) - -set(Global-Name-RESULT 1) -set(Global-Name-STDERR ".*CMake Error at (${CTEST_ESCAPED_CMAKE_CURRENT_SOURCE_DIR}/)?GetProperty-Global-Name.cmake:1 \\(get_property\\):.*get_property given name for GLOBAL scope\\..*") - -check_cmake_test(GetProperty - Global-Name -) - -set(Bad-Directory-RESULT 1) -set(Bad-Directory-STDERR ".*CMake Error at (${CTEST_ESCAPED_CMAKE_CURRENT_SOURCE_DIR}/)?GetProperty-Bad-Directory.cmake:1 \\(get_property\\):.*get_property DIRECTORY scope provided but requested directory was not.*found\\..*") - -check_cmake_test(GetProperty - Bad-Directory -) - -set(No-Target-RESULT 1) -set(No-Target-STDERR ".*CMake Error at (${CTEST_ESCAPED_CMAKE_CURRENT_SOURCE_DIR}/)?GetProperty-No-Target.cmake:1 \\(get_property\\):.*get_property not given name for TARGET scope\\..*") - -check_cmake_test(GetProperty - No-Target -) - -set(Bad-Target-RESULT 1) -set(Bad-Target-STDERR ".*CMake Error at (${CTEST_ESCAPED_CMAKE_CURRENT_SOURCE_DIR}/)?GetProperty-Bad-Target.cmake:1 \\(get_property\\):.*get_property could not find TARGET FOO\\..*") - -check_cmake_test(GetProperty - Bad-Target -) - -set(No-Source-RESULT 1) -set(No-Source-STDERR ".*CMake Error at (${CTEST_ESCAPED_CMAKE_CURRENT_SOURCE_DIR}/)?GetProperty-No-Source.cmake:1 \\(get_property\\):.*get_property not given name for SOURCE scope\\..*") - -check_cmake_test(GetProperty - No-Source -) - -set(No-Test-RESULT 1) -set(No-Test-STDERR ".*CMake Error at (${CTEST_ESCAPED_CMAKE_CURRENT_SOURCE_DIR}/)?GetProperty-No-Test.cmake:1 \\(get_property\\):.*get_property not given name for TEST scope\\..*") - -check_cmake_test(GetProperty - No-Test -) - -set(Bad-Test-RESULT 1) -set(Bad-Test-STDERR ".*CMake Error at (${CTEST_ESCAPED_CMAKE_CURRENT_SOURCE_DIR}/)?GetProperty-Bad-Test.cmake:1 \\(get_property\\):.*get_property given TEST name that does not exist: FOO.*") - -check_cmake_test(GetProperty - Bad-Test -) - -set(Variable-Name-RESULT 1) -set(Variable-Name-STDERR ".*CMake Error at (${CTEST_ESCAPED_CMAKE_CURRENT_SOURCE_DIR}/)?GetProperty-Variable-Name.cmake:1 \\(get_property\\):.*get_property given name for VARIABLE scope\\..*") - -check_cmake_test(GetProperty - Variable-Name -) - -set(No-Cache-RESULT 1) -set(No-Cache-STDERR ".*CMake Error at (${CTEST_ESCAPED_CMAKE_CURRENT_SOURCE_DIR}/)?GetProperty-No-Cache.cmake:1 \\(get_property\\):.*get_property not given name for CACHE scope\\..*") - -check_cmake_test(GetProperty - No-Cache -) diff --git a/Tests/CMakeTests/IfTest.cmake.in b/Tests/CMakeTests/IfTest.cmake.in index 74b8e32..e5211b4 100644 --- a/Tests/CMakeTests/IfTest.cmake.in +++ b/Tests/CMakeTests/IfTest.cmake.in @@ -7,9 +7,6 @@ foreach(_arg "" 0 1 2 ${TRUE_NAMES} ${FALSE_NAMES}) set(VAR_${_arg} "${_arg}") endforeach() -include("@CMAKE_CURRENT_SOURCE_DIR@/../RegexEscapeString.cmake") -REGEX_ESCAPE_STRING(CTEST_ESCAPED_CMAKE_CURRENT_SOURCE_DIR "@CMAKE_CURRENT_SOURCE_DIR@") - macro(test_vars _old) # Variables set to false or not set. foreach(_var "" 0 ${FALSE_NAMES} UNDEFINED) @@ -159,11 +156,3 @@ foreach(_bad 2x -2x) endforeach() test_vars("") - -set(Invalid-Argument-RESULT 1) -set(Invalid-Argument-STDERR ".*CMake Error at (${CTEST_ESCAPED_CMAKE_CURRENT_SOURCE_DIR}/)?If-Invalid-Argument.cmake:1 \\(if\\):.*Unknown arguments specified.*") - -include("@CMAKE_CURRENT_SOURCE_DIR@/CheckCMakeTest.cmake") -check_cmake_test(If - Invalid-Argument -) diff --git a/Tests/CMakeTests/ListTest.cmake.in b/Tests/CMakeTests/ListTest.cmake.in index 77c34a9..76f5e4f 100644 --- a/Tests/CMakeTests/ListTest.cmake.in +++ b/Tests/CMakeTests/ListTest.cmake.in @@ -1,8 +1,5 @@ include("@CMAKE_CURRENT_SOURCE_DIR@/CheckCMakeTest.cmake") -include("@CMAKE_CURRENT_SOURCE_DIR@/../RegexEscapeString.cmake") -REGEX_ESCAPE_STRING(CTEST_ESCAPED_CMAKE_CURRENT_SOURCE_DIR "@CMAKE_CURRENT_SOURCE_DIR@") - macro(TEST command expected) if("x${result}" STREQUAL "x${expected}") #message("TEST \"${command}\" success: \"${result}\" expected: \"${expected}\"") @@ -103,9 +100,6 @@ TEST("REVERSE empty result" "") list(SORT result) TEST("SORT empty result" "") -set(No-Arguments-RESULT 1) -set(No-Arguments-STDERR ".*CMake Error at (${CTEST_ESCAPED_CMAKE_CURRENT_SOURCE_DIR}/)?List-No-Arguments.cmake:1 \\(list\\):.*list must be called with at least two arguments.*") - # these trigger top-level condition foreach(cmd IN ITEMS Append Find Get Insert Length Reverse Remove_At Remove_Duplicates Remove_Item Sort) set(${cmd}-No-Arguments-RESULT 1) @@ -132,53 +126,6 @@ foreach(cmd IN ITEMS Find Get Insert Length Remove_At Remove_Item) check_cmake_test_single(List "${cmd}-List-Only" "${_test_file_name}") endforeach() -set(Length-Too-Many-Arguments-RESULT 1) -set(Length-Too-Many-Arguments-STDERR ".*CMake Error at (${CTEST_ESCAPED_CMAKE_CURRENT_SOURCE_DIR}/)?List-Length-Too-Many-Arguments.cmake:1 \\(list\\):.*list sub-command LENGTH requires two arguments.*") - -set(Reverse-Too-Many-Arguments-RESULT 1) -set(Reverse-Too-Many-Arguments-STDERR ".*CMake Error at (${CTEST_ESCAPED_CMAKE_CURRENT_SOURCE_DIR}/)?List-Reverse-Too-Many-Arguments.cmake:1 \\(list\\):.*list sub-command REVERSE only takes one argument.*") - -set(Remove_Duplicates-Too-Many-Arguments-RESULT 1) -set(Remove_Duplicates-Too-Many-Arguments-STDERR ".*CMake Error at (${CTEST_ESCAPED_CMAKE_CURRENT_SOURCE_DIR}/)?List-Remove_Duplicates-Too-Many-Arguments.cmake:1 \\(list\\):.*list sub-command REMOVE_DUPLICATES only takes one argument.*") - -set(Sort-Too-Many-Arguments-RESULT 1) -set(Sort-Too-Many-Arguments-STDERR ".*CMake Error at (${CTEST_ESCAPED_CMAKE_CURRENT_SOURCE_DIR}/)?List-Sort-Too-Many-Arguments.cmake:1 \\(list\\):.*list sub-command SORT only takes one argument.*") - -set(Invalid-Subcommand-RESULT 1) -set(Invalid-Subcommand-STDERR ".*CMake Error at (${CTEST_ESCAPED_CMAKE_CURRENT_SOURCE_DIR}/)?List-Invalid-Subcommand.cmake:1 \\(list\\):.*list does not recognize sub-command NO_SUCH_SUBCOMMAND.*") - -foreach(cmd Get Insert Remove_At) - set(${cmd}-Invalid-Index-RESULT 1) - set(${cmd}-Invalid-Index-STDERR ".*CMake Error at (${CTEST_ESCAPED_CMAKE_CURRENT_SOURCE_DIR}/)?List-${cmd}-Invalid-Index.cmake:2 \\(list\\):.*list index: 3 out of range \\(-3, 2\\).*") -endforeach() - -foreach(cmd Remove_Item Reverse Remove_Duplicates Sort Remove_At) - string(TOUPPER ${cmd} Cmd) - set(${cmd}-Nonexistent-List-RESULT 1) - set(${cmd}-Nonexistent-List-STDERR ".*CMake Error at (${CTEST_ESCAPED_CMAKE_CURRENT_SOURCE_DIR}/)?List-${cmd}-Nonexistent-List.cmake:2 \\(list\\):.*sub-command ${Cmd} requires list to be present.*") -endforeach() - -set(Get-CMP0007-Warn-RESULT 0) -set(Get-CMP0007-Warn-STDERR ".*CMake Warning \\(dev\\) at (${CTEST_ESCAPED_CMAKE_CURRENT_SOURCE_DIR}/)?List-Get-CMP0007-Warn.cmake:3 \\(list\\):.*Policy CMP0007 is not set:.*") - -check_cmake_test(List - No-Arguments - Length-Too-Many-Arguments - Reverse-Too-Many-Arguments - Remove_Duplicates-Too-Many-Arguments - Sort-Too-Many-Arguments - Invalid-Subcommand - Get-Invalid-Index - Insert-Invalid-Index - Remove_Item-Nonexistent-List - Reverse-Nonexistent-List - Remove_Duplicates-Nonexistent-List - Sort-Nonexistent-List - Remove_At-Nonexistent-List - Remove_At-Invalid-Index - Get-CMP0007-Warn -) - set(thelist "" NEW OLD) foreach (_pol ${thelist}) diff --git a/Tests/CMakeTests/WhileTest.cmake.in b/Tests/CMakeTests/WhileTest.cmake.in index d4cf7d7..cc22978 100644 --- a/Tests/CMakeTests/WhileTest.cmake.in +++ b/Tests/CMakeTests/WhileTest.cmake.in @@ -1,9 +1,6 @@ set(NUMBERS "") set(COUNT 0) -include("@CMAKE_CURRENT_SOURCE_DIR@/../RegexEscapeString.cmake") -REGEX_ESCAPE_STRING(CTEST_ESCAPED_CMAKE_CURRENT_SOURCE_DIR "@CMAKE_CURRENT_SOURCE_DIR@") - while(COUNT LESS 200) set(NUMBERS "${NUMBERS} ${COUNT}") set(COUNT "2${COUNT}") @@ -18,40 +15,3 @@ endwhile() if(NOT NUMBERS STREQUAL " 0 3 30 20 3 30") message(SEND_ERROR "while loop nesting error, result: '${NUMBERS}'") endif() - - -set(Missing-Argument-RESULT 1) -set(Missing-Argument-STDERR ".*CMake Error at (${CTEST_ESCAPED_CMAKE_CURRENT_SOURCE_DIR}/)?While-Missing-Argument.cmake:1 \\(while\\):.*while called with incorrect number of arguments.*") - -include("@CMAKE_CURRENT_SOURCE_DIR@/CheckCMakeTest.cmake") -check_cmake_test(While - Missing-Argument -) - -set(Missing-Endwhile-RESULT 1) -set(Missing-Endwhile-STDERR ".*CMake Error in (${CTEST_ESCAPED_CMAKE_CURRENT_SOURCE_DIR}/)?While-Missing-Endwhile.cmake:.*A logical block opening on the line.*(${CTEST_ESCAPED_CMAKE_CURRENT_SOURCE_DIR}/)?While-Missing-Endwhile.cmake:1 \\(while\\).*is not closed\\..*") - -check_cmake_test(While - Missing-Endwhile -) - -set(Endwhile-Mismatch-RESULT 0) -set(Endwhile-Mismatch-STDERR ".*CMake Warning \\(dev\\) in (${CTEST_ESCAPED_CMAKE_CURRENT_SOURCE_DIR}/)?While-Endwhile-Mismatch.cmake:.*A logical block opening on the line.*(${CTEST_ESCAPED_CMAKE_CURRENT_SOURCE_DIR}/)?While-Endwhile-Mismatch.cmake:1 \\(while\\).*with mis-matching arguments\\..*") - -check_cmake_test(While - Endwhile-Mismatch -) - -set(Endwhile-Alone-RESULT 1) -set(Endwhile-Alone-STDERR ".*CMake Error at (${CTEST_ESCAPED_CMAKE_CURRENT_SOURCE_DIR}/)?While-Endwhile-Alone.cmake:1 \\(endwhile\\):.*An ENDWHILE command was found outside of a proper WHILE ENDWHILE.*structure\\.\n.*$") - -check_cmake_test(While - Endwhile-Alone -) - -set(Endwhile-Alone-Args-RESULT 1) -set(Endwhile-Alone-Args-STDERR ".*CMake Error at (${CTEST_ESCAPED_CMAKE_CURRENT_SOURCE_DIR}/)?While-Endwhile-Alone-Args.cmake:1 \\(endwhile\\):.*An ENDWHILE command was found outside of a proper WHILE ENDWHILE.*structure\\. Or its arguments did not.*$") - -check_cmake_test(While - Endwhile-Alone-Args -) diff --git a/Tests/CTestTestConfigFileInBuildDir/CMakeLists.txt b/Tests/CTestTestConfigFileInBuildDir/CMakeLists.txt deleted file mode 100644 index 3c53e66..0000000 --- a/Tests/CTestTestConfigFileInBuildDir/CMakeLists.txt +++ /dev/null @@ -1,3 +0,0 @@ -cmake_minimum_required(VERSION 2.8) -project(CTestTestConfigFileInBuildDir) -include(CTest) diff --git a/Tests/CTestTestConfigFileInBuildDir/CTestConfig.cmake b/Tests/CTestTestConfigFileInBuildDir/CTestConfig.cmake deleted file mode 100644 index 4458348..0000000 --- a/Tests/CTestTestConfigFileInBuildDir/CTestConfig.cmake +++ /dev/null @@ -1,7 +0,0 @@ -set(CTEST_PROJECT_NAME "CTestTestConfigFileInBuildDir") -set(CTEST_NIGHTLY_START_TIME "01:00:00 UTC") -set(CTEST_DART_SERVER_VERSION "2") -set(CTEST_DROP_METHOD "http") -set(CTEST_DROP_SITE "open.cdash.org") -set(CTEST_DROP_LOCATION "/submit.php?project=PublicDashboard") -set(CTEST_DROP_SITE_CDASH TRUE) diff --git a/Tests/CTestTestConfigFileInBuildDir/test1.cmake.in b/Tests/CTestTestConfigFileInBuildDir/test1.cmake.in deleted file mode 100644 index 6d29af7..0000000 --- a/Tests/CTestTestConfigFileInBuildDir/test1.cmake.in +++ /dev/null @@ -1,19 +0,0 @@ -cmake_minimum_required(VERSION 2.8) - -# Settings: -set(CTEST_DASHBOARD_ROOT "@CMake_BINARY_DIR@/Tests/CTestTest") -set(CTEST_SITE "@SITE@") -set(CTEST_BUILD_NAME "CTestTest-@BUILDNAME@-ConfigFileInBuildDir1") - -set(CTEST_SOURCE_DIRECTORY "@CMake_SOURCE_DIR@/Tests/CTestTestConfigFileInBuildDir") -set(CTEST_BINARY_DIRECTORY "@CMake_BINARY_DIR@/Tests/CTestTestConfigFileInBuildDir1") -set(CTEST_CVS_COMMAND "@CVSCOMMAND@") -set(CTEST_CMAKE_GENERATOR "@CMAKE_GENERATOR@") -set(CTEST_CMAKE_GENERATOR_PLATFORM "@CMAKE_GENERATOR_PLATFORM@") -set(CTEST_CMAKE_GENERATOR_TOOLSET "@CMAKE_GENERATOR_TOOLSET@") -set(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}") -set(CTEST_COVERAGE_COMMAND "@COVERAGE_COMMAND@") -set(CTEST_NOTES_FILES "${CTEST_SCRIPT_DIRECTORY}/${CTEST_SCRIPT_NAME}") - -CTEST_START(Experimental) -CTEST_CONFIGURE(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res) diff --git a/Tests/CTestTestConfigFileInBuildDir/test2.cmake.in b/Tests/CTestTestConfigFileInBuildDir/test2.cmake.in deleted file mode 100644 index fb298d4..0000000 --- a/Tests/CTestTestConfigFileInBuildDir/test2.cmake.in +++ /dev/null @@ -1,19 +0,0 @@ -cmake_minimum_required(VERSION 2.8) - -# Settings: -set(CTEST_DASHBOARD_ROOT "@CMake_BINARY_DIR@/Tests/CTestTest") -set(CTEST_SITE "@SITE@") -set(CTEST_BUILD_NAME "CTestTest-@BUILDNAME@-ConfigFileInBuildDir2") - -set(CTEST_SOURCE_DIRECTORY "@CMake_SOURCE_DIR@/Tests/CTestTestConfigFileInBuildDir") -set(CTEST_BINARY_DIRECTORY "@CMake_BINARY_DIR@/Tests/CTestTestConfigFileInBuildDir2") -set(CTEST_CVS_COMMAND "@CVSCOMMAND@") -set(CTEST_CMAKE_GENERATOR "@CMAKE_GENERATOR@") -set(CTEST_CMAKE_GENERATOR_PLATFORM "@CMAKE_GENERATOR_PLATFORM@") -set(CTEST_CMAKE_GENERATOR_TOOLSET "@CMAKE_GENERATOR_TOOLSET@") -set(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}") -set(CTEST_COVERAGE_COMMAND "@COVERAGE_COMMAND@") -set(CTEST_NOTES_FILES "${CTEST_SCRIPT_DIRECTORY}/${CTEST_SCRIPT_NAME}") - -CTEST_START(Experimental) -CTEST_CONFIGURE(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res) diff --git a/Tests/CTestUpdateCVS.cmake.in b/Tests/CTestUpdateCVS.cmake.in index 1699c3f..277b3a6 100644 --- a/Tests/CTestUpdateCVS.cmake.in +++ b/Tests/CTestUpdateCVS.cmake.in @@ -170,3 +170,22 @@ set(CTEST_CHECKOUT_COMMAND # Run the dashboard script with CTest. run_dashboard_script(dash-binary) + +#----------------------------------------------------------------------------- +# Test ctest_update(RETURN_VALUE) on failure +message("Running CTest Dashboard Script (fail to update)...") + +set(ctest_update_check [[ +if(NOT ret LESS 0) + message(FATAL_ERROR "ctest_update incorrectly succeeded with ${ret}") +endif() +]]) +create_dashboard_script(dash-binary-fail + "set(CTEST_CVS_COMMAND \"update-command-does-not-exist\") +") +unset(ctest_update_check) + +# Run the dashboard script with CTest. +set(FAIL_UPDATE 1) +run_dashboard_script(dash-binary-fail) +unset(FAIL_UPDATE) diff --git a/Tests/CTestUpdateCommon.cmake b/Tests/CTestUpdateCommon.cmake index 77b3398..458e427 100644 --- a/Tests/CTestUpdateCommon.cmake +++ b/Tests/CTestUpdateCommon.cmake @@ -182,6 +182,14 @@ endfunction() #----------------------------------------------------------------------------- # Function to write the dashboard test script. function(create_dashboard_script bin_dir custom_text) + if (NOT ctest_update_check) + set(ctest_update_check [[ +if(ret LESS 0) + message(FATAL_ERROR "ctest_update failed with ${ret}") +endif() +]]) + endif() + # Write the dashboard script. file(WRITE ${TOP}/${bin_dir}.cmake "# CTest Dashboard Script @@ -193,8 +201,8 @@ set(CTEST_BINARY_DIRECTORY \${CTEST_DASHBOARD_ROOT}/${bin_dir}) ${custom_text} # Start a dashboard and run the update step ctest_start(Experimental) -ctest_update(SOURCE \${CTEST_SOURCE_DIRECTORY}) -") +ctest_update(SOURCE \${CTEST_SOURCE_DIRECTORY} RETURN_VALUE ret ${ctest_update_args}) +${ctest_update_check}") endfunction() #----------------------------------------------------------------------------- @@ -250,6 +258,24 @@ function(check_no_update bin_dir) endif() endfunction() +#----------------------------------------------------------------------------- +# Function to find the Update.xml file and make sure +# it only has the UpdateReturnStatus failure message and no updates. +function(check_fail_update bin_dir) + set(PATTERN ${TOP}/${bin_dir}/Testing/*/Update.xml) + file(GLOB UPDATE_XML_FILE RELATIVE ${TOP} ${PATTERN}) + string(REGEX REPLACE "//Update.xml$" "/Update.xml" + UPDATE_XML_FILE "${UPDATE_XML_FILE}") + message(" found ${UPDATE_XML_FILE}") + file(STRINGS ${TOP}/${UPDATE_XML_FILE} UPDATE_XML_STATUS + REGEX "^\t<UpdateReturnStatus>[^<\n]+" + ) + if(UPDATE_XML_STATUS MATCHES "Update command failed") + message(" correctly found 'Update command failed'") + else() + message(FATAL_ERROR " missing 'Update command failed'") + endif() +endfunction() #----------------------------------------------------------------------------- # Function to run the dashboard through a script @@ -263,6 +289,8 @@ function(run_dashboard_script bin_dir) list(APPEND UPDATE_MAYBE Updated{subdir} Updated{CTestConfig.cmake}) if(NO_UPDATE) check_no_update(${bin_dir}) + elseif(FAIL_UPDATE) + check_fail_update(${bin_dir}) else() check_updates(${bin_dir} Updated{foo.txt} diff --git a/Tests/CTestUpdateGIT.cmake.in b/Tests/CTestUpdateGIT.cmake.in index 5987a30..6488a1f 100644 --- a/Tests/CTestUpdateGIT.cmake.in +++ b/Tests/CTestUpdateGIT.cmake.in @@ -334,31 +334,22 @@ set(CTEST_UPDATE_VERSION_ONLY TRUE) # Run the dashboard script with CTest. set(NO_UPDATE 1) run_dashboard_script(dash-binary-no-update) +unset(NO_UPDATE) rewind_source(dash-source) #----------------------------------------------------------------------------- # Test ctest_update(QUIET) -set(NO_UPDATE 0) message("Running CTest Dashboard Script (update quietly)...") +set(ctest_update_args QUIET) create_dashboard_script(dash-binary-quiet "# git command configuration set(CTEST_GIT_COMMAND \"${GIT}\") set(CTEST_GIT_UPDATE_OPTIONS) set(CTEST_GIT_UPDATE_CUSTOM \${CTEST_GIT_COMMAND} pull origin master) ") - -# We need to modify the created dashboard script to include our "QUIET" -# option. -set(filename "${TOP}/dash-binary-quiet.cmake") -file(READ "${filename}" contents) -string(REPLACE - [=[ctest_update(SOURCE ${CTEST_SOURCE_DIRECTORY})]=] - [=[ctest_update(SOURCE ${CTEST_SOURCE_DIRECTORY} QUIET)]=] - contents - "${contents}") -file(WRITE "${filename}" "${contents}") +unset(ctest_update_args) # Run the dashboard script with CTest. run_dashboard_script(dash-binary-quiet) @@ -367,3 +358,23 @@ run_dashboard_script(dash-binary-quiet) if("${OUTPUT}" MATCHES "Updating the repository") message(FATAL_ERROR "Found 'Updating the repository' in quiet output") endif() + +#----------------------------------------------------------------------------- +# Test ctest_update(RETURN_VALUE) on failure +message("Running CTest Dashboard Script (fail to update)...") + +set(ctest_update_check [[ + +if(NOT ret LESS 0) + message(FATAL_ERROR "ctest_update incorrectly succeeded with ${ret}") +endif() +]]) +create_dashboard_script(dash-binary-fail + "set(CTEST_GIT_COMMAND \"update-command-does-not-exist\") +") +unset(ctest_update_check) + +# Run the dashboard script with CTest. +set(FAIL_UPDATE 1) +run_dashboard_script(dash-binary-fail) +unset(FAIL_UPDATE) diff --git a/Tests/CTestUpdateHG.cmake.in b/Tests/CTestUpdateHG.cmake.in index c5440f9..c76bf91 100644 --- a/Tests/CTestUpdateHG.cmake.in +++ b/Tests/CTestUpdateHG.cmake.in @@ -164,3 +164,22 @@ execute_process( # Run the dashboard script with CTest. run_dashboard_script(dash-binary) + +#----------------------------------------------------------------------------- +# Test ctest_update(RETURN_VALUE) on failure +message("Running CTest Dashboard Script (fail to update)...") + +set(ctest_update_check [[ +if(NOT ret LESS 0) + message(FATAL_ERROR "ctest_update incorrectly succeeded with ${ret}") +endif() +]]) +create_dashboard_script(dash-binary-fail + "set(CTEST_HG_COMMAND \"update-command-does-not-exist\") +") +unset(ctest_update_check) + +# Run the dashboard script with CTest. +set(FAIL_UPDATE 1) +run_dashboard_script(dash-binary-fail) +unset(FAIL_UPDATE) diff --git a/Tests/CTestUpdateSVN.cmake.in b/Tests/CTestUpdateSVN.cmake.in index b5728fd..b757a44 100644 --- a/Tests/CTestUpdateSVN.cmake.in +++ b/Tests/CTestUpdateSVN.cmake.in @@ -147,3 +147,22 @@ set(CTEST_CHECKOUT_COMMAND # Run the dashboard script with CTest. run_dashboard_script(dash-binary) + +#----------------------------------------------------------------------------- +# Test ctest_update(RETURN_VALUE) on failure +message("Running CTest Dashboard Script (fail to update)...") + +set(ctest_update_check [[ +if(NOT ret LESS 0) + message(FATAL_ERROR "ctest_update incorrectly succeeded with ${ret}") +endif() +]]) +create_dashboard_script(dash-binary-fail + "set(CTEST_SVN_COMMAND \"update-command-does-not-exist\") +") +unset(ctest_update_check) + +# Run the dashboard script with CTest. +set(FAIL_UPDATE 1) +run_dashboard_script(dash-binary-fail) +unset(FAIL_UPDATE) diff --git a/Tests/ExportImport/Export/CMakeLists.txt b/Tests/ExportImport/Export/CMakeLists.txt index 0df42d9..df3f178 100644 --- a/Tests/ExportImport/Export/CMakeLists.txt +++ b/Tests/ExportImport/Export/CMakeLists.txt @@ -73,6 +73,12 @@ install(TARGETS testLibPerConfigDest EXPORT exp DESTINATION lib/$<$<BOOL:$<CONFIG>>:$<CONFIG>>$<$<NOT:$<BOOL:$<CONFIG>>>:NoConfig> ) +# Test OUTPUT_NAME properties with generator expressions +add_library(testLib7 STATIC testLib7.c) +set_property(TARGET testLib7 PROPERTY OUTPUT_NAME_DEBUG testLib7D-$<CONFIG>) +set_property(TARGET testLib7 PROPERTY OUTPUT_NAME_RELEASE testLib7R-$<CONFIG>) +set_property(TARGET testLib7 PROPERTY OUTPUT_NAME testLib7-$<CONFIG>) + # Work-around: Visual Studio 6 does not support per-target object files. set(VS6) if("${CMAKE_GENERATOR}" MATCHES "Visual Studio 6") @@ -446,7 +452,7 @@ install( TARGETS testExe1 testLib1 testLib2 testExe2 testLib3 testLib4 testExe3 testExe2lib testLib4lib testLib4libdbg testLib4libopt - testLib6 + testLib6 testLib7 testLibCycleA testLibCycleB cmp0022NEW cmp0022OLD systemlib @@ -505,7 +511,7 @@ export(TARGETS testExe1 testLib1 testLib2 testLib3 NAMESPACE bld_ FILE ExportBuildTree.cmake ) -export(TARGETS testExe2 testLib4 testLib5 testLib6 testExe3 testExe2lib +export(TARGETS testExe2 testLib4 testLib5 testLib6 testLib7 testExe3 testExe2lib testLib4lib testLib4libdbg testLib4libopt testLibCycleA testLibCycleB testLibPerConfigDest diff --git a/Tests/ExportImport/Export/Interface/CMakeLists.txt b/Tests/ExportImport/Export/Interface/CMakeLists.txt index 00a5375..fd55c42 100644 --- a/Tests/ExportImport/Export/Interface/CMakeLists.txt +++ b/Tests/ExportImport/Export/Interface/CMakeLists.txt @@ -39,7 +39,11 @@ install(FILES DESTINATION src ) +add_library(cmakeonly INTERFACE) +set_property(TARGET cmakeonly PROPERTY INTERFACE_COMPILE_DEFINITIONS [[DEF="\"\$\B"]]) + install(TARGETS headeronly sharediface use_auto_type use_c_restrict source_target + cmakeonly EXPORT expInterface ) install(TARGETS sharedlib diff --git a/Tests/ExportImport/Export/testLib7.c b/Tests/ExportImport/Export/testLib7.c new file mode 100644 index 0000000..7acae9e --- /dev/null +++ b/Tests/ExportImport/Export/testLib7.c @@ -0,0 +1 @@ +int testLib7(void) { return 0; } diff --git a/Tests/ExportImport/Import/A/CMakeLists.txt b/Tests/ExportImport/Import/A/CMakeLists.txt index 17d983a..a74bad1 100644 --- a/Tests/ExportImport/Import/A/CMakeLists.txt +++ b/Tests/ExportImport/Import/A/CMakeLists.txt @@ -33,6 +33,7 @@ target_link_libraries(imp_testExe1 exp_testLib4 exp_testLib5 exp_testLib6 + exp_testLib7 exp_testLibCycleA exp_testLibPerConfigDest ) @@ -66,6 +67,7 @@ target_link_libraries(imp_testExe1b bld_testLib4 bld_testLib5 bld_testLib6 + bld_testLib7 bld_testLibCycleA bld_testLibPerConfigDest ) diff --git a/Tests/ExportImport/Import/A/imp_testExe1.c b/Tests/ExportImport/Import/A/imp_testExe1.c index 150fcef..56cdd2c 100644 --- a/Tests/ExportImport/Import/A/imp_testExe1.c +++ b/Tests/ExportImport/Import/A/imp_testExe1.c @@ -6,6 +6,7 @@ extern int testLib4(); extern int testLib4lib(); extern int testLib5(); extern int testLib6(); +extern int testLib7(); extern int testLibCycleA1(); extern int testLibPerConfigDest(); @@ -21,7 +22,7 @@ extern testLib4libcfg(void); int main() { return (testLib2() + generated_by_testExe1() + testLib3() + testLib4() - + testLib5() + testLib6() + testLibCycleA1() + + testLib5() + testLib6() + testLib7() + testLibCycleA1() + testLibPerConfigDest() + generated_by_testExe3() + testLib4lib() + testLib4libcfg()); } diff --git a/Tests/ExportImport/Import/Interface/CMakeLists.txt b/Tests/ExportImport/Import/Interface/CMakeLists.txt index 51d518e..c850508 100644 --- a/Tests/ExportImport/Import/Interface/CMakeLists.txt +++ b/Tests/ExportImport/Import/Interface/CMakeLists.txt @@ -99,3 +99,14 @@ add_executable(interfacetest_exp interfacetest.cpp) target_link_libraries(interfacetest_exp exp::sharediface) do_try_compile(exp) + +foreach(ns exp bld) + get_property(defs TARGET ${ns}::cmakeonly PROPERTY INTERFACE_COMPILE_DEFINITIONS) + if(NOT defs STREQUAL [[DEF="\"\$\B"]]) + message(SEND_ERROR + "${ns}::cmakeonly property INTERFACE_COMPILE_DEFINITIONS is:\n" + " ${defs}\n" + "not\n" + " " [[DEF="\"\$\B"]] "\n") + endif() +endforeach() diff --git a/Tests/ExternalProject/CMakeLists.txt b/Tests/ExternalProject/CMakeLists.txt index de62ce7..b5041c7 100644 --- a/Tests/ExternalProject/CMakeLists.txt +++ b/Tests/ExternalProject/CMakeLists.txt @@ -364,6 +364,66 @@ if(do_git_tests) ) set_property(TARGET ${proj} PROPERTY FOLDER "GIT") + # Unzip/untar the git repository in our source folder so that other + # projects below may use it to test git args of ExternalProject_Add + # + set(proj SetupLocalGITRepositoryWithSubmodules) + ExternalProject_Add(${proj} + SOURCE_DIR ${CMAKE_CURRENT_BINARY_DIR}/LocalRepositories/GIT-with-submodules + URL ${CMAKE_CURRENT_SOURCE_DIR}/gitrepo-sub.tgz + BUILD_COMMAND "" + CONFIGURE_COMMAND "${GIT_EXECUTABLE}" --version + INSTALL_COMMAND "" + ) + set_property(TARGET ${proj} + PROPERTY FOLDER "SetupRepos/Local/Deeply/Nested/For/Testing") + + set(local_git_repo "../../LocalRepositories/GIT-with-submodules") + + set(proj TS1-GIT-no-GIT_SUBMODULES) + ExternalProject_Add(${proj} + GIT_REPOSITORY "${local_git_repo}" + CMAKE_GENERATOR "${CMAKE_GENERATOR}" + CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR> + -DWITH_m1:BOOL=ON + -DWITH_m2:BOOL=ON + BUILD_COMMAND "" + INSTALL_COMMAND "" + DEPENDS "SetupLocalGITRepository" + "SetupLocalGITRepositoryWithSubmodules" + ) + set_property(TARGET ${proj} PROPERTY FOLDER "GIT") + + set(proj TS1-GIT-empty-GIT_SUBMODULES) + ExternalProject_Add(${proj} + GIT_REPOSITORY "${local_git_repo}" + GIT_SUBMODULES "" + CMAKE_GENERATOR "${CMAKE_GENERATOR}" + CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR> + -DWITH_m1:BOOL=ON + -DWITH_m2:BOOL=ON + BUILD_COMMAND "" + INSTALL_COMMAND "" + DEPENDS "SetupLocalGITRepository" + "SetupLocalGITRepositoryWithSubmodules" + ) + set_property(TARGET ${proj} PROPERTY FOLDER "GIT") + + set(proj TS1-GIT-some-GIT_SUBMODULES) + ExternalProject_Add(${proj} + GIT_REPOSITORY "${local_git_repo}" + GIT_SUBMODULES "m/m1" + CMAKE_GENERATOR "${CMAKE_GENERATOR}" + CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR> + -DWITH_m1:BOOL=ON + -DWITH_m2:BOOL=OFF + BUILD_COMMAND "" + INSTALL_COMMAND "" + DEPENDS "SetupLocalGITRepository" + "SetupLocalGITRepositoryWithSubmodules" + ) + set_property(TARGET ${proj} PROPERTY FOLDER "GIT") + endif() set(do_hg_tests 0) diff --git a/Tests/ExternalProject/gitrepo-sub.tgz b/Tests/ExternalProject/gitrepo-sub.tgz Binary files differnew file mode 100644 index 0000000..c0b5360 --- /dev/null +++ b/Tests/ExternalProject/gitrepo-sub.tgz diff --git a/Tests/QtAutogen/CMakeLists.txt b/Tests/QtAutogen/CMakeLists.txt index 60b44fd..ebcfc0f 100644 --- a/Tests/QtAutogen/CMakeLists.txt +++ b/Tests/QtAutogen/CMakeLists.txt @@ -34,8 +34,8 @@ else() include_directories(${Qt5Widgets_INCLUDE_DIRS}) set(QT_LIBRARIES Qt5::Widgets) - if(Qt5_POSITION_INDEPENDENT_CODE) - set(CMAKE_POSITION_INDEPENDENT_CODE ON) + if(Qt5_POSITION_INDEPENDENT_CODE AND CMAKE_CXX_COMPILE_OPTIONS_PIC) + add_definitions(${CMAKE_CXX_COMPILE_OPTIONS_PIC}) endif() macro(qtx_wrap_cpp) @@ -167,3 +167,26 @@ file(TIMESTAMP "${qrc_file1}" file1_step1 "${timeformat}") if (NOT file1_step1 GREATER file1_before) message(SEND_ERROR "file1 (${qrc_file1}) should have changed in the first step!") endif() + +#----------------------------------------------------------------------------- +try_compile(MOC_RERUN + "${CMAKE_CURRENT_BINARY_DIR}/automoc_rerun" + "${CMAKE_CURRENT_SOURCE_DIR}/automoc_rerun" + automoc_rerun + CMAKE_FLAGS "-DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE}" "-DQT_TEST_VERSION=${QT_TEST_VERSION}" + "-DCMAKE_PREFIX_PATH=${Qt_PREFIX_DIR}" + OUTPUT_VARIABLE output +) +if (NOT MOC_RERUN) + message(SEND_ERROR "Initial build of automoc_rerun failed. Output: ${output}") +endif() + +configure_file(automoc_rerun/test1.h.in2 automoc_rerun/test1.h COPYONLY) + +execute_process(COMMAND "${CMAKE_COMMAND}" --build . + WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/automoc_rerun" + RESULT_VARIABLE automoc_rerun_result + ) +if (automoc_rerun_result) + message(SEND_ERROR "Second build of automoc_rerun failed.") +endif() diff --git a/Tests/QtAutogen/automoc_rerun/CMakeLists.txt b/Tests/QtAutogen/automoc_rerun/CMakeLists.txt new file mode 100644 index 0000000..17bc332 --- /dev/null +++ b/Tests/QtAutogen/automoc_rerun/CMakeLists.txt @@ -0,0 +1,27 @@ +cmake_minimum_required(VERSION 3.1) +project(automoc_rerun CXX) + +if (QT_TEST_VERSION STREQUAL 4) + find_package(Qt4 REQUIRED) + set(QT_CORE_TARGET Qt4::QtCore) +else() + if (NOT QT_TEST_VERSION STREQUAL 5) + message(SEND_ERROR "Invalid Qt version specified.") + endif() + + find_package(Qt5Core REQUIRED) + set(QT_CORE_TARGET Qt5::Core) +endif() + +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTORCC ON) + +configure_file(test1.h.in1 test1.h COPYONLY) + +add_executable(test1 + ${CMAKE_CURRENT_BINARY_DIR}/test1.h + test1.cpp + res1.qrc + ) +target_include_directories(test1 PRIVATE ${CMAKE_CURRENT_BINARY_DIR}) +target_link_libraries(test1 ${QT_CORE_TARGET}) diff --git a/Tests/QtAutogen/automoc_rerun/input.txt b/Tests/QtAutogen/automoc_rerun/input.txt new file mode 100644 index 0000000..da62762 --- /dev/null +++ b/Tests/QtAutogen/automoc_rerun/input.txt @@ -0,0 +1 @@ +Res1 input. diff --git a/Tests/QtAutogen/automoc_rerun/res1.qrc b/Tests/QtAutogen/automoc_rerun/res1.qrc new file mode 100644 index 0000000..fb804b5 --- /dev/null +++ b/Tests/QtAutogen/automoc_rerun/res1.qrc @@ -0,0 +1,5 @@ +<RCC> + <qresource prefix="/"> + <file>input.txt</file> + </qresource> +</RCC> diff --git a/Tests/QtAutogen/automoc_rerun/test1.cpp b/Tests/QtAutogen/automoc_rerun/test1.cpp new file mode 100644 index 0000000..4316a91 --- /dev/null +++ b/Tests/QtAutogen/automoc_rerun/test1.cpp @@ -0,0 +1,5 @@ +#include "test1.h" +int main() +{ + return 0; +} diff --git a/Tests/QtAutogen/automoc_rerun/test1.h.in1 b/Tests/QtAutogen/automoc_rerun/test1.h.in1 new file mode 100644 index 0000000..fee2c09 --- /dev/null +++ b/Tests/QtAutogen/automoc_rerun/test1.h.in1 @@ -0,0 +1,8 @@ +#include <QObject> +class test1 : public QObject +{ + Q_OBJECT + public slots: + void onTst1() {} + void onTst2() {} +}; diff --git a/Tests/QtAutogen/automoc_rerun/test1.h.in2 b/Tests/QtAutogen/automoc_rerun/test1.h.in2 new file mode 100644 index 0000000..6531d10 --- /dev/null +++ b/Tests/QtAutogen/automoc_rerun/test1.h.in2 @@ -0,0 +1,7 @@ +#include <QObject> +class test1 : public QObject +{ + Q_OBJECT + public slots: + void onTst1() {} +}; diff --git a/Tests/RegexEscapeString.cmake b/Tests/RegexEscapeString.cmake deleted file mode 100644 index 92aed17..0000000 --- a/Tests/RegexEscapeString.cmake +++ /dev/null @@ -1,4 +0,0 @@ -macro(REGEX_ESCAPE_STRING _OUT _IN) - # Escape special regex metacharacters with a backslash - string(REGEX REPLACE "([$^.[|*+?()]|])" "\\\\\\1" ${_OUT} "${_IN}") -endmacro() diff --git a/Tests/RunCMake/AutoExportDll/AutoExport.cmake b/Tests/RunCMake/AutoExportDll/AutoExport.cmake new file mode 100644 index 0000000..3b2b2c5 --- /dev/null +++ b/Tests/RunCMake/AutoExportDll/AutoExport.cmake @@ -0,0 +1,7 @@ +project(autoexport) +set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS TRUE) +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${autoexport_BINARY_DIR}/bin) +add_subdirectory(sub) +add_library(autoexport SHARED hello.cxx world.cxx foo.c) +add_executable(say say.cxx) +target_link_libraries(say autoexport autoexport2) diff --git a/Tests/RunCMake/AutoExportDll/AutoExportBuild-stderr.txt b/Tests/RunCMake/AutoExportDll/AutoExportBuild-stderr.txt new file mode 100644 index 0000000..d483c2c --- /dev/null +++ b/Tests/RunCMake/AutoExportDll/AutoExportBuild-stderr.txt @@ -0,0 +1 @@ +^.*$ diff --git a/Tests/RunCMake/AutoExportDll/CMakeLists.txt b/Tests/RunCMake/AutoExportDll/CMakeLists.txt new file mode 100644 index 0000000..18dfd26 --- /dev/null +++ b/Tests/RunCMake/AutoExportDll/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.2) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/AutoExportDll/RunCMakeTest.cmake b/Tests/RunCMake/AutoExportDll/RunCMakeTest.cmake new file mode 100644 index 0000000..3784a6a --- /dev/null +++ b/Tests/RunCMake/AutoExportDll/RunCMakeTest.cmake @@ -0,0 +1,26 @@ +include(RunCMake) +set(RunCMake_TEST_NO_CLEAN TRUE) +set(RunCMake_TEST_BINARY_DIR "${RunCMake_BINARY_DIR}/AutoExport-build") +# start by cleaning up because we don't clean up along the way +file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") +# configure the AutoExport test +run_cmake(AutoExport) +unset(RunCMake_TEST_OPTIONS) +# don't run this test on VS 6 as it is not supported +if("${RunCMake_GENERATOR}" MATCHES "Visual Studio 6|Watcom WMake|Borland Makefiles") + return() +endif() +# we build debug so the say.exe will be found in Debug/say.exe for +# Visual Studio generators +if("${RunCMake_GENERATOR}" MATCHES "Visual Studio|Xcode") + set(INTDIR "Debug/") +endif() +# build AutoExport +run_cmake_command(AutoExportBuild ${CMAKE_COMMAND} --build + ${RunCMake_TEST_BINARY_DIR} --config Debug --clean-first) +# run the executable that uses symbols from the dll +if(WIN32) + set(EXE_EXT ".exe") +endif() +run_cmake_command(AutoExportRun + ${RunCMake_BINARY_DIR}/AutoExport-build/bin/${INTDIR}say${EXE_EXT}) diff --git a/Tests/RunCMake/AutoExportDll/foo.c b/Tests/RunCMake/AutoExportDll/foo.c new file mode 100644 index 0000000..4b1318b --- /dev/null +++ b/Tests/RunCMake/AutoExportDll/foo.c @@ -0,0 +1,15 @@ +#ifdef _MSC_VER +#include "windows.h" +#else +#define WINAPI +#endif + +int WINAPI foo() +{ + return 10; +} + +int bar() +{ + return 5; +} diff --git a/Tests/RunCMake/AutoExportDll/hello.cxx b/Tests/RunCMake/AutoExportDll/hello.cxx new file mode 100644 index 0000000..3933fc1 --- /dev/null +++ b/Tests/RunCMake/AutoExportDll/hello.cxx @@ -0,0 +1,13 @@ +#include <stdio.h> +#include "hello.h" +int Hello::Data = 0; +void Hello::real() +{ + return; +} +void hello() +{ + printf("hello"); +} +void Hello::operator delete[](void*) {}; +void Hello::operator delete(void*) {}; diff --git a/Tests/RunCMake/AutoExportDll/hello.h b/Tests/RunCMake/AutoExportDll/hello.h new file mode 100644 index 0000000..3749b97 --- /dev/null +++ b/Tests/RunCMake/AutoExportDll/hello.h @@ -0,0 +1,18 @@ +#ifndef _MSC_VER +#define winexport +#else +#ifdef autoexport_EXPORTS +#define winexport +#else +#define winexport __declspec(dllimport) +#endif +#endif + +class Hello +{ +public: + static winexport int Data; + void real(); + static void operator delete[](void*); + static void operator delete(void*); +}; diff --git a/Tests/RunCMake/AutoExportDll/say.cxx b/Tests/RunCMake/AutoExportDll/say.cxx new file mode 100644 index 0000000..655b3c2 --- /dev/null +++ b/Tests/RunCMake/AutoExportDll/say.cxx @@ -0,0 +1,37 @@ +#include <stdio.h> +#include "hello.h" +#ifdef _MSC_VER +#include "windows.h" +#else +#define WINAPI +#endif + +extern "C" +{ +// test __cdecl stuff + int WINAPI foo(); +// test regular C + int bar(); +} + +// test c++ functions +// forward declare hello and world +void hello(); +void world(); + +int main() +{ + // test static data (needs declspec to work) + Hello::Data = 120; + Hello h; + h.real(); + hello(); + printf(" "); + world(); + printf("\n"); + foo(); + printf("\n"); + bar(); + printf("\n"); + return 0; +} diff --git a/Tests/RunCMake/AutoExportDll/sub/CMakeLists.txt b/Tests/RunCMake/AutoExportDll/sub/CMakeLists.txt new file mode 100644 index 0000000..8b70e7d --- /dev/null +++ b/Tests/RunCMake/AutoExportDll/sub/CMakeLists.txt @@ -0,0 +1,5 @@ +add_library(autoexport2 SHARED sub.cxx) +if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") + # Try msvc "big" object format. + target_compile_options(autoexport2 PRIVATE /bigobj) +endif() diff --git a/Tests/RunCMake/AutoExportDll/sub/sub.cxx b/Tests/RunCMake/AutoExportDll/sub/sub.cxx new file mode 100644 index 0000000..9766b41 --- /dev/null +++ b/Tests/RunCMake/AutoExportDll/sub/sub.cxx @@ -0,0 +1,4 @@ +int sub() +{ + return 10; +} diff --git a/Tests/RunCMake/AutoExportDll/world.cxx b/Tests/RunCMake/AutoExportDll/world.cxx new file mode 100644 index 0000000..3a54df3 --- /dev/null +++ b/Tests/RunCMake/AutoExportDll/world.cxx @@ -0,0 +1,6 @@ +#include "stdio.h" + +void world() +{ + printf("world"); +} diff --git a/Tests/RunCMake/CMP0019/CMP0019-WARN-stderr.txt b/Tests/RunCMake/CMP0019/CMP0019-WARN-stderr.txt index 03faef9..1e4b47d 100644 --- a/Tests/RunCMake/CMP0019/CMP0019-WARN-stderr.txt +++ b/Tests/RunCMake/CMP0019/CMP0019-WARN-stderr.txt @@ -21,13 +21,13 @@ CMake Warning \(dev\) in CMakeLists.txt: /usr/include/VAL_INCLUDE;/usr/include/normal - Evaluated link directory + Evaluated link directories - /usr/lib/\${VAR_LINK_DIRS} + /usr/lib/\${VAR_LINK_DIRS};/usr/lib/normal as - /usr/lib/VAL_LINK_DIRS + /usr/lib/VAL_LINK_DIRS;/usr/lib/normal Evaluated link library diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index 81029cd..7ff1889 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -26,6 +26,43 @@ macro(add_RunCMake_test test) ) endmacro() +function(add_RunCMake_test_group test types) + # create directory for common content + set(TEST_CONFIG_DIR "${CMAKE_CURRENT_BINARY_DIR}/${test}/conf") + file(REMOVE_RECURSE "${TEST_CONFIG_DIR}") + file(MAKE_DIRECTORY "${TEST_CONFIG_DIR}") + + foreach(type IN LISTS types) + # 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" + "${TEST_CONFIG_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=${TEST_CONFIG_DIR}/${type}_config.cmake + -P "${CMAKE_CURRENT_SOURCE_DIR}/${test}/RunCMakeTest.cmake" + ) + endif() + endforeach() +endfunction() + +if(XCODE_VERSION AND "${XCODE_VERSION}" VERSION_LESS 6.1) + set(Swift_ARGS -DXCODE_BELOW_6_1=1) +endif() + if(XCODE_VERSION AND "${XCODE_VERSION}" VERSION_LESS 3) set(GeneratorToolset_ARGS -DXCODE_BELOW_3=1) endif() @@ -66,6 +103,9 @@ add_RunCMake_test(CMP0055) add_RunCMake_test(CMP0057) add_RunCMake_test(CMP0059) add_RunCMake_test(CMP0060) +if(CMAKE_GENERATOR MATCHES "Make") + add_RunCMake_test(Make) +endif() if(CMAKE_GENERATOR STREQUAL "Ninja") add_RunCMake_test(Ninja) endif() @@ -95,9 +135,11 @@ add_RunCMake_test(FPHSA) add_RunCMake_test(GeneratorExpression) add_RunCMake_test(GeneratorPlatform) add_RunCMake_test(GeneratorToolset) +add_RunCMake_test(GNUInstallDirs) add_RunCMake_test(TargetPropertyGeneratorExpressions) add_RunCMake_test(Languages) add_RunCMake_test(ObjectLibrary) +add_RunCMake_test(Swift) add_RunCMake_test(TargetObjects) add_RunCMake_test(TargetSources) add_RunCMake_test(find_dependency) @@ -152,6 +194,7 @@ add_RunCMake_test(try_compile) add_RunCMake_test(try_run) add_RunCMake_test(set) add_RunCMake_test(variable_watch) +add_RunCMake_test(while) add_RunCMake_test(CMP0004) add_RunCMake_test(TargetPolicies) add_RunCMake_test(alias_targets) @@ -207,10 +250,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) -if(RPMBUILD_EXECUTABLE) - add_RunCMake_test(CPackRPM) -endif() - add_RunCMake_test(COMPILE_LANGUAGE-genex) # Matlab module related tests @@ -233,4 +272,10 @@ 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") +# add a test to make sure symbols are exported from a shared library +# for MSVC compilers CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS property is used +add_RunCMake_test(AutoExportDll) diff --git a/Tests/RunCMake/CPack/CMakeLists.txt b/Tests/RunCMake/CPack/CMakeLists.txt new file mode 100644 index 0000000..7905706 --- /dev/null +++ b/Tests/RunCMake/CPack/CMakeLists.txt @@ -0,0 +1,12 @@ +cmake_minimum_required(VERSION 3.1 FATAL_ERROR) + +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) + +# include test generator specifics +if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${GENERATOR_TYPE}/${RunCMake_TEST}-specifics.cmake") + include("${GENERATOR_TYPE}/${RunCMake_TEST}-specifics.cmake") +endif() + +set(CPACK_GENERATOR "${GENERATOR_TYPE}") +include(CPack) diff --git a/Tests/RunCMake/CPack/CPackTestHelpers.cmake b/Tests/RunCMake/CPack/CPackTestHelpers.cmake new file mode 100644 index 0000000..7ea2a24 --- /dev/null +++ b/Tests/RunCMake/CPack/CPackTestHelpers.cmake @@ -0,0 +1,76 @@ +cmake_policy(SET CMP0057 NEW) + +function(run_cpack_test TEST_NAME types build) + if(TEST_TYPE IN_LIST types) + set(RunCMake_TEST_NO_CLEAN TRUE) + set(RunCMake_TEST_BINARY_DIR "${RunCMake_BINARY_DIR}/${TEST_NAME}-build") + + # TODO this should be executed only once per ctest run (not per generator) + file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") + file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") + + # execute cmake + execute_process( + COMMAND "${CMAKE_COMMAND}" -DRunCMake_TEST=${TEST_NAME} + -DGENERATOR_TYPE=${TEST_TYPE} "${RunCMake_SOURCE_DIR}" + WORKING_DIRECTORY "${RunCMake_TEST_BINARY_DIR}" + RESULT_VARIABLE res + OUTPUT_FILE "${RunCMake_TEST_BINARY_DIR}/test_output.txt" + ERROR_FILE "${RunCMake_TEST_BINARY_DIR}/test_error.txt" + ) + + if(res) + run_cmake_command( + ${TEST_TYPE}/${TEST_NAME} + "${CMAKE_COMMAND}" + -DRunCMake_TEST_STEP=configure + -Dreturn_code=${res} + "-Dbin_dir=${RunCMake_TEST_BINARY_DIR}" + -P "${RunCMake_SOURCE_DIR}/PreTestError.cmake" + ) + return() + endif() + + # execute optional build step + if(build) + execute_process( + COMMAND "${CMAKE_COMMAND}" --build "${RunCMake_TEST_BINARY_DIR}" + RESULT_VARIABLE res + OUTPUT_FILE "${RunCMake_TEST_BINARY_DIR}/test_output.txt" + ERROR_FILE "${RunCMake_TEST_BINARY_DIR}/test_error.txt" + ) + endif() + + if(res) + run_cmake_command( + ${TEST_TYPE}/${TEST_NAME} + "${CMAKE_COMMAND}" + -DRunCMake_TEST_STEP=build + -Dreturn_code=${res} + "-Dbin_dir=${RunCMake_TEST_BINARY_DIR}" + -P "${RunCMake_SOURCE_DIR}/PreTestError.cmake" + ) + return() + endif() + + # execute cpack + execute_process( + COMMAND "${CMAKE_CPACK_COMMAND}" + WORKING_DIRECTORY "${RunCMake_TEST_BINARY_DIR}" + OUTPUT_FILE "${RunCMake_TEST_BINARY_DIR}/test_output.txt" + ERROR_FILE "${RunCMake_TEST_BINARY_DIR}/test_error.txt" + ) + + # verify result + run_cmake_command( + ${TEST_TYPE}/${TEST_NAME} + "${CMAKE_COMMAND}" + -DRunCMake_TEST=${TEST_NAME} + -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() +endfunction() diff --git a/Tests/RunCMake/CPack/DEB/DEB_EXTRA-ExpectedFiles.cmake b/Tests/RunCMake/CPack/DEB/DEB_EXTRA-ExpectedFiles.cmake new file mode 100644 index 0000000..2ff679a --- /dev/null +++ b/Tests/RunCMake/CPack/DEB/DEB_EXTRA-ExpectedFiles.cmake @@ -0,0 +1,9 @@ +set(whitespaces_ "[\t\n\r ]*") + +set(EXPECTED_FILES_COUNT "3") +set(EXPECTED_FILE_1 "deb_extra-*-foo.deb") +set(EXPECTED_FILE_CONTENT_1 "^.*/usr/${whitespaces_}.*/usr/foo/${whitespaces_}.*/usr/foo/CMakeLists.txt$") +set(EXPECTED_FILE_2 "deb_extra-*-bar.deb") +set(EXPECTED_FILE_CONTENT_2 "^.*/usr/${whitespaces_}.*/usr/bar/${whitespaces_}.*/usr/bar/CMakeLists.txt$") +set(EXPECTED_FILE_3 "deb_extra-*-bas.deb") +set(EXPECTED_FILE_CONTENT_3 "^.*/usr/${whitespaces_}.*/usr/bas/${whitespaces_}.*/usr/bas/CMakeLists.txt$") diff --git a/Tests/RunCMake/CPack/DEB/DEB_EXTRA-VerifyResult.cmake b/Tests/RunCMake/CPack/DEB/DEB_EXTRA-VerifyResult.cmake new file mode 100644 index 0000000..78b6114 --- /dev/null +++ b/Tests/RunCMake/CPack/DEB/DEB_EXTRA-VerifyResult.cmake @@ -0,0 +1,11 @@ +set(foo_preinst "^echo default_preinst$") +set(foo_prerm "^echo default_prerm$") +verifyDebControl("${FOUND_FILE_1}" "foo" "preinst;prerm") + +set(bar_preinst "^echo bar_preinst$") +set(bar_prerm "^echo bar_prerm$") +verifyDebControl("${FOUND_FILE_2}" "bar" "preinst;prerm") + +set(bas_preinst "^echo default_preinst$") +set(bas_prerm "^echo default_prerm$") +verifyDebControl("${FOUND_FILE_3}" "bas" "preinst;prerm") diff --git a/Tests/RunCMake/CPack/DEB/Helpers.cmake b/Tests/RunCMake/CPack/DEB/Helpers.cmake new file mode 100644 index 0000000..45c85c3 --- /dev/null +++ b/Tests/RunCMake/CPack/DEB/Helpers.cmake @@ -0,0 +1,28 @@ +set(ALL_FILES_GLOB "*.deb") + +function(getPackageContent FILE RESULT_VAR) + execute_process(COMMAND ${DPKG_EXECUTABLE} -c ${FILE} + OUTPUT_VARIABLE package_content_ + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE) + + set(${RESULT_VAR} "${package_content_}" PARENT_SCOPE) +endfunction() + +function(verifyDebControl FILE PREFIX VERIFY_FILES) + execute_process(COMMAND ${DPKG_EXECUTABLE} --control ${FILE} control_${PREFIX} + ERROR_VARIABLE err_) + + if(err_) + message(FATAL_ERROR "Debian controll verification failed for file: " + "'${FILE}'; error output: '${err_}'") + endif() + + foreach(FILE_ IN LISTS VERIFY_FILES) + file(READ "${CMAKE_CURRENT_BINARY_DIR}/control_${PREFIX}/${FILE_}" content_) + if(NOT content_ MATCHES "${${PREFIX}_${FILE_}}") + message(FATAL_ERROR "Unexpected content in for '${PREFIX}_${FILE_}'!" + " Content: '${content_}'") + endif() + endforeach() +endfunction() diff --git a/Tests/RunCMake/CPack/DEB/MINIMAL-ExpectedFiles.cmake b/Tests/RunCMake/CPack/DEB/MINIMAL-ExpectedFiles.cmake new file mode 100644 index 0000000..9e4aa7c --- /dev/null +++ b/Tests/RunCMake/CPack/DEB/MINIMAL-ExpectedFiles.cmake @@ -0,0 +1,5 @@ +set(whitespaces_ "[\t\n\r ]*") + +set(EXPECTED_FILES_COUNT "1") +set(EXPECTED_FILE_1 "minimal*.deb") +set(EXPECTED_FILE_CONTENT_1 "^.*/usr/${whitespaces_}.*/usr/foo/${whitespaces_}.*/usr/foo/CMakeLists.txt$") diff --git a/Tests/RunCMake/CPack/DEB/MINIMAL-specifics.cmake b/Tests/RunCMake/CPack/DEB/MINIMAL-specifics.cmake new file mode 100644 index 0000000..8821ab9 --- /dev/null +++ b/Tests/RunCMake/CPack/DEB/MINIMAL-specifics.cmake @@ -0,0 +1 @@ +set(CPACK_PACKAGE_CONTACT "someone") 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/DEB_EXTRA.cmake b/Tests/RunCMake/CPack/DEB_EXTRA.cmake new file mode 100644 index 0000000..46d848d --- /dev/null +++ b/Tests/RunCMake/CPack/DEB_EXTRA.cmake @@ -0,0 +1,20 @@ +install(FILES CMakeLists.txt DESTINATION foo COMPONENT foo) +install(FILES CMakeLists.txt DESTINATION bar COMPONENT bar) +install(FILES CMakeLists.txt DESTINATION bas COMPONENT bas) + +file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/preinst "echo default_preinst") +file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/prerm "echo default_prerm") + +set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA + "${CMAKE_CURRENT_BINARY_DIR}/preinst;${CMAKE_CURRENT_BINARY_DIR}/prerm") + +file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/bar/preinst "echo bar_preinst") +file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/bar/prerm "echo bar_prerm") + +set(CPACK_DEBIAN_BAR_PACKAGE_CONTROL_EXTRA + "${CMAKE_CURRENT_BINARY_DIR}/bar/preinst;${CMAKE_CURRENT_BINARY_DIR}/bar/prerm") + +set(CPACK_PACKAGE_NAME "deb_extra") +set(CPACK_PACKAGE_CONTACT "someone") + +set(CPACK_DEB_COMPONENT_INSTALL ON) diff --git a/Tests/RunCMake/CPack/MINIMAL.cmake b/Tests/RunCMake/CPack/MINIMAL.cmake new file mode 100644 index 0000000..f29ad2a --- /dev/null +++ b/Tests/RunCMake/CPack/MINIMAL.cmake @@ -0,0 +1,3 @@ +install(FILES CMakeLists.txt DESTINATION foo COMPONENT test) + +set(CPACK_PACKAGE_NAME "minimal") diff --git a/Tests/RunCMake/CPackRPM/CPackRPM_PARTIALLY_RELOCATABLE_WARNING.cmake b/Tests/RunCMake/CPack/PARTIALLY_RELOCATABLE_WARNING.cmake index 31e729b..31e729b 100644 --- a/Tests/RunCMake/CPackRPM/CPackRPM_PARTIALLY_RELOCATABLE_WARNING.cmake +++ b/Tests/RunCMake/CPack/PARTIALLY_RELOCATABLE_WARNING.cmake diff --git a/Tests/RunCMake/CPack/PreTestError.cmake b/Tests/RunCMake/CPack/PreTestError.cmake new file mode 100644 index 0000000..f88f2e8 --- /dev/null +++ b/Tests/RunCMake/CPack/PreTestError.cmake @@ -0,0 +1,7 @@ +file(READ "${bin_dir}/test_output.txt" output) +file(READ "${bin_dir}/test_error.txt" error) + +message(FATAL_ERROR "Error in pre-test phase '${RunCMake_TEST_STEP}'!\n" + "Return code: '${return_code}'\n" + "Info output: '${output}'\n" + "Error output: '${error}'") diff --git a/Tests/RunCMake/CPack/README.txt b/Tests/RunCMake/CPack/README.txt new file mode 100644 index 0000000..365c737 --- /dev/null +++ b/Tests/RunCMake/CPack/README.txt @@ -0,0 +1,99 @@ +RunCMake.CPack is a test module that is intended for testing of package +generators that can be validated from command line. + +------------- +Adding a test +------------- + +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 +test root directory. +Line that adds a test is: +run_cpack_test(<test_name> "<generator_name>") + +<generator_name> may be one generator e.g. "RPM" or multiple e.g. "RPM;DEB" and +will be run for all listed generators. + +Test consists of +- CMake execution phase +- CPack execution phase +- verification of generated files + +CMake execution phase: +---------------------- + +To add a new CPack test we first create a <test_name>.cmake script that contains +CMake commands that should be used as a preparation script for generation of +different types of packages. This script is placed into CPack test root +directory even if it will be used for only one of the generators. + +If test will be used for multiple generators but some of them require some +generator speciffic commands then those commands should be added to a separate +file that should be located in '<generator_name>/<test_name>-specifics.cmake' +in CPack test root directory. + +CPack execution phase: +---------------------- + +Only exececutes CPack for content that was generated during CMake execution +phase. + +Verification of generated files: +-------------------------------- + +Verification of generated files consists of two phases +- mandatory verification phase +- optional verification phase + +Mandatory verification phase checks that expected files were generated and +contain expected files. +Mandatory verification phase also checks that no other unexpected package files +were generated (this is executed even if EXPECTED_FILES_COUNT contains 0 in +order to verify that no files were generated). +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 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 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 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. + +---------------------- +Adding a new generator +---------------------- + +To add a new generator we must +- add new generator directory (e.g. RPM for RPM generator) to CPack test root + directory that contains 'Helpers.cmake' script. In this script a function + named 'getPackageContent' must exist. This function should list files that + are contained in a package. Function should accept two parameters + + FILE variable that will contain path to file for which the content should be + 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 new file mode 100644 index 0000000..98cdad8 --- /dev/null +++ b/Tests/RunCMake/CPack/RPM/Helpers.cmake @@ -0,0 +1,10 @@ +set(ALL_FILES_GLOB "*.rpm") + +function(getPackageContent FILE RESULT_VAR) + execute_process(COMMAND ${RPM_EXECUTABLE} -pql ${FILE} + OUTPUT_VARIABLE package_content_ + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE) + + set(${RESULT_VAR} "${package_content_}" PARENT_SCOPE) +endfunction() diff --git a/Tests/RunCMake/CPack/RPM/MINIMAL-ExpectedFiles.cmake b/Tests/RunCMake/CPack/RPM/MINIMAL-ExpectedFiles.cmake new file mode 100644 index 0000000..800b78e --- /dev/null +++ b/Tests/RunCMake/CPack/RPM/MINIMAL-ExpectedFiles.cmake @@ -0,0 +1,5 @@ +set(whitespaces_ "[\t\n\r ]*") + +set(EXPECTED_FILES_COUNT "1") +set(EXPECTED_FILE_1 "minimal*.rpm") +set(EXPECTED_FILE_CONTENT_1 "^/usr/foo${whitespaces_}/usr/foo/CMakeLists.txt$") diff --git a/Tests/RunCMake/CPack/RPM/MINIMAL-stderr.txt b/Tests/RunCMake/CPack/RPM/MINIMAL-stderr.txt new file mode 100644 index 0000000..7c5fb46 --- /dev/null +++ b/Tests/RunCMake/CPack/RPM/MINIMAL-stderr.txt @@ -0,0 +1 @@ +^CPackRPM: Will use GENERATED spec file: .*/Tests/RunCMake/RPM/CPack/MINIMAL-build/_CPack_Packages/.*/RPM/SPECS/minimal.spec$ diff --git a/Tests/RunCMake/CPack/RPM/PARTIALLY_RELOCATABLE_WARNING-ExpectedFiles.cmake b/Tests/RunCMake/CPack/RPM/PARTIALLY_RELOCATABLE_WARNING-ExpectedFiles.cmake new file mode 100644 index 0000000..4e01f7b --- /dev/null +++ b/Tests/RunCMake/CPack/RPM/PARTIALLY_RELOCATABLE_WARNING-ExpectedFiles.cmake @@ -0,0 +1,5 @@ +set(whitespaces_ "[\t\n\r ]*") + +set(EXPECTED_FILES_COUNT "1") +set(EXPECTED_FILE_1 "PARTIALLY_RELOCATABLE_WARNING-0.1.1-*.rpm") +set(EXPECTED_FILE_CONTENT_1 "^/not_relocatable${whitespaces_}/not_relocatable/CMakeLists.txt${whitespaces_}/opt$") diff --git a/Tests/RunCMake/CPackRPM/CPackRPM_PARTIALLY_RELOCATABLE_WARNING-stderr.txt b/Tests/RunCMake/CPack/RPM/PARTIALLY_RELOCATABLE_WARNING-stderr.txt index 3b63d5b..3b63d5b 100644 --- a/Tests/RunCMake/CPackRPM/CPackRPM_PARTIALLY_RELOCATABLE_WARNING-stderr.txt +++ b/Tests/RunCMake/CPack/RPM/PARTIALLY_RELOCATABLE_WARNING-stderr.txt diff --git a/Tests/RunCMake/CPack/RPM/Prerequirements.cmake b/Tests/RunCMake/CPack/RPM/Prerequirements.cmake new file mode 100644 index 0000000..3416205 --- /dev/null +++ b/Tests/RunCMake/CPack/RPM/Prerequirements.cmake @@ -0,0 +1,16 @@ +function(get_test_prerequirements found_var config_file) + if(CMAKE_CURRENT_BINARY_DIR MATCHES " ") + # rpmbuild can't handle spaces in path + return() + endif() + + find_program(RPM_EXECUTABLE rpm) + find_program(RPMBUILD_EXECUTABLE rpmbuild) + + if(RPM_EXECUTABLE AND RPMBUILD_EXECUTABLE) + file(WRITE "${config_file}" "set(RPM_EXECUTABLE \"${RPM_EXECUTABLE}\")") + file(APPEND "${config_file}" + "\nset(RPMBUILD_EXECUTABLE \"${RPMBUILD_EXECUTABLE}\")") + set(${found_var} true PARENT_SCOPE) + endif() +endfunction() diff --git a/Tests/RunCMake/CPack/RunCMakeTest.cmake b/Tests/RunCMake/CPack/RunCMakeTest.cmake new file mode 100644 index 0000000..97ef238 --- /dev/null +++ b/Tests/RunCMake/CPack/RunCMakeTest.cmake @@ -0,0 +1,9 @@ +cmake_minimum_required(VERSION 3.1 FATAL_ERROR) + +include(RunCMake) +include("${RunCMake_SOURCE_DIR}/CPackTestHelpers.cmake") + +# args: TEST_NAME "GENERATORS" RUN_CMAKE_BUILD_STEP +run_cpack_test(MINIMAL "RPM;DEB" false) +run_cpack_test(PARTIALLY_RELOCATABLE_WARNING "RPM" false) +run_cpack_test(DEB_EXTRA "DEB" false) diff --git a/Tests/RunCMake/CPack/VerifyResult.cmake b/Tests/RunCMake/CPack/VerifyResult.cmake new file mode 100644 index 0000000..e059d9c --- /dev/null +++ b/Tests/RunCMake/CPack/VerifyResult.cmake @@ -0,0 +1,91 @@ +cmake_minimum_required(VERSION 3.1 FATAL_ERROR) + +include("${config_file}") +include("${src_dir}/${GENERATOR_TYPE}/Helpers.cmake") + +file(READ "${bin_dir}/test_output.txt" output) +file(READ "${bin_dir}/test_error.txt" error) +file(READ "${config_file}" config_file_content) + +set(output_error_message + "\nCPack output: '${output}'\nCPack error: '${error}';\nconfig file: '${config_file_content}'") + +# check that expected generated files exist and contain expected content +include("${src_dir}/${GENERATOR_TYPE}/${RunCMake_TEST}-ExpectedFiles.cmake") + +if(NOT EXPECTED_FILES_COUNT EQUAL 0) + foreach(file_no_ RANGE 1 ${EXPECTED_FILES_COUNT}) + file(GLOB FOUND_FILE_${file_no_} RELATIVE "${bin_dir}" "${EXPECTED_FILE_${file_no_}}") + set(foundFiles_ "${foundFiles_};${FOUND_FILE_${file_no_}}") + list(LENGTH FOUND_FILE_${file_no_} foundFilesCount_) + + if(foundFilesCount_ EQUAL 1) + unset(PACKAGE_CONTENT) + getPackageContent("${bin_dir}/${FOUND_FILE_${file_no_}}" "PACKAGE_CONTENT") + + string(REGEX MATCH "${EXPECTED_FILE_CONTENT_${file_no_}}" + expected_content_list "${PACKAGE_CONTENT}") + + if(NOT expected_content_list) + message(FATAL_ERROR + "Unexpected file content for file No. '${file_no_}'!" + " Content: '${PACKAGE_CONTENT}'" + "${output_error_message}") + endif() + else() + message(FATAL_ERROR + "Found more than one file for file No. '${file_no_}'!" + " Found files count '${foundFilesCount_}'." + " Files: '${FOUND_FILE_${file_no_}}'" + "${output_error_message}") + endif() + endforeach() + + # check that there were no extra files generated + foreach(all_files_glob_ IN LISTS ALL_FILES_GLOB) + file(GLOB foundAll_ RELATIVE "${bin_dir}" "${all_files_glob_}") + set(allFoundFiles_ "${allFoundFiles_};${foundAll_}") + endforeach() + + list(LENGTH foundFiles_ foundFilesCount_) + list(LENGTH allFoundFiles_ allFoundFilesCount_) + + if(NOT foundFilesCount_ EQUAL allFoundFilesCount_) + message(FATAL_ERROR + "Found more files than expected! Found files: '${allFoundFiles_}'" + "${output_error_message}") + endif() + + # sanity check that we didn't accidentaly list wrong files with our regular + # expressions + foreach(expected_ IN LISTS allFoundFiles_) + list(FIND foundFiles_ "${expected_}" found_) + + if(found_ EQUAL -1) + message(FATAL_ERROR + "Expected files don't match found files! Found files:" + " '${allFoundFiles_}'" + "${output_error_message}") + endif() + endforeach() +else() + # there should be no generated files present + foreach(missing_file_glob_ IN LISTS ALL_FILES_GLOB) + file(GLOB checkMissingFiles_ RELATIVE "${bin_dir}" "${missing_file_glob_}") + + if(checkMissingFiles_) + message(FATAL_ERROR "Unexpected files found: '${checkMissingFiles_}'" + "${output_error_message}") + endif() + endforeach() +endif() + +# handle additional result verifications +if(EXISTS "${src_dir}/${GENERATOR_TYPE}/${RunCMake_TEST}-VerifyResult.cmake") + include("${src_dir}/${GENERATOR_TYPE}/${RunCMake_TEST}-VerifyResult.cmake") +else() + # by default only print out output and error so that they can be compared by + # regex + message(STATUS "${output}") + message("${error}") +endif() diff --git a/Tests/RunCMake/CPackRPM/CMakeLists.txt b/Tests/RunCMake/CPackRPM/CMakeLists.txt deleted file mode 100644 index b7d170b..0000000 --- a/Tests/RunCMake/CPackRPM/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 3.1 FATAL_ERROR) - -project(${RunCMake_TEST} NONE) -include(${RunCMake_TEST}.cmake) - -set(CPACK_GENERATOR "RPM") -include(CPack) diff --git a/Tests/RunCMake/CPackRPM/RunCMakeTest.cmake b/Tests/RunCMake/CPackRPM/RunCMakeTest.cmake deleted file mode 100644 index 1935e32..0000000 --- a/Tests/RunCMake/CPackRPM/RunCMakeTest.cmake +++ /dev/null @@ -1,17 +0,0 @@ -include(RunCMake) - -function(run_cpack_rpm_test TEST_NAME) - set(RunCMake_TEST_NO_CLEAN TRUE) - set(RunCMake_TEST_BINARY_DIR "${RunCMake_BINARY_DIR}/${TEST_NAME}-build") - file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") - file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") - execute_process( - COMMAND "${CMAKE_COMMAND}" -D RunCMake_TEST=${TEST_NAME} "${RunCMake_SOURCE_DIR}" - WORKING_DIRECTORY "${RunCMake_TEST_BINARY_DIR}" - OUTPUT_QUIET - ERROR_QUIET - ) - run_cmake_command(${TEST_NAME} ${CMAKE_CPACK_COMMAND}) -endfunction() - -run_cpack_rpm_test(CPackRPM_PARTIALLY_RELOCATABLE_WARNING) diff --git a/Tests/RunCMake/CTestCommandLine/LabelCount-stdout.txt b/Tests/RunCMake/CTestCommandLine/LabelCount-stdout.txt new file mode 100644 index 0000000..7fe04eb --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/LabelCount-stdout.txt @@ -0,0 +1,7 @@ +100% tests passed, 0 tests failed out of 4 ++ ++Label Time Summary: ++'bar' = +[0-9.]+ sec \(3 tests\) ++'foo' = +[0-9.]+ sec \(1 test\) ++ +Total Test time \(real\) = +[0-9.]+ sec diff --git a/Tests/RunCMake/CTestCommandLine/MergeOutput-stdout.txt b/Tests/RunCMake/CTestCommandLine/MergeOutput-stdout.txt new file mode 100644 index 0000000..af7cdc5 --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/MergeOutput-stdout.txt @@ -0,0 +1,13 @@ +Test timeout computed to be: [^ +]+ +1: -- Output on stdout +1: Output on stderr +1: -- Output on stdout +1: Output on stderr +1: -- Output on stdout +1: Output on stderr +1: -- Output on stdout +1: Output on stderr +1: -- Output on stdout +1: Output on stderr +1/1 Test #1: MergeOutput diff --git a/Tests/RunCMake/CTestCommandLine/MergeOutput.cmake b/Tests/RunCMake/CTestCommandLine/MergeOutput.cmake new file mode 100644 index 0000000..528ac90 --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/MergeOutput.cmake @@ -0,0 +1,4 @@ +foreach(i RANGE 1 5) + message(STATUS "Output on stdout") + message("Output on stderr") +endforeach() diff --git a/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake index 0cb11ac..dfc1e33 100644 --- a/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake +++ b/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake @@ -1,4 +1,5 @@ include(RunCMake) +set(RunCMake_TEST_TIMEOUT 60) unset(ENV{CTEST_PARALLEL_LEVEL}) unset(ENV{CTEST_OUTPUT_ON_FAILURE}) @@ -39,3 +40,71 @@ subdirs() run_cmake_command(BadCTestTestfile ${CMAKE_CTEST_COMMAND}) endfunction() run_BadCTestTestfile() + +function(run_MergeOutput) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/MergeOutput) + set(RunCMake_TEST_NO_CLEAN 1) + file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") + file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") + file(WRITE "${RunCMake_TEST_BINARY_DIR}/CTestTestfile.cmake" " +add_test(MergeOutput \"${CMAKE_COMMAND}\" -P \"${RunCMake_SOURCE_DIR}/MergeOutput.cmake\") +") + + run_cmake_command(MergeOutput ${CMAKE_CTEST_COMMAND} -V) +endfunction() +run_MergeOutput() + +function(run_LabelCount) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/LabelCount) + set(RunCMake_TEST_NO_CLEAN 1) + file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") + file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") + file(WRITE "${RunCMake_TEST_BINARY_DIR}/CTestTestfile.cmake" " +add_test(test1 \"${CMAKE_COMMAND}\" -E echo \"test1\") +set_tests_properties(test1 PROPERTIES LABELS 'bar') + +add_test(test2 \"${CMAKE_COMMAND}\" -E echo \"test2\") +set_tests_properties(test2 PROPERTIES LABELS 'bar') + +add_test(test3 \"${CMAKE_COMMAND}\" -E echo \"test3\") +set_tests_properties(test3 PROPERTIES LABELS 'foo') + +add_test(test4 \"${CMAKE_COMMAND}\" -E echo \"test4\") +set_tests_properties(test4 PROPERTIES LABELS 'bar') +") + + run_cmake_command(LabelCount ${CMAKE_CTEST_COMMAND} -V) +endfunction() + +run_LabelCount() + +function(run_TestLoad name load) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/TestLoad) + set(RunCMake_TEST_NO_CLEAN 1) + file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") + file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") + file(WRITE "${RunCMake_TEST_BINARY_DIR}/CTestTestfile.cmake" " + add_test(TestLoad1 \"${CMAKE_COMMAND}\" -E echo \"test of --test-load\") + add_test(TestLoad2 \"${CMAKE_COMMAND}\" -E echo \"test of --test-load\") +") + run_cmake_command(${name} ${CMAKE_CTEST_COMMAND} -j2 --test-load ${load} --test-timeout 5) +endfunction() + +# Tests for the --test-load feature of ctest +# +# Spoof a load average value to make these tests more reliable. +set(ENV{__CTEST_FAKE_LOAD_AVERAGE_FOR_TESTING} 5) + +# Verify that new tests are not started when the load average exceeds +# our threshold. +run_TestLoad(test-load-fail 2) + +# Verify that warning message is displayed but tests still start when +# an invalid argument is given. +run_TestLoad(test-load-invalid 'two') + +# Verify that new tests are started when the load average falls below +# our threshold. +run_TestLoad(test-load-pass 10) + +unset(ENV{__CTEST_FAKE_LOAD_AVERAGE_FOR_TESTING}) diff --git a/Tests/RunCMake/CTestCommandLine/test-load-fail-stderr.txt b/Tests/RunCMake/CTestCommandLine/test-load-fail-stderr.txt new file mode 100644 index 0000000..eafba1c --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/test-load-fail-stderr.txt @@ -0,0 +1 @@ +No tests were found!!! diff --git a/Tests/RunCMake/CTestCommandLine/test-load-fail-stdout.txt b/Tests/RunCMake/CTestCommandLine/test-load-fail-stdout.txt new file mode 100644 index 0000000..153da09 --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/test-load-fail-stdout.txt @@ -0,0 +1,2 @@ +^Test project .*/Tests/RunCMake/CTestCommandLine/TestLoad +\*\*\*\*\* WAITING, System Load: 5, Max Allowed Load: 2, Smallest test TestLoad[1-2] requires 1\*\*\*\*\* diff --git a/Tests/RunCMake/CTestCommandLine/test-load-invalid-stderr.txt b/Tests/RunCMake/CTestCommandLine/test-load-invalid-stderr.txt new file mode 100644 index 0000000..caab3b9 --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/test-load-invalid-stderr.txt @@ -0,0 +1 @@ +Invalid value for 'Test Load' : 'two' diff --git a/Tests/RunCMake/CTestCommandLine/test-load-invalid-stdout.txt b/Tests/RunCMake/CTestCommandLine/test-load-invalid-stdout.txt new file mode 100644 index 0000000..7ee3dae --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/test-load-invalid-stdout.txt @@ -0,0 +1,7 @@ +^Test project .*/Tests/RunCMake/CTestCommandLine/TestLoad + Start 1: TestLoad1 + Start 2: TestLoad2 +1/2 Test #[1-2]: TestLoad[1-2] ........................ Passed +[0-9.]+ sec +2/2 Test #[1-2]: TestLoad[1-2] ........................ Passed +[0-9.]+ sec ++ +100% tests passed, 0 tests failed out of 2 diff --git a/Tests/RunCMake/CTestCommandLine/test-load-pass-stderr.txt b/Tests/RunCMake/CTestCommandLine/test-load-pass-stderr.txt new file mode 100644 index 0000000..10f3293 --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/test-load-pass-stderr.txt @@ -0,0 +1 @@ +^$ diff --git a/Tests/RunCMake/CTestCommandLine/test-load-pass-stdout.txt b/Tests/RunCMake/CTestCommandLine/test-load-pass-stdout.txt new file mode 100644 index 0000000..7ee3dae --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/test-load-pass-stdout.txt @@ -0,0 +1,7 @@ +^Test project .*/Tests/RunCMake/CTestCommandLine/TestLoad + Start 1: TestLoad1 + Start 2: TestLoad2 +1/2 Test #[1-2]: TestLoad[1-2] ........................ Passed +[0-9.]+ sec +2/2 Test #[1-2]: TestLoad[1-2] ........................ Passed +[0-9.]+ sec ++ +100% tests passed, 0 tests failed out of 2 diff --git a/Tests/RunCMake/CommandLine/BuildDir.cmake b/Tests/RunCMake/CommandLine/BuildDir.cmake new file mode 100644 index 0000000..30030a7 --- /dev/null +++ b/Tests/RunCMake/CommandLine/BuildDir.cmake @@ -0,0 +1 @@ +add_subdirectory(BuildDir) diff --git a/Tests/RunCMake/CommandLine/BuildDir/CMakeLists.txt b/Tests/RunCMake/CommandLine/BuildDir/CMakeLists.txt new file mode 100644 index 0000000..20df108 --- /dev/null +++ b/Tests/RunCMake/CommandLine/BuildDir/CMakeLists.txt @@ -0,0 +1,5 @@ +add_custom_command( + OUTPUT output.txt + COMMAND ${CMAKE_COMMAND} -E echo CustomCommand > output.txt + ) +add_custom_target(CustomTarget ALL DEPENDS output.txt) diff --git a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake index 69beed9..84d4cc9 100644 --- a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake +++ b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake @@ -22,13 +22,30 @@ run_cmake_command(G_bad-arg ${CMAKE_COMMAND} -G NoSuchGenerator) run_cmake_command(P_no-arg ${CMAKE_COMMAND} -P) run_cmake_command(P_no-file ${CMAKE_COMMAND} -P nosuchscriptfile.cmake) +run_cmake_command(build-no-dir + ${CMAKE_COMMAND} --build) run_cmake_command(build-no-cache ${CMAKE_COMMAND} --build ${RunCMake_SOURCE_DIR}) run_cmake_command(build-no-generator ${CMAKE_COMMAND} --build ${RunCMake_SOURCE_DIR}/cache-no-generator) +run_cmake_command(build-bad-dir + ${CMAKE_COMMAND} --build dir-does-not-exist) run_cmake_command(build-bad-generator ${CMAKE_COMMAND} --build ${RunCMake_SOURCE_DIR}/cache-bad-generator) +function(run_BuildDir) + # Use a single build tree for a few tests without cleaning. + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/BuildDir-build) + set(RunCMake_TEST_NO_CLEAN 1) + file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") + file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") + + run_cmake(BuildDir) + run_cmake_command(BuildDir--build ${CMAKE_COMMAND} -E chdir .. + ${CMAKE_COMMAND} --build BuildDir-build --target CustomTarget) +endfunction() +run_BuildDir() + if(RunCMake_GENERATOR STREQUAL "Ninja") # Use a single build tree for a few tests without cleaning. set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/Build-build) diff --git a/Tests/RunCMake/CommandLine/build-bad-dir-result.txt b/Tests/RunCMake/CommandLine/build-bad-dir-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CommandLine/build-bad-dir-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CommandLine/build-bad-dir-stderr.txt b/Tests/RunCMake/CommandLine/build-bad-dir-stderr.txt new file mode 100644 index 0000000..d3f3d9c --- /dev/null +++ b/Tests/RunCMake/CommandLine/build-bad-dir-stderr.txt @@ -0,0 +1,2 @@ +^Error: [^ +]+/Tests/RunCMake/CommandLine/build-bad-dir-build/dir-does-not-exist is not a directory$ diff --git a/Tests/RunCMake/CommandLine/build-no-dir-result.txt b/Tests/RunCMake/CommandLine/build-no-dir-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CommandLine/build-no-dir-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CommandLine/build-no-dir-stderr.txt b/Tests/RunCMake/CommandLine/build-no-dir-stderr.txt new file mode 100644 index 0000000..8d518f6 --- /dev/null +++ b/Tests/RunCMake/CommandLine/build-no-dir-stderr.txt @@ -0,0 +1 @@ +^Usage: cmake --build <dir> \[options\] \[-- \[native-options\]\] diff --git a/Tests/RunCMake/CompilerLauncher/C-Build-stdout.txt b/Tests/RunCMake/CompilerLauncher/C-Build-stdout.txt new file mode 100644 index 0000000..3313e31 --- /dev/null +++ b/Tests/RunCMake/CompilerLauncher/C-Build-stdout.txt @@ -0,0 +1 @@ +.*-E env USED_LAUNCHER=1.* diff --git a/Tests/RunCMake/CompilerLauncher/C-launch-Build-stdout.txt b/Tests/RunCMake/CompilerLauncher/C-launch-Build-stdout.txt new file mode 100644 index 0000000..3313e31 --- /dev/null +++ b/Tests/RunCMake/CompilerLauncher/C-launch-Build-stdout.txt @@ -0,0 +1 @@ +.*-E env USED_LAUNCHER=1.* diff --git a/Tests/RunCMake/CompilerLauncher/C-launch.cmake b/Tests/RunCMake/CompilerLauncher/C-launch.cmake new file mode 100644 index 0000000..e66ca20 --- /dev/null +++ b/Tests/RunCMake/CompilerLauncher/C-launch.cmake @@ -0,0 +1,3 @@ +set(CTEST_USE_LAUNCHERS 1) +include(CTestUseLaunchers) +include(C.cmake) diff --git a/Tests/RunCMake/CompilerLauncher/C.cmake b/Tests/RunCMake/CompilerLauncher/C.cmake new file mode 100644 index 0000000..67bf7c4 --- /dev/null +++ b/Tests/RunCMake/CompilerLauncher/C.cmake @@ -0,0 +1,4 @@ +enable_language(C) +set(CMAKE_C_COMPILER_LAUNCHER "${CMAKE_COMMAND};-E;env;USED_LAUNCHER=1") +set(CMAKE_VERBOSE_MAKEFILE TRUE) +add_executable(main main.c) diff --git a/Tests/RunCMake/CompilerLauncher/CMakeLists.txt b/Tests/RunCMake/CompilerLauncher/CMakeLists.txt new file mode 100644 index 0000000..18dfd26 --- /dev/null +++ b/Tests/RunCMake/CompilerLauncher/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.2) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/CompilerLauncher/CXX-Build-stdout.txt b/Tests/RunCMake/CompilerLauncher/CXX-Build-stdout.txt new file mode 100644 index 0000000..3313e31 --- /dev/null +++ b/Tests/RunCMake/CompilerLauncher/CXX-Build-stdout.txt @@ -0,0 +1 @@ +.*-E env USED_LAUNCHER=1.* diff --git a/Tests/RunCMake/CompilerLauncher/CXX-launch-Build-stdout.txt b/Tests/RunCMake/CompilerLauncher/CXX-launch-Build-stdout.txt new file mode 100644 index 0000000..3313e31 --- /dev/null +++ b/Tests/RunCMake/CompilerLauncher/CXX-launch-Build-stdout.txt @@ -0,0 +1 @@ +.*-E env USED_LAUNCHER=1.* diff --git a/Tests/RunCMake/CompilerLauncher/CXX-launch.cmake b/Tests/RunCMake/CompilerLauncher/CXX-launch.cmake new file mode 100644 index 0000000..3002c9d --- /dev/null +++ b/Tests/RunCMake/CompilerLauncher/CXX-launch.cmake @@ -0,0 +1,3 @@ +set(CTEST_USE_LAUNCHERS 1) +include(CTestUseLaunchers) +include(CXX.cmake) diff --git a/Tests/RunCMake/CompilerLauncher/CXX.cmake b/Tests/RunCMake/CompilerLauncher/CXX.cmake new file mode 100644 index 0000000..cdd3478 --- /dev/null +++ b/Tests/RunCMake/CompilerLauncher/CXX.cmake @@ -0,0 +1,4 @@ +enable_language(CXX) +set(CMAKE_CXX_COMPILER_LAUNCHER "${CMAKE_COMMAND};-E;env;USED_LAUNCHER=1") +set(CMAKE_VERBOSE_MAKEFILE TRUE) +add_executable(main main.cxx) diff --git a/Tests/RunCMake/CompilerLauncher/RunCMakeTest.cmake b/Tests/RunCMake/CompilerLauncher/RunCMakeTest.cmake new file mode 100644 index 0000000..5884d5c --- /dev/null +++ b/Tests/RunCMake/CompilerLauncher/RunCMakeTest.cmake @@ -0,0 +1,23 @@ +include(RunCMake) + +function(run_compiler_launcher lang) + # Use a single build tree for tests without cleaning. + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${lang}-build) + set(RunCMake_TEST_NO_CLEAN 1) + file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") + file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") + run_cmake(${lang}) + + set(RunCMake_TEST_OUTPUT_MERGE 1) + if("${RunCMake_GENERATOR}" STREQUAL "Ninja") + set(verbose_args -- -v) + endif() + run_cmake_command(${lang}-Build ${CMAKE_COMMAND} --build . ${verbose_args}) +endfunction() + +run_compiler_launcher(C) +run_compiler_launcher(CXX) +if (NOT RunCMake_GENERATOR STREQUAL "Watcom WMake") + run_compiler_launcher(C-launch) + run_compiler_launcher(CXX-launch) +endif() diff --git a/Tests/RunCMake/CompilerLauncher/main.c b/Tests/RunCMake/CompilerLauncher/main.c new file mode 100644 index 0000000..03b2213 --- /dev/null +++ b/Tests/RunCMake/CompilerLauncher/main.c @@ -0,0 +1,3 @@ +int main(void) { + return 0; +} diff --git a/Tests/RunCMake/CompilerLauncher/main.cxx b/Tests/RunCMake/CompilerLauncher/main.cxx new file mode 100644 index 0000000..76e8197 --- /dev/null +++ b/Tests/RunCMake/CompilerLauncher/main.cxx @@ -0,0 +1 @@ +int main() { return 0; } diff --git a/Tests/RunCMake/ExternalProject/RunCMakeTest.cmake b/Tests/RunCMake/ExternalProject/RunCMakeTest.cmake index e038409..47d6129 100644 --- a/Tests/RunCMake/ExternalProject/RunCMakeTest.cmake +++ b/Tests/RunCMake/ExternalProject/RunCMakeTest.cmake @@ -11,3 +11,4 @@ run_cmake(Add_StepDependencies) run_cmake(Add_StepDependencies_iface) run_cmake(Add_StepDependencies_iface_step) run_cmake(Add_StepDependencies_no_target) +run_cmake(UsesTerminal) diff --git a/Tests/RunCMake/ExternalProject/UsesTerminal-check.cmake b/Tests/RunCMake/ExternalProject/UsesTerminal-check.cmake new file mode 100644 index 0000000..201d822 --- /dev/null +++ b/Tests/RunCMake/ExternalProject/UsesTerminal-check.cmake @@ -0,0 +1,97 @@ +cmake_minimum_required(VERSION 3.3) + +# If we are using the Ninja generator, we can check and verify that the +# USES_TERMINAL option actually works by examining the Ninja build file. +# This is the only way, since CMake doesn't offer a way to examine the +# options on a custom command after it has been added. Furthermore, +# there isn't an easy way to test for this by actually running Ninja. +# +# Other generators don't currently support USES_TERMINAL at this time. +# This file can be improved to support them if they do. Until then, we +# simply assume success for new generator types. +# +# For Ninja, there is a complication. If the Ninja generator detects a +# version of Ninja < 1.5, it won't actually emit the console pool command, +# because those Ninja versions don't yet support the console pool. In +# that case, we also have to assume success. + +# Check Ninja build output to verify whether or not a target step is in the +# console pool. +macro(CheckNinjaStep _target _step _require) + if("${_build}" MATCHES +" DESC = Performing ${_step} step for '${_target}' + pool = console" + ) + if(NOT ${_require}) + set(RunCMake_TEST_FAILED "${_target} ${_step} step is in console pool") + return() + endif() + else() + if(${_require}) + set(RunCMake_TEST_FAILED "${_target} ${_step} step not in console pool") + return() + endif() + endif() +endmacro() + +# Check Ninja build output to verify whether each target step is in the +# console pool. +macro(CheckNinjaTarget _target + _download _update _configure _build _test _install + ) + CheckNinjaStep(${_target} download ${_download}) + CheckNinjaStep(${_target} update ${_update}) + CheckNinjaStep(${_target} configure ${_configure}) + CheckNinjaStep(${_target} build ${_build}) + CheckNinjaStep(${_target} test ${_test}) + CheckNinjaStep(${_target} install ${_install}) +endmacro() + +# Load build/make file, depending on generator +if(RunCMake_GENERATOR STREQUAL Ninja) + # Check the Ninja version. If < 1.5, console pool isn't supported and + # so the generator would not emit console pool usage. That would cause + # this test to fail. + execute_process(COMMAND ${RunCMake_MAKE_PROGRAM} --version + RESULT_VARIABLE _version_result + OUTPUT_VARIABLE _version + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + if(_version_result OR _version VERSION_EQUAL "0") + set(RunCMake_TEST_FAILED "Failed to get Ninja version") + return() + endif() + if(_version VERSION_LESS "1.5") + return() # console pool not supported on Ninja < 1.5 + endif() + + # Read the Ninja build file + set(_build_file "${RunCMake_TEST_BINARY_DIR}/build.ninja") + + if(NOT EXISTS "${_build_file}") + set(RunCMake_TEST_FAILED "Ninja build file not created") + return() + endif() + + file(READ "${_build_file}" _build) + + set(_target_check_macro CheckNinjaTarget) +elseif((RunCMake_GENERATOR STREQUAL "") OR NOT DEFINED RunCMake_GENERATOR) + # protection in case somebody renamed RunCMake_GENERATOR + set(RunCMake_TEST_FAILED "Unknown generator") + return() +else() + # We don't yet know how to test USES_TERMINAL on this generator. + return() +endif() + +# Actual tests: +CheckNinjaTarget(TerminalTest1 + true true true true true true ) +CheckNinjaTarget(TerminalTest2 + true false true false true false) +CheckNinjaTarget(TerminalTest3 + false true false true false true ) +CheckNinjaTarget(TerminalTest4 + false false false false false false) diff --git a/Tests/RunCMake/ExternalProject/UsesTerminal.cmake b/Tests/RunCMake/ExternalProject/UsesTerminal.cmake new file mode 100644 index 0000000..cd87403 --- /dev/null +++ b/Tests/RunCMake/ExternalProject/UsesTerminal.cmake @@ -0,0 +1,45 @@ +if(NOT CMAKE_CONFIGURATION_TYPES) + set(CMAKE_BUILD_TYPE Debug) +endif() +include(ExternalProject) + +# Test various combinations of USES_TERMINAL with ExternalProject_Add. + +macro(DoTerminalTest _target) + ExternalProject_Add(${_target} + DOWNLOAD_COMMAND "${CMAKE_COMMAND}" -E echo "download" + UPDATE_COMMAND "${CMAKE_COMMAND}" -E echo "update" + CONFIGURE_COMMAND "${CMAKE_COMMAND}" -E echo "configure" + BUILD_COMMAND "${CMAKE_COMMAND}" -E echo "build" + TEST_COMMAND "${CMAKE_COMMAND}" -E echo "test" + INSTALL_COMMAND "${CMAKE_COMMAND}" -E echo "install" + ${ARGN} + ) +endmacro() + +# USES_TERMINAL on all steps +DoTerminalTest(TerminalTest1 + USES_TERMINAL_DOWNLOAD 1 + USES_TERMINAL_UPDATE 1 + USES_TERMINAL_CONFIGURE 1 + USES_TERMINAL_BUILD 1 + USES_TERMINAL_TEST 1 + USES_TERMINAL_INSTALL 1 + ) + +# USES_TERMINAL on every other step, starting with download +DoTerminalTest(TerminalTest2 + USES_TERMINAL_DOWNLOAD 1 + USES_TERMINAL_CONFIGURE 1 + USES_TERMINAL_TEST 1 + ) + +# USES_TERMINAL on every other step, starting with update +DoTerminalTest(TerminalTest3 + USES_TERMINAL_UPDATE 1 + USES_TERMINAL_BUILD 1 + USES_TERMINAL_INSTALL 1 + ) + +# USES_TERMINAL on no step +DoTerminalTest(TerminalTest4) diff --git a/Tests/RunCMake/GNUInstallDirs/CMakeLists.txt b/Tests/RunCMake/GNUInstallDirs/CMakeLists.txt new file mode 100644 index 0000000..74b3ff8 --- /dev/null +++ b/Tests/RunCMake/GNUInstallDirs/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.3) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/GNUInstallDirs/Common.cmake b/Tests/RunCMake/GNUInstallDirs/Common.cmake new file mode 100644 index 0000000..eff2d54 --- /dev/null +++ b/Tests/RunCMake/GNUInstallDirs/Common.cmake @@ -0,0 +1,28 @@ +set(CMAKE_SIZEOF_VOID_P 8) +set(CMAKE_LIBRARY_ARCHITECTURE "arch") +if(CMAKE_SYSTEM_NAME STREQUAL "OpenBSD") + set(CMAKE_SYSTEM_NAME "OpenBSD-Fake") +endif() +include(GNUInstallDirs) +set(dirs + BINDIR + DATADIR + DATAROOTDIR + DOCDIR + INCLUDEDIR + INFODIR + LIBDIR + LIBEXECDIR + LOCALEDIR + LOCALSTATEDIR + MANDIR + SBINDIR + SHAREDSTATEDIR + SYSCONFDIR + ) +foreach(dir ${dirs}) + message("CMAKE_INSTALL_${dir}='${CMAKE_INSTALL_${dir}}'") +endforeach() +foreach(dir ${dirs}) + message("CMAKE_INSTALL_FULL_${dir}='${CMAKE_INSTALL_FULL_${dir}}'") +endforeach() diff --git a/Tests/RunCMake/GNUInstallDirs/Opt-stderr.txt b/Tests/RunCMake/GNUInstallDirs/Opt-stderr.txt new file mode 100644 index 0000000..aee8552 --- /dev/null +++ b/Tests/RunCMake/GNUInstallDirs/Opt-stderr.txt @@ -0,0 +1,28 @@ +^CMAKE_INSTALL_BINDIR='bin' +CMAKE_INSTALL_DATADIR='share' +CMAKE_INSTALL_DATAROOTDIR='share' +CMAKE_INSTALL_DOCDIR='share/doc/Opt' +CMAKE_INSTALL_INCLUDEDIR='include' +CMAKE_INSTALL_INFODIR='share/info' +CMAKE_INSTALL_LIBDIR='(lib|lib64)' +CMAKE_INSTALL_LIBEXECDIR='libexec' +CMAKE_INSTALL_LOCALEDIR='share/locale' +CMAKE_INSTALL_LOCALSTATEDIR='var' +CMAKE_INSTALL_MANDIR='share/man' +CMAKE_INSTALL_SBINDIR='sbin' +CMAKE_INSTALL_SHAREDSTATEDIR='com' +CMAKE_INSTALL_SYSCONFDIR='etc' +CMAKE_INSTALL_FULL_BINDIR='/opt/Opt/bin' +CMAKE_INSTALL_FULL_DATADIR='/opt/Opt/share' +CMAKE_INSTALL_FULL_DATAROOTDIR='/opt/Opt/share' +CMAKE_INSTALL_FULL_DOCDIR='/opt/Opt/share/doc/Opt' +CMAKE_INSTALL_FULL_INCLUDEDIR='/opt/Opt/include' +CMAKE_INSTALL_FULL_INFODIR='/opt/Opt/share/info' +CMAKE_INSTALL_FULL_LIBDIR='/opt/Opt/(lib|lib64)' +CMAKE_INSTALL_FULL_LIBEXECDIR='/opt/Opt/libexec' +CMAKE_INSTALL_FULL_LOCALEDIR='/opt/Opt/share/locale' +CMAKE_INSTALL_FULL_LOCALSTATEDIR='/var/opt/Opt' +CMAKE_INSTALL_FULL_MANDIR='/opt/Opt/share/man' +CMAKE_INSTALL_FULL_SBINDIR='/opt/Opt/sbin' +CMAKE_INSTALL_FULL_SHAREDSTATEDIR='/opt/Opt/com' +CMAKE_INSTALL_FULL_SYSCONFDIR='/etc/opt/Opt'$ diff --git a/Tests/RunCMake/GNUInstallDirs/Opt.cmake b/Tests/RunCMake/GNUInstallDirs/Opt.cmake new file mode 100644 index 0000000..49eab0e --- /dev/null +++ b/Tests/RunCMake/GNUInstallDirs/Opt.cmake @@ -0,0 +1,2 @@ +set(CMAKE_INSTALL_PREFIX "/opt/${PROJECT_NAME}") +include(Common.cmake) diff --git a/Tests/RunCMake/GNUInstallDirs/Root-stderr.txt b/Tests/RunCMake/GNUInstallDirs/Root-stderr.txt new file mode 100644 index 0000000..a95400e --- /dev/null +++ b/Tests/RunCMake/GNUInstallDirs/Root-stderr.txt @@ -0,0 +1,28 @@ +^CMAKE_INSTALL_BINDIR='usr/bin' +CMAKE_INSTALL_DATADIR='usr/share' +CMAKE_INSTALL_DATAROOTDIR='usr/share' +CMAKE_INSTALL_DOCDIR='usr/share/doc/Root' +CMAKE_INSTALL_INCLUDEDIR='usr/include' +CMAKE_INSTALL_INFODIR='usr/share/info' +CMAKE_INSTALL_LIBDIR='usr/(lib|lib64)' +CMAKE_INSTALL_LIBEXECDIR='usr/libexec' +CMAKE_INSTALL_LOCALEDIR='usr/share/locale' +CMAKE_INSTALL_LOCALSTATEDIR='var' +CMAKE_INSTALL_MANDIR='usr/share/man' +CMAKE_INSTALL_SBINDIR='usr/sbin' +CMAKE_INSTALL_SHAREDSTATEDIR='usr/com' +CMAKE_INSTALL_SYSCONFDIR='etc' +CMAKE_INSTALL_FULL_BINDIR='/usr/bin' +CMAKE_INSTALL_FULL_DATADIR='/usr/share' +CMAKE_INSTALL_FULL_DATAROOTDIR='/usr/share' +CMAKE_INSTALL_FULL_DOCDIR='/usr/share/doc/Root' +CMAKE_INSTALL_FULL_INCLUDEDIR='/usr/include' +CMAKE_INSTALL_FULL_INFODIR='/usr/share/info' +CMAKE_INSTALL_FULL_LIBDIR='/usr/(lib|lib64)' +CMAKE_INSTALL_FULL_LIBEXECDIR='/usr/libexec' +CMAKE_INSTALL_FULL_LOCALEDIR='/usr/share/locale' +CMAKE_INSTALL_FULL_LOCALSTATEDIR='/var' +CMAKE_INSTALL_FULL_MANDIR='/usr/share/man' +CMAKE_INSTALL_FULL_SBINDIR='/usr/sbin' +CMAKE_INSTALL_FULL_SHAREDSTATEDIR='/usr/com' +CMAKE_INSTALL_FULL_SYSCONFDIR='/etc'$ diff --git a/Tests/RunCMake/GNUInstallDirs/Root.cmake b/Tests/RunCMake/GNUInstallDirs/Root.cmake new file mode 100644 index 0000000..f8cc641 --- /dev/null +++ b/Tests/RunCMake/GNUInstallDirs/Root.cmake @@ -0,0 +1,2 @@ +set(CMAKE_INSTALL_PREFIX "/") +include(Common.cmake) diff --git a/Tests/RunCMake/GNUInstallDirs/RunCMakeTest.cmake b/Tests/RunCMake/GNUInstallDirs/RunCMakeTest.cmake new file mode 100644 index 0000000..f88569a --- /dev/null +++ b/Tests/RunCMake/GNUInstallDirs/RunCMakeTest.cmake @@ -0,0 +1,6 @@ +include(RunCMake) + +run_cmake(Opt) +run_cmake(Root) +run_cmake(Usr) +run_cmake(UsrLocal) diff --git a/Tests/RunCMake/GNUInstallDirs/Usr-stderr.txt b/Tests/RunCMake/GNUInstallDirs/Usr-stderr.txt new file mode 100644 index 0000000..e10c4c5 --- /dev/null +++ b/Tests/RunCMake/GNUInstallDirs/Usr-stderr.txt @@ -0,0 +1,28 @@ +^CMAKE_INSTALL_BINDIR='bin' +CMAKE_INSTALL_DATADIR='share' +CMAKE_INSTALL_DATAROOTDIR='share' +CMAKE_INSTALL_DOCDIR='share/doc/Usr' +CMAKE_INSTALL_INCLUDEDIR='include' +CMAKE_INSTALL_INFODIR='share/info' +CMAKE_INSTALL_LIBDIR='(lib|lib64|lib/arch)' +CMAKE_INSTALL_LIBEXECDIR='libexec' +CMAKE_INSTALL_LOCALEDIR='share/locale' +CMAKE_INSTALL_LOCALSTATEDIR='var' +CMAKE_INSTALL_MANDIR='share/man' +CMAKE_INSTALL_SBINDIR='sbin' +CMAKE_INSTALL_SHAREDSTATEDIR='com' +CMAKE_INSTALL_SYSCONFDIR='etc' +CMAKE_INSTALL_FULL_BINDIR='/usr/bin' +CMAKE_INSTALL_FULL_DATADIR='/usr/share' +CMAKE_INSTALL_FULL_DATAROOTDIR='/usr/share' +CMAKE_INSTALL_FULL_DOCDIR='/usr/share/doc/Usr' +CMAKE_INSTALL_FULL_INCLUDEDIR='/usr/include' +CMAKE_INSTALL_FULL_INFODIR='/usr/share/info' +CMAKE_INSTALL_FULL_LIBDIR='/usr/(lib|lib64|lib/arch)' +CMAKE_INSTALL_FULL_LIBEXECDIR='/usr/libexec' +CMAKE_INSTALL_FULL_LOCALEDIR='/usr/share/locale' +CMAKE_INSTALL_FULL_LOCALSTATEDIR='/var' +CMAKE_INSTALL_FULL_MANDIR='/usr/share/man' +CMAKE_INSTALL_FULL_SBINDIR='/usr/sbin' +CMAKE_INSTALL_FULL_SHAREDSTATEDIR='/usr/com' +CMAKE_INSTALL_FULL_SYSCONFDIR='/etc'$ diff --git a/Tests/RunCMake/GNUInstallDirs/Usr.cmake b/Tests/RunCMake/GNUInstallDirs/Usr.cmake new file mode 100644 index 0000000..62b7288 --- /dev/null +++ b/Tests/RunCMake/GNUInstallDirs/Usr.cmake @@ -0,0 +1,2 @@ +set(CMAKE_INSTALL_PREFIX "/usr") +include(Common.cmake) diff --git a/Tests/RunCMake/GNUInstallDirs/UsrLocal-stderr.txt b/Tests/RunCMake/GNUInstallDirs/UsrLocal-stderr.txt new file mode 100644 index 0000000..8dcf25b --- /dev/null +++ b/Tests/RunCMake/GNUInstallDirs/UsrLocal-stderr.txt @@ -0,0 +1,28 @@ +^CMAKE_INSTALL_BINDIR='bin' +CMAKE_INSTALL_DATADIR='share' +CMAKE_INSTALL_DATAROOTDIR='share' +CMAKE_INSTALL_DOCDIR='share/doc/UsrLocal' +CMAKE_INSTALL_INCLUDEDIR='include' +CMAKE_INSTALL_INFODIR='share/info' +CMAKE_INSTALL_LIBDIR='(lib|lib64)' +CMAKE_INSTALL_LIBEXECDIR='libexec' +CMAKE_INSTALL_LOCALEDIR='share/locale' +CMAKE_INSTALL_LOCALSTATEDIR='var' +CMAKE_INSTALL_MANDIR='share/man' +CMAKE_INSTALL_SBINDIR='sbin' +CMAKE_INSTALL_SHAREDSTATEDIR='com' +CMAKE_INSTALL_SYSCONFDIR='etc' +CMAKE_INSTALL_FULL_BINDIR='/usr/local/bin' +CMAKE_INSTALL_FULL_DATADIR='/usr/local/share' +CMAKE_INSTALL_FULL_DATAROOTDIR='/usr/local/share' +CMAKE_INSTALL_FULL_DOCDIR='/usr/local/share/doc/UsrLocal' +CMAKE_INSTALL_FULL_INCLUDEDIR='/usr/local/include' +CMAKE_INSTALL_FULL_INFODIR='/usr/local/share/info' +CMAKE_INSTALL_FULL_LIBDIR='/usr/local/(lib|lib64)' +CMAKE_INSTALL_FULL_LIBEXECDIR='/usr/local/libexec' +CMAKE_INSTALL_FULL_LOCALEDIR='/usr/local/share/locale' +CMAKE_INSTALL_FULL_LOCALSTATEDIR='/usr/local/var' +CMAKE_INSTALL_FULL_MANDIR='/usr/local/share/man' +CMAKE_INSTALL_FULL_SBINDIR='/usr/local/sbin' +CMAKE_INSTALL_FULL_SHAREDSTATEDIR='/usr/local/com' +CMAKE_INSTALL_FULL_SYSCONFDIR='/usr/local/etc'$ diff --git a/Tests/RunCMake/GNUInstallDirs/UsrLocal.cmake b/Tests/RunCMake/GNUInstallDirs/UsrLocal.cmake new file mode 100644 index 0000000..59d9331 --- /dev/null +++ b/Tests/RunCMake/GNUInstallDirs/UsrLocal.cmake @@ -0,0 +1,2 @@ +set(CMAKE_INSTALL_PREFIX "/usr/local") +include(Common.cmake) diff --git a/Tests/RunCMake/Languages/DetermineFail-result.txt b/Tests/RunCMake/Languages/DetermineFail-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/Languages/DetermineFail-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/Languages/DetermineFail-stderr.txt b/Tests/RunCMake/Languages/DetermineFail-stderr.txt new file mode 100644 index 0000000..3b4743e --- /dev/null +++ b/Tests/RunCMake/Languages/DetermineFail-stderr.txt @@ -0,0 +1,5 @@ +^CMake Error at Modules/CMakeDetermineFailCompiler.cmake:[0-9]+ \(message\): + This language is not supported. +Call Stack \(most recent call first\): + DetermineFail.cmake:[0-9]+ \(enable_language\) + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/Languages/DetermineFail.cmake b/Tests/RunCMake/Languages/DetermineFail.cmake new file mode 100644 index 0000000..3c8d17d --- /dev/null +++ b/Tests/RunCMake/Languages/DetermineFail.cmake @@ -0,0 +1,2 @@ +list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/Modules) +enable_language(Fail) diff --git a/Tests/RunCMake/Languages/Modules/CMakeDetermineFailCompiler.cmake b/Tests/RunCMake/Languages/Modules/CMakeDetermineFailCompiler.cmake new file mode 100644 index 0000000..3b2d50a --- /dev/null +++ b/Tests/RunCMake/Languages/Modules/CMakeDetermineFailCompiler.cmake @@ -0,0 +1 @@ +message(FATAL_ERROR "This language is not supported.") diff --git a/Tests/RunCMake/Languages/RunCMakeTest.cmake b/Tests/RunCMake/Languages/RunCMakeTest.cmake index 6517a81..732baae 100644 --- a/Tests/RunCMake/Languages/RunCMakeTest.cmake +++ b/Tests/RunCMake/Languages/RunCMakeTest.cmake @@ -4,3 +4,5 @@ run_cmake(NoLangSHARED) run_cmake(LINK_LANGUAGE-genex) run_cmake(link-libraries-TARGET_FILE-genex) run_cmake(link-libraries-TARGET_FILE-genex-ok) + +run_cmake(DetermineFail) diff --git a/Tests/RunCMake/Make/CMakeLists.txt b/Tests/RunCMake/Make/CMakeLists.txt new file mode 100644 index 0000000..74b3ff8 --- /dev/null +++ b/Tests/RunCMake/Make/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.3) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/Make/RunCMakeTest.cmake b/Tests/RunCMake/Make/RunCMakeTest.cmake new file mode 100644 index 0000000..c6bbd03 --- /dev/null +++ b/Tests/RunCMake/Make/RunCMakeTest.cmake @@ -0,0 +1,17 @@ +include(RunCMake) + +function(run_TargetMessages case) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/TargetMessages-${case}-build) + set(RunCMake_TEST_NO_CLEAN 1) + file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") + file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") + set(RunCMake_TEST_OPTIONS "${ARGN}") + run_cmake(TargetMessages-${case}) + run_cmake_command(TargetMessages-${case}-build ${CMAKE_COMMAND} --build .) +endfunction() + +run_TargetMessages(ON) +run_TargetMessages(OFF) + +run_TargetMessages(VAR-ON -DCMAKE_TARGET_MESSAGES=ON) +run_TargetMessages(VAR-OFF -DCMAKE_TARGET_MESSAGES=OFF) diff --git a/Tests/RunCMake/Make/TargetMessages-OFF-build-stdout.txt b/Tests/RunCMake/Make/TargetMessages-OFF-build-stdout.txt new file mode 100644 index 0000000..77a582a --- /dev/null +++ b/Tests/RunCMake/Make/TargetMessages-OFF-build-stdout.txt @@ -0,0 +1,5 @@ +^(([^B]|B[^u]|Bu[^i]|Bui[^l]|Buil[^t]|Built[^ ])[^ +]* +)*Scanning dependencies of target CustomTarget( +([^B]|B[^u]|Bu[^i]|Bui[^l]|Buil[^t]|Built[^ ])[^ +]*)*$ diff --git a/Tests/RunCMake/Make/TargetMessages-OFF.cmake b/Tests/RunCMake/Make/TargetMessages-OFF.cmake new file mode 100644 index 0000000..8f5d52c --- /dev/null +++ b/Tests/RunCMake/Make/TargetMessages-OFF.cmake @@ -0,0 +1,2 @@ +set_property(GLOBAL PROPERTY TARGET_MESSAGES OFF) +add_custom_target(CustomTarget ALL) diff --git a/Tests/RunCMake/Make/TargetMessages-ON-build-stdout.txt b/Tests/RunCMake/Make/TargetMessages-ON-build-stdout.txt new file mode 100644 index 0000000..a827624 --- /dev/null +++ b/Tests/RunCMake/Make/TargetMessages-ON-build-stdout.txt @@ -0,0 +1,8 @@ +^(([^B]|B[^u]|Bu[^i]|Bui[^l]|Buil[^t]|Built[^ ])[^ +]* +)*Scanning dependencies of target CustomTarget( +([^B]|B[^u]|Bu[^i]|Bui[^l]|Buil[^t]|Built[^ ])[^ +]*)* +Built target CustomTarget( +([^B]|B[^u]|Bu[^i]|Bui[^l]|Buil[^t]|Built[^ ])[^ +]*)*$ diff --git a/Tests/RunCMake/Make/TargetMessages-ON.cmake b/Tests/RunCMake/Make/TargetMessages-ON.cmake new file mode 100644 index 0000000..e0a5f2b --- /dev/null +++ b/Tests/RunCMake/Make/TargetMessages-ON.cmake @@ -0,0 +1,2 @@ +set_property(GLOBAL PROPERTY TARGET_MESSAGES ON) +add_custom_target(CustomTarget ALL) diff --git a/Tests/RunCMake/Make/TargetMessages-VAR-OFF-build-stdout.txt b/Tests/RunCMake/Make/TargetMessages-VAR-OFF-build-stdout.txt new file mode 100644 index 0000000..77a582a --- /dev/null +++ b/Tests/RunCMake/Make/TargetMessages-VAR-OFF-build-stdout.txt @@ -0,0 +1,5 @@ +^(([^B]|B[^u]|Bu[^i]|Bui[^l]|Buil[^t]|Built[^ ])[^ +]* +)*Scanning dependencies of target CustomTarget( +([^B]|B[^u]|Bu[^i]|Bui[^l]|Buil[^t]|Built[^ ])[^ +]*)*$ diff --git a/Tests/RunCMake/Make/TargetMessages-VAR-OFF.cmake b/Tests/RunCMake/Make/TargetMessages-VAR-OFF.cmake new file mode 100644 index 0000000..f278132 --- /dev/null +++ b/Tests/RunCMake/Make/TargetMessages-VAR-OFF.cmake @@ -0,0 +1 @@ +add_custom_target(CustomTarget ALL) diff --git a/Tests/RunCMake/Make/TargetMessages-VAR-ON-build-stdout.txt b/Tests/RunCMake/Make/TargetMessages-VAR-ON-build-stdout.txt new file mode 100644 index 0000000..a827624 --- /dev/null +++ b/Tests/RunCMake/Make/TargetMessages-VAR-ON-build-stdout.txt @@ -0,0 +1,8 @@ +^(([^B]|B[^u]|Bu[^i]|Bui[^l]|Buil[^t]|Built[^ ])[^ +]* +)*Scanning dependencies of target CustomTarget( +([^B]|B[^u]|Bu[^i]|Bui[^l]|Buil[^t]|Built[^ ])[^ +]*)* +Built target CustomTarget( +([^B]|B[^u]|Bu[^i]|Bui[^l]|Buil[^t]|Built[^ ])[^ +]*)*$ diff --git a/Tests/RunCMake/Make/TargetMessages-VAR-ON.cmake b/Tests/RunCMake/Make/TargetMessages-VAR-ON.cmake new file mode 100644 index 0000000..f278132 --- /dev/null +++ b/Tests/RunCMake/Make/TargetMessages-VAR-ON.cmake @@ -0,0 +1 @@ +add_custom_target(CustomTarget ALL) diff --git a/Tests/RunCMake/RunCMake.cmake b/Tests/RunCMake/RunCMake.cmake index 70c0d6c..46bc494 100644 --- a/Tests/RunCMake/RunCMake.cmake +++ b/Tests/RunCMake/RunCMake.cmake @@ -66,6 +66,11 @@ function(run_cmake test) else() set(actual_stderr_var actual_stderr) endif() + if(DEFINED RunCMake_TEST_TIMEOUT) + set(maybe_timeout TIMEOUT ${RunCMake_TEST_TIMEOUT}) + else() + set(maybe_timeout "") + endif() if(RunCMake_TEST_COMMAND) execute_process( COMMAND ${RunCMake_TEST_COMMAND} @@ -73,6 +78,7 @@ function(run_cmake test) OUTPUT_VARIABLE actual_stdout ERROR_VARIABLE ${actual_stderr_var} RESULT_VARIABLE actual_result + ${maybe_timeout} ) else() execute_process( @@ -87,6 +93,7 @@ function(run_cmake test) OUTPUT_VARIABLE actual_stdout ERROR_VARIABLE ${actual_stderr_var} RESULT_VARIABLE actual_result + ${maybe_timeout} ) endif() set(msg "") diff --git a/Tests/RunCMake/Swift/CMakeLists.txt b/Tests/RunCMake/Swift/CMakeLists.txt new file mode 100644 index 0000000..74b3ff8 --- /dev/null +++ b/Tests/RunCMake/Swift/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.3) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/Swift/Enable-stdout.txt b/Tests/RunCMake/Swift/Enable-stdout.txt new file mode 100644 index 0000000..39e133f --- /dev/null +++ b/Tests/RunCMake/Swift/Enable-stdout.txt @@ -0,0 +1 @@ +-- The Swift compiler identification is Apple diff --git a/Tests/RunCMake/Swift/Enable.cmake b/Tests/RunCMake/Swift/Enable.cmake new file mode 100644 index 0000000..19f297a --- /dev/null +++ b/Tests/RunCMake/Swift/Enable.cmake @@ -0,0 +1 @@ +enable_language(Swift) diff --git a/Tests/RunCMake/Swift/NotSupported-result.txt b/Tests/RunCMake/Swift/NotSupported-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/Swift/NotSupported-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/Swift/NotSupported-stderr.txt b/Tests/RunCMake/Swift/NotSupported-stderr.txt new file mode 100644 index 0000000..9a9c23f --- /dev/null +++ b/Tests/RunCMake/Swift/NotSupported-stderr.txt @@ -0,0 +1,5 @@ +^CMake Error at .*/Modules/CMakeDetermineSwiftCompiler.cmake:[0-9]+ \(message\): + Swift language not supported by "[^"]*" generator +Call Stack \(most recent call first\): + NotSupported.cmake:[0-9]+ \(enable_language\) + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/Swift/NotSupported.cmake b/Tests/RunCMake/Swift/NotSupported.cmake new file mode 100644 index 0000000..19f297a --- /dev/null +++ b/Tests/RunCMake/Swift/NotSupported.cmake @@ -0,0 +1 @@ +enable_language(Swift) diff --git a/Tests/RunCMake/Swift/RunCMakeTest.cmake b/Tests/RunCMake/Swift/RunCMakeTest.cmake new file mode 100644 index 0000000..0a57121 --- /dev/null +++ b/Tests/RunCMake/Swift/RunCMakeTest.cmake @@ -0,0 +1,11 @@ +include(RunCMake) + +if(RunCMake_GENERATOR STREQUAL Xcode) + if(XCODE_BELOW_6_1) + run_cmake(XcodeTooOld) + else() + run_cmake(Enable) + endif() +else() + run_cmake(NotSupported) +endif() diff --git a/Tests/RunCMake/Swift/XcodeTooOld-result.txt b/Tests/RunCMake/Swift/XcodeTooOld-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/Swift/XcodeTooOld-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/Swift/XcodeTooOld-stderr.txt b/Tests/RunCMake/Swift/XcodeTooOld-stderr.txt new file mode 100644 index 0000000..8d18f29 --- /dev/null +++ b/Tests/RunCMake/Swift/XcodeTooOld-stderr.txt @@ -0,0 +1,5 @@ +^CMake Error at .*/Modules/CMakeDetermineSwiftCompiler.cmake:[0-9]+ \(message\): + Swift language not supported by Xcode [0-9.]+ +Call Stack \(most recent call first\): + XcodeTooOld.cmake:[0-9]+ \(enable_language\) + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/Swift/XcodeTooOld.cmake b/Tests/RunCMake/Swift/XcodeTooOld.cmake new file mode 100644 index 0000000..19f297a --- /dev/null +++ b/Tests/RunCMake/Swift/XcodeTooOld.cmake @@ -0,0 +1 @@ +enable_language(Swift) diff --git a/Tests/RunCMake/Syntax/BOM-UTF-16-BE-stderr.txt b/Tests/RunCMake/Syntax/BOM-UTF-16-BE-stderr.txt index b3f1e47..a845ffb 100644 --- a/Tests/RunCMake/Syntax/BOM-UTF-16-BE-stderr.txt +++ b/Tests/RunCMake/Syntax/BOM-UTF-16-BE-stderr.txt @@ -1,6 +1,8 @@ -CMake Error at CMakeLists.txt:3 \(include\): +CMake Error in BOM-UTF-16-BE.cmake: File .*/Tests/RunCMake/Syntax/BOM-UTF-16-BE.cmake starts with a Byte-Order-Mark that is not UTF-8. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/Syntax/BOM-UTF-16-LE-stderr.txt b/Tests/RunCMake/Syntax/BOM-UTF-16-LE-stderr.txt index c08c902..cc4244b 100644 --- a/Tests/RunCMake/Syntax/BOM-UTF-16-LE-stderr.txt +++ b/Tests/RunCMake/Syntax/BOM-UTF-16-LE-stderr.txt @@ -1,6 +1,8 @@ -CMake Error at CMakeLists.txt:3 \(include\): +CMake Error in BOM-UTF-16-LE.cmake: File .*/Tests/RunCMake/Syntax/BOM-UTF-16-LE.cmake starts with a Byte-Order-Mark that is not UTF-8. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/Syntax/BOM-UTF-32-BE-stderr.txt b/Tests/RunCMake/Syntax/BOM-UTF-32-BE-stderr.txt index 5dde4e3..5f851bf 100644 --- a/Tests/RunCMake/Syntax/BOM-UTF-32-BE-stderr.txt +++ b/Tests/RunCMake/Syntax/BOM-UTF-32-BE-stderr.txt @@ -1,6 +1,8 @@ -CMake Error at CMakeLists.txt:3 \(include\): +CMake Error in BOM-UTF-32-BE.cmake: File .*/Tests/RunCMake/Syntax/BOM-UTF-32-BE.cmake starts with a Byte-Order-Mark that is not UTF-8. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/Syntax/BOM-UTF-32-LE-stderr.txt b/Tests/RunCMake/Syntax/BOM-UTF-32-LE-stderr.txt index eb054ec..d8fafd0 100644 --- a/Tests/RunCMake/Syntax/BOM-UTF-32-LE-stderr.txt +++ b/Tests/RunCMake/Syntax/BOM-UTF-32-LE-stderr.txt @@ -1,6 +1,8 @@ -CMake Error at CMakeLists.txt:3 \(include\): +CMake Error in BOM-UTF-32-LE.cmake: File .*/Tests/RunCMake/Syntax/BOM-UTF-32-LE.cmake starts with a Byte-Order-Mark that is not UTF-8. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/Syntax/BracketNoSpace0-stderr.txt b/Tests/RunCMake/Syntax/BracketNoSpace0-stderr.txt index afd91f9..a288280 100644 --- a/Tests/RunCMake/Syntax/BracketNoSpace0-stderr.txt +++ b/Tests/RunCMake/Syntax/BracketNoSpace0-stderr.txt @@ -1,6 +1,8 @@ -CMake Error at CMakeLists.txt:3 \(include\): +CMake Error in BracketNoSpace0.cmake: Syntax Error in cmake code at .*/Tests/RunCMake/Syntax/BracketNoSpace0.cmake:1:27 Argument not separated from preceding token by whitespace. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/Syntax/BracketNoSpace1-stderr.txt b/Tests/RunCMake/Syntax/BracketNoSpace1-stderr.txt index 826e511..391e11b 100644 --- a/Tests/RunCMake/Syntax/BracketNoSpace1-stderr.txt +++ b/Tests/RunCMake/Syntax/BracketNoSpace1-stderr.txt @@ -1,6 +1,8 @@ -CMake Error at CMakeLists.txt:3 \(include\): +CMake Error in BracketNoSpace1.cmake: Syntax Error in cmake code at .*/Tests/RunCMake/Syntax/BracketNoSpace1.cmake:1:24 Argument not separated from preceding token by whitespace. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/Syntax/BracketNoSpace2-stderr.txt b/Tests/RunCMake/Syntax/BracketNoSpace2-stderr.txt index 23ecdcd..acaf7fe 100644 --- a/Tests/RunCMake/Syntax/BracketNoSpace2-stderr.txt +++ b/Tests/RunCMake/Syntax/BracketNoSpace2-stderr.txt @@ -1,6 +1,8 @@ -CMake Error at CMakeLists.txt:3 \(include\): +CMake Error in BracketNoSpace2.cmake: Syntax Error in cmake code at .*/Tests/RunCMake/Syntax/BracketNoSpace2.cmake:1:44 Argument not separated from preceding token by whitespace. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/Syntax/BracketNoSpace3-stderr.txt b/Tests/RunCMake/Syntax/BracketNoSpace3-stderr.txt index 906d6fc..f12b2e5 100644 --- a/Tests/RunCMake/Syntax/BracketNoSpace3-stderr.txt +++ b/Tests/RunCMake/Syntax/BracketNoSpace3-stderr.txt @@ -1,6 +1,8 @@ -CMake Error at CMakeLists.txt:3 \(include\): +CMake Error in BracketNoSpace3.cmake: Syntax Error in cmake code at .*/Tests/RunCMake/Syntax/BracketNoSpace3.cmake:1:45 Argument not separated from preceding token by whitespace. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/Syntax/BracketNoSpace4-stderr.txt b/Tests/RunCMake/Syntax/BracketNoSpace4-stderr.txt index a461e93..7157763 100644 --- a/Tests/RunCMake/Syntax/BracketNoSpace4-stderr.txt +++ b/Tests/RunCMake/Syntax/BracketNoSpace4-stderr.txt @@ -1,6 +1,8 @@ -CMake Error at CMakeLists.txt:3 \(include\): +CMake Error in BracketNoSpace4.cmake: Syntax Error in cmake code at .*/Tests/RunCMake/Syntax/BracketNoSpace4.cmake:1:44 Argument not separated from preceding token by whitespace. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/Syntax/BracketNoSpace5-stderr.txt b/Tests/RunCMake/Syntax/BracketNoSpace5-stderr.txt index ff8bf1c..c13969d 100644 --- a/Tests/RunCMake/Syntax/BracketNoSpace5-stderr.txt +++ b/Tests/RunCMake/Syntax/BracketNoSpace5-stderr.txt @@ -1,6 +1,8 @@ -CMake Error at CMakeLists.txt:3 \(include\): +CMake Error in BracketNoSpace5.cmake: Syntax Error in cmake code at .*/Tests/RunCMake/Syntax/BracketNoSpace5.cmake:1:45 Argument not separated from preceding token by whitespace. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/Syntax/ParenInENV-stderr.txt b/Tests/RunCMake/Syntax/ParenInENV-stderr.txt index 7ecfe11..37c5d6e 100644 --- a/Tests/RunCMake/Syntax/ParenInENV-stderr.txt +++ b/Tests/RunCMake/Syntax/ParenInENV-stderr.txt @@ -1,9 +1,11 @@ -CMake Warning \(dev\) at CMakeLists.txt:3 \(include\): +CMake Warning \(dev\) in ParenInENV.cmake: Syntax Warning in cmake code at .*/Tests/RunCMake/Syntax/ParenInENV.cmake:2:21 Argument not separated from preceding token by whitespace. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) This warning is for project developers. Use -Wno-dev to suppress it. CMake Error at ParenInENV.cmake:2 \(message\): diff --git a/Tests/RunCMake/Syntax/ParenNoSpace1-stderr.txt b/Tests/RunCMake/Syntax/ParenNoSpace1-stderr.txt index 64ef8b1..45b2e6a 100644 --- a/Tests/RunCMake/Syntax/ParenNoSpace1-stderr.txt +++ b/Tests/RunCMake/Syntax/ParenNoSpace1-stderr.txt @@ -1,22 +1,28 @@ -CMake Warning \(dev\) at CMakeLists.txt:3 \(include\): +CMake Warning \(dev\) in ParenNoSpace1.cmake: Syntax Warning in cmake code at .*/Tests/RunCMake/Syntax/ParenNoSpace1.cmake:1:26 Argument not separated from preceding token by whitespace. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) This warning is for project developers. Use -Wno-dev to suppress it. -CMake Warning \(dev\) at CMakeLists.txt:3 \(include\): +CMake Warning \(dev\) in ParenNoSpace1.cmake: Syntax Warning in cmake code at .*/Tests/RunCMake/Syntax/ParenNoSpace1.cmake:2:26 Argument not separated from preceding token by whitespace. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) This warning is for project developers. Use -Wno-dev to suppress it. -CMake Error at CMakeLists.txt:3 \(include\): +CMake Error in ParenNoSpace1.cmake: Syntax Error in cmake code at .*/Tests/RunCMake/Syntax/ParenNoSpace1.cmake:3:29 Argument not separated from preceding token by whitespace. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/Syntax/StringNoSpace-stderr.txt b/Tests/RunCMake/Syntax/StringNoSpace-stderr.txt index 89c2d2a..a4ec6e7 100644 --- a/Tests/RunCMake/Syntax/StringNoSpace-stderr.txt +++ b/Tests/RunCMake/Syntax/StringNoSpace-stderr.txt @@ -1,17 +1,21 @@ -CMake Warning \(dev\) at CMakeLists.txt:3 \(include\): +CMake Warning \(dev\) in StringNoSpace.cmake: Syntax Warning in cmake code at .*/Tests/RunCMake/Syntax/StringNoSpace.cmake:2:28 Argument not separated from preceding token by whitespace. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) This warning is for project developers. Use -Wno-dev to suppress it. -CMake Warning \(dev\) at CMakeLists.txt:3 \(include\): +CMake Warning \(dev\) in StringNoSpace.cmake: Syntax Warning in cmake code at .*/Tests/RunCMake/Syntax/StringNoSpace.cmake:2:31 Argument not separated from preceding token by whitespace. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) This warning is for project developers. Use -Wno-dev to suppress it. \[1 \${var} \\n 4\] diff --git a/Tests/RunCMake/ctest_build/BuildChangeId-check.cmake b/Tests/RunCMake/ctest_build/BuildChangeId-check.cmake new file mode 100644 index 0000000..074801f --- /dev/null +++ b/Tests/RunCMake/ctest_build/BuildChangeId-check.cmake @@ -0,0 +1,12 @@ +file(GLOB build_xml_file "${RunCMake_TEST_BINARY_DIR}/Testing/*/Build.xml") +if(build_xml_file) + file(READ "${build_xml_file}" build_xml LIMIT 4096) + if(NOT build_xml MATCHES [[ChangeId="<>1"]]) + string(REPLACE "\n" "\n " build_xml " ${build_xml}") + set(RunCMake_TEST_FAILED + "Build.xml does not have expected ChangeId:\n${build_xml}" + ) + endif() +else() + set(RunCMake_TEST_FAILED "Build.xml not found") +endif() diff --git a/Tests/RunCMake/ctest_build/RunCMakeTest.cmake b/Tests/RunCMake/ctest_build/RunCMakeTest.cmake index c6f732c..324f25c 100644 --- a/Tests/RunCMake/ctest_build/RunCMakeTest.cmake +++ b/Tests/RunCMake/ctest_build/RunCMakeTest.cmake @@ -31,3 +31,12 @@ endif() endif() endfunction() run_BuildFailure() + +function(run_BuildChangeId) + set(CASE_TEST_PREFIX_CODE [[ + set(CTEST_CHANGE_ID "<>1") + ]]) + + run_ctest(BuildChangeId) +endfunction() +run_BuildChangeId() diff --git a/Tests/RunCMake/ctest_start/ConfigInBuild-stdout.txt b/Tests/RunCMake/ctest_start/ConfigInBuild-stdout.txt new file mode 100644 index 0000000..7e94b8a --- /dev/null +++ b/Tests/RunCMake/ctest_start/ConfigInBuild-stdout.txt @@ -0,0 +1,7 @@ +Run dashboard with model Experimental + Source directory: .*/Tests/RunCMake/ctest_start/ConfigInBuild + Build directory: .*/Tests/RunCMake/ctest_start/ConfigInBuild-build + Reading ctest configuration file: .*/Tests/RunCMake/ctest_start/ConfigInBuild-build/CTestConfig.cmake + Site: test-site + Build name: test-build-name + Use Experimental tag: [0-9-]+ diff --git a/Tests/RunCMake/ctest_start/ConfigInSource-stdout.txt b/Tests/RunCMake/ctest_start/ConfigInSource-stdout.txt new file mode 100644 index 0000000..c390372 --- /dev/null +++ b/Tests/RunCMake/ctest_start/ConfigInSource-stdout.txt @@ -0,0 +1,7 @@ +Run dashboard with model Experimental + Source directory: .*/Tests/RunCMake/ctest_start/ConfigInSource + Build directory: .*/Tests/RunCMake/ctest_start/ConfigInSource-build + Reading ctest configuration file: .*/Tests/RunCMake/ctest_start/ConfigInSource/CTestConfig.cmake + Site: test-site + Build name: test-build-name + Use Experimental tag: [0-9-]+ diff --git a/Tests/RunCMake/ctest_start/RunCMakeTest.cmake b/Tests/RunCMake/ctest_start/RunCMakeTest.cmake index f765a0f..d630a79 100644 --- a/Tests/RunCMake/ctest_start/RunCMakeTest.cmake +++ b/Tests/RunCMake/ctest_start/RunCMakeTest.cmake @@ -8,3 +8,16 @@ function(run_ctest_start CASE_NAME) endfunction() run_ctest_start(StartQuiet Experimental QUIET) + +run_ctest_start(ConfigInSource Experimental) + +function(run_ConfigInBuild) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/ConfigInBuild-build) + set(RunCMake_TEST_NO_CLEAN 1) + file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") + file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") + configure_file(${RunCMake_SOURCE_DIR}/CTestConfig.cmake.in + ${RunCMake_BINARY_DIR}/ConfigInBuild-build/CTestConfig.cmake @ONLY) + run_ctest_start(ConfigInBuild Experimental) +endfunction() +run_ConfigInBuild() diff --git a/Tests/RunCMake/ctest_test/CTestTestLoadFail-result.txt b/Tests/RunCMake/ctest_test/CTestTestLoadFail-result.txt new file mode 100644 index 0000000..b57e2de --- /dev/null +++ b/Tests/RunCMake/ctest_test/CTestTestLoadFail-result.txt @@ -0,0 +1 @@ +(-1|255) diff --git a/Tests/RunCMake/ctest_test/CTestTestLoadFail-stderr.txt b/Tests/RunCMake/ctest_test/CTestTestLoadFail-stderr.txt new file mode 100644 index 0000000..eafba1c --- /dev/null +++ b/Tests/RunCMake/ctest_test/CTestTestLoadFail-stderr.txt @@ -0,0 +1 @@ +No tests were found!!! diff --git a/Tests/RunCMake/ctest_test/CTestTestLoadFail-stdout.txt b/Tests/RunCMake/ctest_test/CTestTestLoadFail-stdout.txt new file mode 100644 index 0000000..e203c10 --- /dev/null +++ b/Tests/RunCMake/ctest_test/CTestTestLoadFail-stdout.txt @@ -0,0 +1,2 @@ +Test project .*/Tests/RunCMake/ctest_test/CTestTestLoadFail-build +\*\*\*\*\* WAITING, System Load: 5, Max Allowed Load: 4, Smallest test RunCMakeVersion requires 1\*\*\*\*\*$ diff --git a/Tests/RunCMake/ctest_test/CTestTestLoadInvalid-stderr.txt b/Tests/RunCMake/ctest_test/CTestTestLoadInvalid-stderr.txt new file mode 100644 index 0000000..7f2d7f6 --- /dev/null +++ b/Tests/RunCMake/ctest_test/CTestTestLoadInvalid-stderr.txt @@ -0,0 +1 @@ +^Invalid value for 'CTEST_TEST_LOAD' : ERR2 diff --git a/Tests/RunCMake/ctest_test/CTestTestLoadInvalid-stdout.txt b/Tests/RunCMake/ctest_test/CTestTestLoadInvalid-stdout.txt new file mode 100644 index 0000000..b54220c --- /dev/null +++ b/Tests/RunCMake/ctest_test/CTestTestLoadInvalid-stdout.txt @@ -0,0 +1,7 @@ +Test project .*/Tests/RunCMake/ctest_test/CTestTestLoadInvalid-build + Start 1: RunCMakeVersion +1/1 Test #1: RunCMakeVersion .................. Passed +[0-9.]+ sec ++ +100% tests passed, 0 tests failed out of 1 ++ +Total Test time \(real\) = +[0-9.]+ sec$ diff --git a/Tests/RunCMake/ctest_test/CTestTestLoadPass-stdout.txt b/Tests/RunCMake/ctest_test/CTestTestLoadPass-stdout.txt new file mode 100644 index 0000000..c221eed --- /dev/null +++ b/Tests/RunCMake/ctest_test/CTestTestLoadPass-stdout.txt @@ -0,0 +1,7 @@ +Test project .*/Tests/RunCMake/ctest_test/CTestTestLoadPass-build + Start 1: RunCMakeVersion +1/1 Test #1: RunCMakeVersion .................. Passed +[0-9.]+ sec ++ +100% tests passed, 0 tests failed out of 1 ++ +Total Test time \(real\) = +[0-9.]+ sec$ diff --git a/Tests/RunCMake/ctest_test/RunCMakeTest.cmake b/Tests/RunCMake/ctest_test/RunCMakeTest.cmake index d906290..76dc143 100644 --- a/Tests/RunCMake/ctest_test/RunCMakeTest.cmake +++ b/Tests/RunCMake/ctest_test/RunCMakeTest.cmake @@ -1,6 +1,8 @@ include(RunCTest) +set(RunCMake_TEST_TIMEOUT 60) set(CASE_CTEST_TEST_ARGS "") +set(CASE_CTEST_TEST_LOAD "") function(run_ctest_test CASE_NAME) set(CASE_CTEST_TEST_ARGS "${ARGN}") @@ -8,3 +10,52 @@ function(run_ctest_test CASE_NAME) endfunction() run_ctest_test(TestQuiet QUIET) + +# Tests for the 'Test Load' feature of ctest +# +# Spoof a load average value to make these tests more reliable. +set(ENV{__CTEST_FAKE_LOAD_AVERAGE_FOR_TESTING} 5) + +# Verify that new tests are started when the load average falls below +# our threshold. +run_ctest_test(TestLoadPass TEST_LOAD 6) + +# Verify that new tests are not started when the load average exceeds +# our threshold. +run_ctest_test(TestLoadFail TEST_LOAD 2) + +# Verify that when an invalid "TEST_LOAD" value is given, a warning +# message is displayed and the value is ignored. +run_ctest_test(TestLoadInvalid TEST_LOAD "ERR1") + +# Verify that new tests are started when the load average falls below +# our threshold. +set(CASE_CTEST_TEST_LOAD 7) +run_ctest_test(CTestTestLoadPass) + +# Verify that new tests are not started when the load average exceeds +# our threshold. +set(CASE_CTEST_TEST_LOAD 4) +run_ctest_test(CTestTestLoadFail) + +# Verify that when an invalid "CTEST_TEST_LOAD" value is given, +# a warning message is displayed and the value is ignored. +set(CASE_CTEST_TEST_LOAD "ERR2") +run_ctest_test(CTestTestLoadInvalid) + +# Verify that the "TEST_LOAD" value has higher precedence than +# the "CTEST_TEST_LOAD" value +set(CASE_CTEST_TEST_LOAD "ERR3") +run_ctest_test(TestLoadOrder TEST_LOAD "ERR4") + +unset(ENV{__CTEST_FAKE_LOAD_AVERAGE_FOR_TESTING}) +unset(CASE_CTEST_TEST_LOAD) + +function(run_TestChangeId) + set(CASE_TEST_PREFIX_CODE [[ + set(CTEST_CHANGE_ID "<>1") + ]]) + + run_ctest(TestChangeId) +endfunction() +run_TestChangeId() diff --git a/Tests/RunCMake/ctest_test/TestChangeId-check.cmake b/Tests/RunCMake/ctest_test/TestChangeId-check.cmake new file mode 100644 index 0000000..b9884f1 --- /dev/null +++ b/Tests/RunCMake/ctest_test/TestChangeId-check.cmake @@ -0,0 +1,12 @@ +file(GLOB test_xml_file "${RunCMake_TEST_BINARY_DIR}/Testing/*/Test.xml") +if(test_xml_file) + file(READ "${test_xml_file}" test_xml LIMIT 4096) + if(NOT test_xml MATCHES [[ChangeId="<>1"]]) + string(REPLACE "\n" "\n " test_xml " ${test_xml}") + set(RunCMake_TEST_FAILED + "Test.xml does not have expected ChangeId:\n${test_xml}" + ) + endif() +else() + set(RunCMake_TEST_FAILED "Test.xml not found") +endif() diff --git a/Tests/RunCMake/ctest_test/TestLoadFail-result.txt b/Tests/RunCMake/ctest_test/TestLoadFail-result.txt new file mode 100644 index 0000000..b57e2de --- /dev/null +++ b/Tests/RunCMake/ctest_test/TestLoadFail-result.txt @@ -0,0 +1 @@ +(-1|255) diff --git a/Tests/RunCMake/ctest_test/TestLoadFail-stderr.txt b/Tests/RunCMake/ctest_test/TestLoadFail-stderr.txt new file mode 100644 index 0000000..eafba1c --- /dev/null +++ b/Tests/RunCMake/ctest_test/TestLoadFail-stderr.txt @@ -0,0 +1 @@ +No tests were found!!! diff --git a/Tests/RunCMake/ctest_test/TestLoadFail-stdout.txt b/Tests/RunCMake/ctest_test/TestLoadFail-stdout.txt new file mode 100644 index 0000000..4d7ce48 --- /dev/null +++ b/Tests/RunCMake/ctest_test/TestLoadFail-stdout.txt @@ -0,0 +1,2 @@ +Test project .*/Tests/RunCMake/ctest_test/TestLoadFail-build +\*\*\*\*\* WAITING, System Load: 5, Max Allowed Load: 2, Smallest test RunCMakeVersion requires 1\*\*\*\*\*$ diff --git a/Tests/RunCMake/ctest_test/TestLoadInvalid-stderr.txt b/Tests/RunCMake/ctest_test/TestLoadInvalid-stderr.txt new file mode 100644 index 0000000..40ddb3a --- /dev/null +++ b/Tests/RunCMake/ctest_test/TestLoadInvalid-stderr.txt @@ -0,0 +1 @@ +^Invalid value for 'TEST_LOAD' : ERR1 diff --git a/Tests/RunCMake/ctest_test/TestLoadInvalid-stdout.txt b/Tests/RunCMake/ctest_test/TestLoadInvalid-stdout.txt new file mode 100644 index 0000000..c4fd35b --- /dev/null +++ b/Tests/RunCMake/ctest_test/TestLoadInvalid-stdout.txt @@ -0,0 +1,7 @@ +Test project .*/Tests/RunCMake/ctest_test/TestLoadInvalid-build + Start 1: RunCMakeVersion +1/1 Test #1: RunCMakeVersion .................. Passed +[0-9.]+ sec ++ +100% tests passed, 0 tests failed out of 1 ++ +Total Test time \(real\) = +[0-9.]+ sec$ diff --git a/Tests/RunCMake/ctest_test/TestLoadOrder-stderr.txt b/Tests/RunCMake/ctest_test/TestLoadOrder-stderr.txt new file mode 100644 index 0000000..1de730e --- /dev/null +++ b/Tests/RunCMake/ctest_test/TestLoadOrder-stderr.txt @@ -0,0 +1 @@ +^Invalid value for 'TEST_LOAD' : ERR4 diff --git a/Tests/RunCMake/ctest_test/TestLoadOrder-stdout.txt b/Tests/RunCMake/ctest_test/TestLoadOrder-stdout.txt new file mode 100644 index 0000000..22da092 --- /dev/null +++ b/Tests/RunCMake/ctest_test/TestLoadOrder-stdout.txt @@ -0,0 +1,7 @@ +Test project .*/Tests/RunCMake/ctest_test/TestLoadOrder-build + Start 1: RunCMakeVersion +1/1 Test #1: RunCMakeVersion .................. Passed +[0-9.]+ sec ++ +100% tests passed, 0 tests failed out of 1 ++ +Total Test time \(real\) = +[0-9.]+ sec$ diff --git a/Tests/RunCMake/ctest_test/TestLoadPass-stdout.txt b/Tests/RunCMake/ctest_test/TestLoadPass-stdout.txt new file mode 100644 index 0000000..e5048f4 --- /dev/null +++ b/Tests/RunCMake/ctest_test/TestLoadPass-stdout.txt @@ -0,0 +1,7 @@ +Test project .*/Tests/RunCMake/ctest_test/TestLoadPass-build + Start 1: RunCMakeVersion +1/1 Test #1: RunCMakeVersion .................. Passed +[0-9.]+ sec ++ +100% tests passed, 0 tests failed out of 1 ++ +Total Test time \(real\) = +[0-9.]+ sec$ diff --git a/Tests/RunCMake/ctest_test/test.cmake.in b/Tests/RunCMake/ctest_test/test.cmake.in index 1350abe..50b936d 100644 --- a/Tests/RunCMake/ctest_test/test.cmake.in +++ b/Tests/RunCMake/ctest_test/test.cmake.in @@ -1,4 +1,5 @@ cmake_minimum_required(VERSION 3.1) +@CASE_TEST_PREFIX_CODE@ set(CTEST_SITE "test-site") set(CTEST_BUILD_NAME "test-build-name") @@ -8,6 +9,7 @@ set(CTEST_CMAKE_GENERATOR "@RunCMake_GENERATOR@") set(CTEST_CMAKE_GENERATOR_PLATFORM "@RunCMake_GENERATOR_PLATFORM@") set(CTEST_CMAKE_GENERATOR_TOOLSET "@RunCMake_GENERATOR_TOOLSET@") set(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}") +set(CTEST_TEST_LOAD "@CASE_CTEST_TEST_LOAD@") set(ctest_test_args "@CASE_CTEST_TEST_ARGS@") ctest_start(Experimental) diff --git a/Tests/RunCMake/get_property/BadArgument-result.txt b/Tests/RunCMake/get_property/BadArgument-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/get_property/BadArgument-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/get_property/BadArgument-stderr.txt b/Tests/RunCMake/get_property/BadArgument-stderr.txt new file mode 100644 index 0000000..37c4477 --- /dev/null +++ b/Tests/RunCMake/get_property/BadArgument-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at BadArgument.cmake:1 \(get_property\): + get_property given invalid argument "FOO". +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/CMakeTests/GetProperty-Bad-Argument.cmake b/Tests/RunCMake/get_property/BadArgument.cmake index 382dabb..382dabb 100644 --- a/Tests/CMakeTests/GetProperty-Bad-Argument.cmake +++ b/Tests/RunCMake/get_property/BadArgument.cmake diff --git a/Tests/RunCMake/get_property/BadDirectory-result.txt b/Tests/RunCMake/get_property/BadDirectory-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/get_property/BadDirectory-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/get_property/BadDirectory-stderr.txt b/Tests/RunCMake/get_property/BadDirectory-stderr.txt new file mode 100644 index 0000000..98464f8 --- /dev/null +++ b/Tests/RunCMake/get_property/BadDirectory-stderr.txt @@ -0,0 +1,6 @@ +^CMake Error at BadDirectory.cmake:1 \(get_property\): + get_property DIRECTORY scope provided but requested directory was not + found. This could be because the directory argument was invalid or, it is + valid but has not been processed yet. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/CMakeTests/GetProperty-Bad-Directory.cmake b/Tests/RunCMake/get_property/BadDirectory.cmake index cdbfa80..cdbfa80 100644 --- a/Tests/CMakeTests/GetProperty-Bad-Directory.cmake +++ b/Tests/RunCMake/get_property/BadDirectory.cmake diff --git a/Tests/RunCMake/get_property/BadScope-result.txt b/Tests/RunCMake/get_property/BadScope-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/get_property/BadScope-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/get_property/BadScope-stderr.txt b/Tests/RunCMake/get_property/BadScope-stderr.txt new file mode 100644 index 0000000..4cc32c8 --- /dev/null +++ b/Tests/RunCMake/get_property/BadScope-stderr.txt @@ -0,0 +1,5 @@ +^CMake Error at BadScope.cmake:1 \(get_property\): + get_property given invalid scope FOO. Valid scopes are GLOBAL, DIRECTORY, + TARGET, SOURCE, TEST, VARIABLE, CACHE, INSTALL. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/CMakeTests/GetProperty-Bad-Scope.cmake b/Tests/RunCMake/get_property/BadScope.cmake index ea8566b..ea8566b 100644 --- a/Tests/CMakeTests/GetProperty-Bad-Scope.cmake +++ b/Tests/RunCMake/get_property/BadScope.cmake diff --git a/Tests/RunCMake/get_property/BadTarget-result.txt b/Tests/RunCMake/get_property/BadTarget-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/get_property/BadTarget-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/get_property/BadTarget-stderr.txt b/Tests/RunCMake/get_property/BadTarget-stderr.txt new file mode 100644 index 0000000..45a0df6 --- /dev/null +++ b/Tests/RunCMake/get_property/BadTarget-stderr.txt @@ -0,0 +1,5 @@ +^CMake Error at BadTarget.cmake:1 \(get_property\): + get_property could not find TARGET FOO. Perhaps it has not yet been + created. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/CMakeTests/GetProperty-Bad-Target.cmake b/Tests/RunCMake/get_property/BadTarget.cmake index 9992dab..9992dab 100644 --- a/Tests/CMakeTests/GetProperty-Bad-Target.cmake +++ b/Tests/RunCMake/get_property/BadTarget.cmake diff --git a/Tests/RunCMake/get_property/BadTest-result.txt b/Tests/RunCMake/get_property/BadTest-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/get_property/BadTest-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/get_property/BadTest-stderr.txt b/Tests/RunCMake/get_property/BadTest-stderr.txt new file mode 100644 index 0000000..819c070 --- /dev/null +++ b/Tests/RunCMake/get_property/BadTest-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at BadTest.cmake:1 \(get_property\): + get_property given TEST name that does not exist: FOO +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/CMakeTests/GetProperty-Bad-Test.cmake b/Tests/RunCMake/get_property/BadTest.cmake index 44bf3eb..44bf3eb 100644 --- a/Tests/CMakeTests/GetProperty-Bad-Test.cmake +++ b/Tests/RunCMake/get_property/BadTest.cmake diff --git a/Tests/RunCMake/get_property/GlobalName-result.txt b/Tests/RunCMake/get_property/GlobalName-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/get_property/GlobalName-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/get_property/GlobalName-stderr.txt b/Tests/RunCMake/get_property/GlobalName-stderr.txt new file mode 100644 index 0000000..a7d4971 --- /dev/null +++ b/Tests/RunCMake/get_property/GlobalName-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at GlobalName.cmake:1 \(get_property\): + get_property given name for GLOBAL scope. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/CMakeTests/GetProperty-Global-Name.cmake b/Tests/RunCMake/get_property/GlobalName.cmake index 497700c..497700c 100644 --- a/Tests/CMakeTests/GetProperty-Global-Name.cmake +++ b/Tests/RunCMake/get_property/GlobalName.cmake diff --git a/Tests/RunCMake/get_property/MissingArgument-result.txt b/Tests/RunCMake/get_property/MissingArgument-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/get_property/MissingArgument-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/get_property/MissingArgument-stderr.txt b/Tests/RunCMake/get_property/MissingArgument-stderr.txt new file mode 100644 index 0000000..8722712 --- /dev/null +++ b/Tests/RunCMake/get_property/MissingArgument-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at MissingArgument.cmake:1 \(get_property\): + get_property called with incorrect number of arguments +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/CMakeTests/GetProperty-Missing-Argument.cmake b/Tests/RunCMake/get_property/MissingArgument.cmake index f0d004d..f0d004d 100644 --- a/Tests/CMakeTests/GetProperty-Missing-Argument.cmake +++ b/Tests/RunCMake/get_property/MissingArgument.cmake diff --git a/Tests/RunCMake/get_property/NoCache-result.txt b/Tests/RunCMake/get_property/NoCache-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/get_property/NoCache-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/get_property/NoCache-stderr.txt b/Tests/RunCMake/get_property/NoCache-stderr.txt new file mode 100644 index 0000000..defafb6 --- /dev/null +++ b/Tests/RunCMake/get_property/NoCache-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at NoCache.cmake:1 \(get_property\): + get_property not given name for CACHE scope. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/CMakeTests/GetProperty-No-Cache.cmake b/Tests/RunCMake/get_property/NoCache.cmake index 9719fe7..9719fe7 100644 --- a/Tests/CMakeTests/GetProperty-No-Cache.cmake +++ b/Tests/RunCMake/get_property/NoCache.cmake diff --git a/Tests/RunCMake/get_property/NoProperty-result.txt b/Tests/RunCMake/get_property/NoProperty-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/get_property/NoProperty-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/get_property/NoProperty-stderr.txt b/Tests/RunCMake/get_property/NoProperty-stderr.txt new file mode 100644 index 0000000..0ef147f --- /dev/null +++ b/Tests/RunCMake/get_property/NoProperty-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at NoProperty.cmake:1 \(get_property\): + get_property not given a PROPERTY <name> argument. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/CMakeTests/GetProperty-No-Property.cmake b/Tests/RunCMake/get_property/NoProperty.cmake index bee230d..bee230d 100644 --- a/Tests/CMakeTests/GetProperty-No-Property.cmake +++ b/Tests/RunCMake/get_property/NoProperty.cmake diff --git a/Tests/RunCMake/get_property/NoSource-result.txt b/Tests/RunCMake/get_property/NoSource-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/get_property/NoSource-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/get_property/NoSource-stderr.txt b/Tests/RunCMake/get_property/NoSource-stderr.txt new file mode 100644 index 0000000..59fd0ad --- /dev/null +++ b/Tests/RunCMake/get_property/NoSource-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at NoSource.cmake:1 \(get_property\): + get_property not given name for SOURCE scope. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/CMakeTests/GetProperty-No-Source.cmake b/Tests/RunCMake/get_property/NoSource.cmake index 89773c8..89773c8 100644 --- a/Tests/CMakeTests/GetProperty-No-Source.cmake +++ b/Tests/RunCMake/get_property/NoSource.cmake diff --git a/Tests/RunCMake/get_property/NoTarget-result.txt b/Tests/RunCMake/get_property/NoTarget-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/get_property/NoTarget-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/get_property/NoTarget-stderr.txt b/Tests/RunCMake/get_property/NoTarget-stderr.txt new file mode 100644 index 0000000..a0e1a94 --- /dev/null +++ b/Tests/RunCMake/get_property/NoTarget-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at NoTarget.cmake:1 \(get_property\): + get_property not given name for TARGET scope. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/CMakeTests/GetProperty-No-Target.cmake b/Tests/RunCMake/get_property/NoTarget.cmake index 8f1fa23..8f1fa23 100644 --- a/Tests/CMakeTests/GetProperty-No-Target.cmake +++ b/Tests/RunCMake/get_property/NoTarget.cmake diff --git a/Tests/RunCMake/get_property/NoTest-result.txt b/Tests/RunCMake/get_property/NoTest-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/get_property/NoTest-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/get_property/NoTest-stderr.txt b/Tests/RunCMake/get_property/NoTest-stderr.txt new file mode 100644 index 0000000..c90a0ffc --- /dev/null +++ b/Tests/RunCMake/get_property/NoTest-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at NoTest.cmake:1 \(get_property\): + get_property not given name for TEST scope. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/CMakeTests/GetProperty-No-Test.cmake b/Tests/RunCMake/get_property/NoTest.cmake index 045bd56..045bd56 100644 --- a/Tests/CMakeTests/GetProperty-No-Test.cmake +++ b/Tests/RunCMake/get_property/NoTest.cmake diff --git a/Tests/RunCMake/get_property/RunCMakeTest.cmake b/Tests/RunCMake/get_property/RunCMakeTest.cmake index e420b5b..00eef34 100644 --- a/Tests/RunCMake/get_property/RunCMakeTest.cmake +++ b/Tests/RunCMake/get_property/RunCMakeTest.cmake @@ -8,3 +8,17 @@ run_cmake(source_properties) run_cmake(target_properties) run_cmake(test_properties) run_cmake(DebugConfigurations) + +run_cmake(MissingArgument) +run_cmake(GlobalName) +run_cmake(BadTest) +run_cmake(BadTarget) +run_cmake(BadScope) +run_cmake(BadDirectory) +run_cmake(BadArgument) +run_cmake(VariableName) +run_cmake(NoTest) +run_cmake(NoTarget) +run_cmake(NoSource) +run_cmake(NoProperty) +run_cmake(NoCache) diff --git a/Tests/RunCMake/get_property/VariableName-result.txt b/Tests/RunCMake/get_property/VariableName-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/get_property/VariableName-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/get_property/VariableName-stderr.txt b/Tests/RunCMake/get_property/VariableName-stderr.txt new file mode 100644 index 0000000..e9f3827 --- /dev/null +++ b/Tests/RunCMake/get_property/VariableName-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at VariableName.cmake:1 \(get_property\): + get_property given name for VARIABLE scope. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/CMakeTests/GetProperty-Variable-Name.cmake b/Tests/RunCMake/get_property/VariableName.cmake index 9190f80..9190f80 100644 --- a/Tests/CMakeTests/GetProperty-Variable-Name.cmake +++ b/Tests/RunCMake/get_property/VariableName.cmake diff --git a/Tests/RunCMake/if/InvalidArgument1-result.txt b/Tests/RunCMake/if/InvalidArgument1-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/if/InvalidArgument1-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/if/InvalidArgument1-stderr.txt b/Tests/RunCMake/if/InvalidArgument1-stderr.txt new file mode 100644 index 0000000..bf2a994 --- /dev/null +++ b/Tests/RunCMake/if/InvalidArgument1-stderr.txt @@ -0,0 +1,8 @@ +^CMake Error at InvalidArgument1.cmake:1 \(if\): + if given arguments: + + "NOT" "foo" "bar" "STREQUAL" "foo bar" + + Unknown arguments specified +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/CMakeTests/If-Invalid-Argument.cmake b/Tests/RunCMake/if/InvalidArgument1.cmake index b4fb97f..b4fb97f 100644 --- a/Tests/CMakeTests/If-Invalid-Argument.cmake +++ b/Tests/RunCMake/if/InvalidArgument1.cmake diff --git a/Tests/RunCMake/if/RunCMakeTest.cmake b/Tests/RunCMake/if/RunCMakeTest.cmake index b5546a7..2c0c4d7 100644 --- a/Tests/RunCMake/if/RunCMakeTest.cmake +++ b/Tests/RunCMake/if/RunCMakeTest.cmake @@ -1,5 +1,6 @@ include(RunCMake) +run_cmake(InvalidArgument1) run_cmake(IsDirectory) run_cmake(IsDirectoryLong) run_cmake(elseif-message) diff --git a/Tests/RunCMake/list/GET-CMP0007-WARN-stderr.txt b/Tests/RunCMake/list/GET-CMP0007-WARN-stderr.txt new file mode 100644 index 0000000..a0f8837 --- /dev/null +++ b/Tests/RunCMake/list/GET-CMP0007-WARN-stderr.txt @@ -0,0 +1,8 @@ +^CMake Warning \(dev\) at GET-CMP0007-WARN.cmake:4 \(list\): + Policy CMP0007 is not set: list command no longer ignores empty elements. + Run "cmake --help-policy CMP0007" for policy details. Use the cmake_policy + command to set the policy and suppress this warning. List has value = + \[;NEW;OLD\]. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) +This warning is for project developers. Use -Wno-dev to suppress it.$ diff --git a/Tests/CMakeTests/List-Get-CMP0007-Warn.cmake b/Tests/RunCMake/list/GET-CMP0007-WARN.cmake index 0a9264f..833f352 100644 --- a/Tests/CMakeTests/List-Get-CMP0007-Warn.cmake +++ b/Tests/RunCMake/list/GET-CMP0007-WARN.cmake @@ -1,3 +1,4 @@ +cmake_policy(VERSION 2.4) set(thelist "" NEW OLD) list(GET thelist 1 thevalue) diff --git a/Tests/RunCMake/list/GET-InvalidIndex-result.txt b/Tests/RunCMake/list/GET-InvalidIndex-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/list/GET-InvalidIndex-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/list/GET-InvalidIndex-stderr.txt b/Tests/RunCMake/list/GET-InvalidIndex-stderr.txt new file mode 100644 index 0000000..0409464 --- /dev/null +++ b/Tests/RunCMake/list/GET-InvalidIndex-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at GET-InvalidIndex.cmake:2 \(list\): + list index: 3 out of range \(-3, 2\) +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/CMakeTests/List-Get-Invalid-Index.cmake b/Tests/RunCMake/list/GET-InvalidIndex.cmake index 178295a..178295a 100644 --- a/Tests/CMakeTests/List-Get-Invalid-Index.cmake +++ b/Tests/RunCMake/list/GET-InvalidIndex.cmake diff --git a/Tests/RunCMake/list/INSERT-InvalidIndex-result.txt b/Tests/RunCMake/list/INSERT-InvalidIndex-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/list/INSERT-InvalidIndex-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/list/INSERT-InvalidIndex-stderr.txt b/Tests/RunCMake/list/INSERT-InvalidIndex-stderr.txt new file mode 100644 index 0000000..6e15c0b --- /dev/null +++ b/Tests/RunCMake/list/INSERT-InvalidIndex-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at INSERT-InvalidIndex.cmake:2 \(list\): + list index: 3 out of range \(-3, 2\) +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/CMakeTests/List-Insert-Invalid-Index.cmake b/Tests/RunCMake/list/INSERT-InvalidIndex.cmake index 4103d97..4103d97 100644 --- a/Tests/CMakeTests/List-Insert-Invalid-Index.cmake +++ b/Tests/RunCMake/list/INSERT-InvalidIndex.cmake diff --git a/Tests/RunCMake/list/InvalidSubcommand-result.txt b/Tests/RunCMake/list/InvalidSubcommand-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/list/InvalidSubcommand-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/list/InvalidSubcommand-stderr.txt b/Tests/RunCMake/list/InvalidSubcommand-stderr.txt new file mode 100644 index 0000000..74703d2 --- /dev/null +++ b/Tests/RunCMake/list/InvalidSubcommand-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at InvalidSubcommand.cmake:1 \(list\): + list does not recognize sub-command NO_SUCH_SUBCOMMAND +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/CMakeTests/List-Invalid-Subcommand.cmake b/Tests/RunCMake/list/InvalidSubcommand.cmake index f35a118..f35a118 100644 --- a/Tests/CMakeTests/List-Invalid-Subcommand.cmake +++ b/Tests/RunCMake/list/InvalidSubcommand.cmake diff --git a/Tests/RunCMake/list/LENGTH-TooManyArguments-result.txt b/Tests/RunCMake/list/LENGTH-TooManyArguments-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/list/LENGTH-TooManyArguments-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/list/LENGTH-TooManyArguments-stderr.txt b/Tests/RunCMake/list/LENGTH-TooManyArguments-stderr.txt new file mode 100644 index 0000000..239e708 --- /dev/null +++ b/Tests/RunCMake/list/LENGTH-TooManyArguments-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at LENGTH-TooManyArguments.cmake:1 \(list\): + list sub-command LENGTH requires two arguments. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/CMakeTests/List-Length-Too-Many-Arguments.cmake b/Tests/RunCMake/list/LENGTH-TooManyArguments.cmake index 327db6a..327db6a 100644 --- a/Tests/CMakeTests/List-Length-Too-Many-Arguments.cmake +++ b/Tests/RunCMake/list/LENGTH-TooManyArguments.cmake diff --git a/Tests/RunCMake/list/NoArguments-result.txt b/Tests/RunCMake/list/NoArguments-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/list/NoArguments-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/list/NoArguments-stderr.txt b/Tests/RunCMake/list/NoArguments-stderr.txt new file mode 100644 index 0000000..6fdf9cc --- /dev/null +++ b/Tests/RunCMake/list/NoArguments-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at NoArguments.cmake:1 \(list\): + list must be called with at least two arguments. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/CMakeTests/List-No-Arguments.cmake b/Tests/RunCMake/list/NoArguments.cmake index 7916aaa..7916aaa 100644 --- a/Tests/CMakeTests/List-No-Arguments.cmake +++ b/Tests/RunCMake/list/NoArguments.cmake diff --git a/Tests/RunCMake/list/REMOVE_AT-InvalidIndex-result.txt b/Tests/RunCMake/list/REMOVE_AT-InvalidIndex-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/list/REMOVE_AT-InvalidIndex-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/list/REMOVE_AT-InvalidIndex-stderr.txt b/Tests/RunCMake/list/REMOVE_AT-InvalidIndex-stderr.txt new file mode 100644 index 0000000..6f58875 --- /dev/null +++ b/Tests/RunCMake/list/REMOVE_AT-InvalidIndex-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at REMOVE_AT-InvalidIndex.cmake:2 \(list\): + list index: 3 out of range \(-3, 2\) +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/CMakeTests/List-Remove_At-Invalid-Index.cmake b/Tests/RunCMake/list/REMOVE_AT-InvalidIndex.cmake index d4f3921..d4f3921 100644 --- a/Tests/CMakeTests/List-Remove_At-Invalid-Index.cmake +++ b/Tests/RunCMake/list/REMOVE_AT-InvalidIndex.cmake diff --git a/Tests/RunCMake/list/REMOVE_AT-NotList-result.txt b/Tests/RunCMake/list/REMOVE_AT-NotList-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/list/REMOVE_AT-NotList-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/list/REMOVE_AT-NotList-stderr.txt b/Tests/RunCMake/list/REMOVE_AT-NotList-stderr.txt new file mode 100644 index 0000000..d6e8d85 --- /dev/null +++ b/Tests/RunCMake/list/REMOVE_AT-NotList-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at REMOVE_AT-NotList.cmake:2 \(list\): + list sub-command REMOVE_AT requires list to be present. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/CMakeTests/List-Remove_At-Nonexistent-List.cmake b/Tests/RunCMake/list/REMOVE_AT-NotList.cmake index 5266c7f..5266c7f 100644 --- a/Tests/CMakeTests/List-Remove_At-Nonexistent-List.cmake +++ b/Tests/RunCMake/list/REMOVE_AT-NotList.cmake diff --git a/Tests/RunCMake/list/REMOVE_DUPLICATES-NotList-result.txt b/Tests/RunCMake/list/REMOVE_DUPLICATES-NotList-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/list/REMOVE_DUPLICATES-NotList-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/list/REMOVE_DUPLICATES-NotList-stderr.txt b/Tests/RunCMake/list/REMOVE_DUPLICATES-NotList-stderr.txt new file mode 100644 index 0000000..96f3446 --- /dev/null +++ b/Tests/RunCMake/list/REMOVE_DUPLICATES-NotList-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at REMOVE_DUPLICATES-NotList.cmake:2 \(list\): + list sub-command REMOVE_DUPLICATES requires list to be present. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/CMakeTests/List-Remove_Duplicates-Nonexistent-List.cmake b/Tests/RunCMake/list/REMOVE_DUPLICATES-NotList.cmake index 218f227..218f227 100644 --- a/Tests/CMakeTests/List-Remove_Duplicates-Nonexistent-List.cmake +++ b/Tests/RunCMake/list/REMOVE_DUPLICATES-NotList.cmake diff --git a/Tests/RunCMake/list/REMOVE_DUPLICATES-TooManyArguments-result.txt b/Tests/RunCMake/list/REMOVE_DUPLICATES-TooManyArguments-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/list/REMOVE_DUPLICATES-TooManyArguments-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/list/REMOVE_DUPLICATES-TooManyArguments-stderr.txt b/Tests/RunCMake/list/REMOVE_DUPLICATES-TooManyArguments-stderr.txt new file mode 100644 index 0000000..f5c8711 --- /dev/null +++ b/Tests/RunCMake/list/REMOVE_DUPLICATES-TooManyArguments-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at REMOVE_DUPLICATES-TooManyArguments.cmake:1 \(list\): + list sub-command REMOVE_DUPLICATES only takes one argument. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/CMakeTests/List-Remove_Duplicates-Too-Many-Arguments.cmake b/Tests/RunCMake/list/REMOVE_DUPLICATES-TooManyArguments.cmake index b5eb46e..b5eb46e 100644 --- a/Tests/CMakeTests/List-Remove_Duplicates-Too-Many-Arguments.cmake +++ b/Tests/RunCMake/list/REMOVE_DUPLICATES-TooManyArguments.cmake diff --git a/Tests/RunCMake/list/REMOVE_ITEM-NotList-result.txt b/Tests/RunCMake/list/REMOVE_ITEM-NotList-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/list/REMOVE_ITEM-NotList-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/list/REMOVE_ITEM-NotList-stderr.txt b/Tests/RunCMake/list/REMOVE_ITEM-NotList-stderr.txt new file mode 100644 index 0000000..c32a4c0 --- /dev/null +++ b/Tests/RunCMake/list/REMOVE_ITEM-NotList-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at REMOVE_ITEM-NotList.cmake:2 \(list\): + list sub-command REMOVE_ITEM requires list to be present. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/CMakeTests/List-Remove_Item-Nonexistent-List.cmake b/Tests/RunCMake/list/REMOVE_ITEM-NotList.cmake index 079e7fb..079e7fb 100644 --- a/Tests/CMakeTests/List-Remove_Item-Nonexistent-List.cmake +++ b/Tests/RunCMake/list/REMOVE_ITEM-NotList.cmake diff --git a/Tests/RunCMake/list/REVERSE-NotList-result.txt b/Tests/RunCMake/list/REVERSE-NotList-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/list/REVERSE-NotList-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/list/REVERSE-NotList-stderr.txt b/Tests/RunCMake/list/REVERSE-NotList-stderr.txt new file mode 100644 index 0000000..e9dcc06 --- /dev/null +++ b/Tests/RunCMake/list/REVERSE-NotList-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at REVERSE-NotList.cmake:2 \(list\): + list sub-command REVERSE requires list to be present. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/CMakeTests/List-Reverse-Nonexistent-List.cmake b/Tests/RunCMake/list/REVERSE-NotList.cmake index 977e2cc..977e2cc 100644 --- a/Tests/CMakeTests/List-Reverse-Nonexistent-List.cmake +++ b/Tests/RunCMake/list/REVERSE-NotList.cmake diff --git a/Tests/RunCMake/list/REVERSE-TooManyArguments-result.txt b/Tests/RunCMake/list/REVERSE-TooManyArguments-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/list/REVERSE-TooManyArguments-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/list/REVERSE-TooManyArguments-stderr.txt b/Tests/RunCMake/list/REVERSE-TooManyArguments-stderr.txt new file mode 100644 index 0000000..7dabd9d --- /dev/null +++ b/Tests/RunCMake/list/REVERSE-TooManyArguments-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at REVERSE-TooManyArguments.cmake:1 \(list\): + list sub-command REVERSE only takes one argument. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/CMakeTests/List-Reverse-Too-Many-Arguments.cmake b/Tests/RunCMake/list/REVERSE-TooManyArguments.cmake index 3a554a0..3a554a0 100644 --- a/Tests/CMakeTests/List-Reverse-Too-Many-Arguments.cmake +++ b/Tests/RunCMake/list/REVERSE-TooManyArguments.cmake diff --git a/Tests/RunCMake/list/RunCMakeTest.cmake b/Tests/RunCMake/list/RunCMakeTest.cmake index 555051d..25d6a03 100644 --- a/Tests/RunCMake/list/RunCMakeTest.cmake +++ b/Tests/RunCMake/list/RunCMakeTest.cmake @@ -3,3 +3,22 @@ include(RunCMake) run_cmake(EmptyGet0) run_cmake(EmptyRemoveAt0) run_cmake(EmptyInsert-1) + +run_cmake(NoArguments) +run_cmake(InvalidSubcommand) +run_cmake(GET-CMP0007-WARN) + +run_cmake(GET-InvalidIndex) +run_cmake(INSERT-InvalidIndex) +run_cmake(REMOVE_AT-InvalidIndex) + +run_cmake(LENGTH-TooManyArguments) +run_cmake(REMOVE_DUPLICATES-TooManyArguments) +run_cmake(REVERSE-TooManyArguments) +run_cmake(SORT-TooManyArguments) + +run_cmake(REMOVE_AT-NotList) +run_cmake(REMOVE_DUPLICATES-NotList) +run_cmake(REMOVE_ITEM-NotList) +run_cmake(REVERSE-NotList) +run_cmake(SORT-NotList) diff --git a/Tests/RunCMake/list/SORT-NotList-result.txt b/Tests/RunCMake/list/SORT-NotList-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/list/SORT-NotList-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/list/SORT-NotList-stderr.txt b/Tests/RunCMake/list/SORT-NotList-stderr.txt new file mode 100644 index 0000000..396c5b5 --- /dev/null +++ b/Tests/RunCMake/list/SORT-NotList-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at SORT-NotList.cmake:2 \(list\): + list sub-command SORT requires list to be present. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/CMakeTests/List-Sort-Nonexistent-List.cmake b/Tests/RunCMake/list/SORT-NotList.cmake index 8f48e10..8f48e10 100644 --- a/Tests/CMakeTests/List-Sort-Nonexistent-List.cmake +++ b/Tests/RunCMake/list/SORT-NotList.cmake diff --git a/Tests/RunCMake/list/SORT-TooManyArguments-result.txt b/Tests/RunCMake/list/SORT-TooManyArguments-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/list/SORT-TooManyArguments-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/list/SORT-TooManyArguments-stderr.txt b/Tests/RunCMake/list/SORT-TooManyArguments-stderr.txt new file mode 100644 index 0000000..d3fad60 --- /dev/null +++ b/Tests/RunCMake/list/SORT-TooManyArguments-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at SORT-TooManyArguments.cmake:1 \(list\): + list sub-command SORT only takes one argument. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/CMakeTests/List-Sort-Too-Many-Arguments.cmake b/Tests/RunCMake/list/SORT-TooManyArguments.cmake index 81b195d..81b195d 100644 --- a/Tests/CMakeTests/List-Sort-Too-Many-Arguments.cmake +++ b/Tests/RunCMake/list/SORT-TooManyArguments.cmake diff --git a/Tests/RunCMake/string/Append.cmake b/Tests/RunCMake/string/Append.cmake new file mode 100644 index 0000000..2634274 --- /dev/null +++ b/Tests/RunCMake/string/Append.cmake @@ -0,0 +1,58 @@ +set(out) +string(APPEND out) +if(DEFINED out) + message(FATAL_ERROR "\"string(APPEND out)\" set out to \"${out}\"") +endif() + +set(out "") +string(APPEND out) +if(NOT out STREQUAL "") + message(FATAL_ERROR "\"string(APPEND out)\" set out to \"${out}\"") +endif() + +set(out x) +string(APPEND out) +if(NOT out STREQUAL "x") + message(FATAL_ERROR "\"string(APPEND out)\" set out to \"${out}\"") +endif() + + +set(out) +string(APPEND out a) +if(NOT out STREQUAL "a") + message(FATAL_ERROR "\"string(APPEND out a)\" set out to \"${out}\"") +endif() + +set(out "") +string(APPEND out a) +if(NOT out STREQUAL "a") + message(FATAL_ERROR "\"string(APPEND out a)\" set out to \"${out}\"") +endif() + +set(out x) +string(APPEND out a) +if(NOT out STREQUAL "xa") + message(FATAL_ERROR "\"string(APPEND out a)\" set out to \"${out}\"") +endif() + + +set(out x) +string(APPEND out a "b") +if(NOT out STREQUAL "xab") + message(FATAL_ERROR "\"string(APPEND out a \"b\")\" set out to \"${out}\"") +endif() + +set(b) +set(out x) +string(APPEND out ${b}) +if(NOT out STREQUAL "x") + message(FATAL_ERROR "\"string(APPEND out \${b})\" set out to \"${out}\"") +endif() + +set(b b) +set(out x) +string(APPEND out a "${b}" [[ +${c}]]) +if(NOT out STREQUAL "xab\${c}") + message(FATAL_ERROR "\"string(APPEND out a \"\${b}\" [[\${c}]])\" set out to \"${out}\"") +endif() diff --git a/Tests/RunCMake/string/AppendNoArgs-result.txt b/Tests/RunCMake/string/AppendNoArgs-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/string/AppendNoArgs-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/string/AppendNoArgs-stderr.txt b/Tests/RunCMake/string/AppendNoArgs-stderr.txt new file mode 100644 index 0000000..75ad427 --- /dev/null +++ b/Tests/RunCMake/string/AppendNoArgs-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at AppendNoArgs.cmake:1 \(string\): + string sub-command APPEND requires at least one argument. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/string/AppendNoArgs.cmake b/Tests/RunCMake/string/AppendNoArgs.cmake new file mode 100644 index 0000000..f54fb77 --- /dev/null +++ b/Tests/RunCMake/string/AppendNoArgs.cmake @@ -0,0 +1 @@ +string(APPEND) diff --git a/Tests/RunCMake/string/RunCMakeTest.cmake b/Tests/RunCMake/string/RunCMakeTest.cmake index 89f7ea5..8067d9d 100644 --- a/Tests/RunCMake/string/RunCMakeTest.cmake +++ b/Tests/RunCMake/string/RunCMakeTest.cmake @@ -1,5 +1,8 @@ include(RunCMake) +run_cmake(Append) +run_cmake(AppendNoArgs) + run_cmake(Concat) run_cmake(ConcatNoArgs) diff --git a/Tests/RunCMake/while/CMakeLists.txt b/Tests/RunCMake/while/CMakeLists.txt new file mode 100644 index 0000000..12cd3c7 --- /dev/null +++ b/Tests/RunCMake/while/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 2.8.4) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/while/EndAlone-result.txt b/Tests/RunCMake/while/EndAlone-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/while/EndAlone-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/while/EndAlone-stderr.txt b/Tests/RunCMake/while/EndAlone-stderr.txt new file mode 100644 index 0000000..cd98687 --- /dev/null +++ b/Tests/RunCMake/while/EndAlone-stderr.txt @@ -0,0 +1,5 @@ +^CMake Error at EndAlone.cmake:1 \(endwhile\): + endwhile An ENDWHILE command was found outside of a proper WHILE ENDWHILE + structure. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/CMakeTests/While-Endwhile-Alone.cmake b/Tests/RunCMake/while/EndAlone.cmake index 82c09a0..82c09a0 100644 --- a/Tests/CMakeTests/While-Endwhile-Alone.cmake +++ b/Tests/RunCMake/while/EndAlone.cmake diff --git a/Tests/RunCMake/while/EndAloneArgs-result.txt b/Tests/RunCMake/while/EndAloneArgs-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/while/EndAloneArgs-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/while/EndAloneArgs-stderr.txt b/Tests/RunCMake/while/EndAloneArgs-stderr.txt new file mode 100644 index 0000000..a8c043d --- /dev/null +++ b/Tests/RunCMake/while/EndAloneArgs-stderr.txt @@ -0,0 +1,5 @@ +^CMake Error at EndAloneArgs.cmake:1 \(endwhile\): + endwhile An ENDWHILE command was found outside of a proper WHILE ENDWHILE + structure. Or its arguments did not match the opening WHILE command. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/CMakeTests/While-Endwhile-Alone-Args.cmake b/Tests/RunCMake/while/EndAloneArgs.cmake index 886d98c..886d98c 100644 --- a/Tests/CMakeTests/While-Endwhile-Alone-Args.cmake +++ b/Tests/RunCMake/while/EndAloneArgs.cmake diff --git a/Tests/RunCMake/while/EndMismatch-stderr.txt b/Tests/RunCMake/while/EndMismatch-stderr.txt new file mode 100644 index 0000000..d7439e8 --- /dev/null +++ b/Tests/RunCMake/while/EndMismatch-stderr.txt @@ -0,0 +1,13 @@ +^CMake Warning \(dev\) at EndMismatch.cmake:3 \(include\): + A logical block opening on the line + + .*/Tests/RunCMake/while/EndMismatch.cmake:1 \(while\) + + closes on the line + + .*/Tests/RunCMake/while/EndMismatch.cmake:2 \(endwhile\) + + with mis-matching arguments. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) +This warning is for project developers. Use -Wno-dev to suppress it.$ diff --git a/Tests/CMakeTests/While-Endwhile-Mismatch.cmake b/Tests/RunCMake/while/EndMismatch.cmake index 5c338d6..5c338d6 100644 --- a/Tests/CMakeTests/While-Endwhile-Mismatch.cmake +++ b/Tests/RunCMake/while/EndMismatch.cmake diff --git a/Tests/RunCMake/while/EndMissing-result.txt b/Tests/RunCMake/while/EndMissing-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/while/EndMissing-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/while/EndMissing-stderr.txt b/Tests/RunCMake/while/EndMissing-stderr.txt new file mode 100644 index 0000000..099a8b2 --- /dev/null +++ b/Tests/RunCMake/while/EndMissing-stderr.txt @@ -0,0 +1,6 @@ +^CMake Error at CMakeLists.txt:3 \(include\): + A logical block opening on the line + + .*/Tests/RunCMake/while/EndMissing.cmake:1 \(while\) + + is not closed.$ diff --git a/Tests/CMakeTests/While-Missing-Endwhile.cmake b/Tests/RunCMake/while/EndMissing.cmake index 1abaaaf..1abaaaf 100644 --- a/Tests/CMakeTests/While-Missing-Endwhile.cmake +++ b/Tests/RunCMake/while/EndMissing.cmake diff --git a/Tests/RunCMake/while/MissingArgument-result.txt b/Tests/RunCMake/while/MissingArgument-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/while/MissingArgument-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/while/MissingArgument-stderr.txt b/Tests/RunCMake/while/MissingArgument-stderr.txt new file mode 100644 index 0000000..7ff0971 --- /dev/null +++ b/Tests/RunCMake/while/MissingArgument-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at MissingArgument.cmake:1 \(while\): + while called with incorrect number of arguments +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/CMakeTests/While-Missing-Argument.cmake b/Tests/RunCMake/while/MissingArgument.cmake index 32eaa26..32eaa26 100644 --- a/Tests/CMakeTests/While-Missing-Argument.cmake +++ b/Tests/RunCMake/while/MissingArgument.cmake diff --git a/Tests/RunCMake/while/RunCMakeTest.cmake b/Tests/RunCMake/while/RunCMakeTest.cmake new file mode 100644 index 0000000..7da80ac --- /dev/null +++ b/Tests/RunCMake/while/RunCMakeTest.cmake @@ -0,0 +1,7 @@ +include(RunCMake) + +run_cmake(MissingArgument) +run_cmake(EndMissing) +run_cmake(EndMismatch) +run_cmake(EndAlone) +run_cmake(EndAloneArgs) diff --git a/Tests/SwiftMix/CMain.c b/Tests/SwiftMix/CMain.c new file mode 100644 index 0000000..13e2f8c --- /dev/null +++ b/Tests/SwiftMix/CMain.c @@ -0,0 +1,4 @@ +extern int ObjCMain(int argc, char const* const argv[]); +int main(int argc, char* argv[]) { + return ObjCMain(argc, argv); +} diff --git a/Tests/SwiftMix/CMakeLists.txt b/Tests/SwiftMix/CMakeLists.txt new file mode 100644 index 0000000..5e50470 --- /dev/null +++ b/Tests/SwiftMix/CMakeLists.txt @@ -0,0 +1,5 @@ +cmake_minimum_required(VERSION 3.3) +project(SwiftMix C Swift) + +add_executable(SwiftMix CMain.c ObjCMain.m SwiftMain.swift ObjC-Swift.h) +set_property(TARGET SwiftMix PROPERTY XCODE_ATTRIBUTE_SWIFT_OBJC_BRIDGING_HEADER "ObjC-Swift.h") diff --git a/Tests/SwiftMix/ObjC-Swift.h b/Tests/SwiftMix/ObjC-Swift.h new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/SwiftMix/ObjC-Swift.h diff --git a/Tests/SwiftMix/ObjCMain.m b/Tests/SwiftMix/ObjCMain.m new file mode 100644 index 0000000..7fa90ae --- /dev/null +++ b/Tests/SwiftMix/ObjCMain.m @@ -0,0 +1,4 @@ +#import "SwiftMix-Swift.h" +int ObjCMain(int argc, char const* const argv[]) { + return [SwiftMainClass SwiftMain:argc argv:argv]; +} diff --git a/Tests/SwiftMix/SwiftMain.swift b/Tests/SwiftMix/SwiftMain.swift new file mode 100644 index 0000000..9af9883 --- /dev/null +++ b/Tests/SwiftMix/SwiftMain.swift @@ -0,0 +1,10 @@ +@objc class SwiftMainClass { + class func SwiftMain(argc:Int, argv:UnsafePointer<UnsafePointer<CChar>>) -> Int32 { + println("argc: \(argc)") + for (var i = 0; i < argc; ++i) { + var argi = String.fromCString(argv[i]) + println("arg[\(i)]: \(argi)"); + } + return 0; + } +} diff --git a/Tests/SwiftOnly/CMakeLists.txt b/Tests/SwiftOnly/CMakeLists.txt new file mode 100644 index 0000000..5cb9739 --- /dev/null +++ b/Tests/SwiftOnly/CMakeLists.txt @@ -0,0 +1,4 @@ +cmake_minimum_required(VERSION 3.3) +project(SwiftOnly Swift) + +add_executable(SwiftOnly main.swift) diff --git a/Tests/SwiftOnly/main.swift b/Tests/SwiftOnly/main.swift new file mode 100644 index 0000000..67be986 --- /dev/null +++ b/Tests/SwiftOnly/main.swift @@ -0,0 +1 @@ +println("SwiftOnly") diff --git a/Tests/VSNsightTegra/CMakeLists.txt b/Tests/VSNsightTegra/CMakeLists.txt index 10f55d9..61a04fd 100644 --- a/Tests/VSNsightTegra/CMakeLists.txt +++ b/Tests/VSNsightTegra/CMakeLists.txt @@ -1,10 +1,16 @@ -cmake_minimum_required(VERSION 3.0) +cmake_minimum_required(VERSION 3.3) project(VSNsightTegra C CXX) +set(CMAKE_ANDROID_ARCH armv7-a-hard) +set(CMAKE_ANDROID_STL_TYPE stlport_shared) set(CMAKE_ANDROID_API_MIN 9) set(CMAKE_ANDROID_API 15) set(CMAKE_ANDROID_GUI 1) +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/bin") +set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/lib") +set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/lib") + set(FIRST_C_FILES jni/first.c jni/first.h @@ -38,3 +44,14 @@ add_executable(twolib-second target_include_directories(twolib-second PUBLIC jni) target_link_libraries(twolib-second twolib-first) target_link_libraries(twolib-second m) # test linking to library by name + +set_property(TARGET twolib-second PROPERTY C_STANDARD 11) +set_target_properties(twolib-second PROPERTIES ANDROID_SKIP_ANT_STEP 1) +set_target_properties(twolib-second PROPERTIES ANDROID_PROGUARD 1) +set_target_properties(twolib-second PROPERTIES ANDROID_PROGUARD_CONFIG_PATH proguard-android.txt) +set_target_properties(twolib-second PROPERTIES ANDROID_SECURE_PROPS_PATH /definitely/insecure) + +set_property(TARGET twolib-second PROPERTY ANDROID_NATIVE_LIB_DIRECTORIES $<TARGET_FILE_DIR:twolib-second>) +set_property(TARGET twolib-second PROPERTY ANDROID_NATIVE_LIB_DEPENDENCIES $<TARGET_FILE_NAME:twolib-second>) + +set_property(TARGET twolib-second PROPERTY ANDROID_JAR_DIRECTORIES $<TARGET_FILE_DIR:twolib-first>) diff --git a/Tests/VSNsightTegra/proguard-android.txt b/Tests/VSNsightTegra/proguard-android.txt new file mode 100644 index 0000000..fe73bae --- /dev/null +++ b/Tests/VSNsightTegra/proguard-android.txt @@ -0,0 +1,57 @@ +# This is a configuration file for ProGuard. +# http://proguard.sourceforge.net/index.html#manual/usage.html + +-dontusemixedcaseclassnames +-dontskipnonpubliclibraryclasses +-verbose + +# Optimization is turned off by default. Dex does not like code run +# through the ProGuard optimize and preverify steps (and performs some +# of these optimizations on its own). +-dontoptimize +-dontpreverify +# Note that if you want to enable optimization, you cannot just +# include optimization flags in your own project configuration file; +# instead you will need to point to the +# "proguard-android-optimize.txt" file instead of this one from your +# project.properties file. + +-keepattributes *Annotation* +-keep public class com.google.vending.licensing.ILicensingService +-keep public class com.android.vending.licensing.ILicensingService + +# For native methods, see http://proguard.sourceforge.net/manual/examples.html#native +-keepclasseswithmembernames class * { + native <methods>; +} + +# keep setters in Views so that animations can still work. +# see http://proguard.sourceforge.net/manual/examples.html#beans +-keepclassmembers public class * extends android.view.View { + void set*(***); + *** get*(); +} + +# We want to keep methods in Activity that could be used in the XML attribute onClick +-keepclassmembers class * extends android.app.Activity { + public void *(android.view.View); +} + +# For enumeration classes, see http://proguard.sourceforge.net/manual/examples.html#enumerations +-keepclassmembers enum * { + public static **[] values(); + public static ** valueOf(java.lang.String); +} + +-keep class * implements android.os.Parcelable { + public static final android.os.Parcelable$Creator *; +} + +-keepclassmembers class **.R$* { + public static <fields>; +} + +# The support library contains references to newer platform versions. +# Don't warn about those in case this app is linking against an older +# platform version. We know about them, and they are safe. +-dontwarn android.support.** diff --git a/Tests/VSResource/CMakeLists.txt b/Tests/VSResource/CMakeLists.txt index 17eb041..3b9cfc3 100644 --- a/Tests/VSResource/CMakeLists.txt +++ b/Tests/VSResource/CMakeLists.txt @@ -46,7 +46,10 @@ else() include_directories(${CMAKE_CURRENT_BINARY_DIR}) endif() +add_library(ResourceLib STATIC lib.cpp lib.rc) + add_executable(VSResource main.cpp test.rc) +target_link_libraries(VSResource ResourceLib) set_property(TARGET VSResource PROPERTY VS_GLOBAL_CMakeTestVsGlobalVariable "test val") diff --git a/Tests/VSResource/lib.cpp b/Tests/VSResource/lib.cpp new file mode 100644 index 0000000..006e3e4 --- /dev/null +++ b/Tests/VSResource/lib.cpp @@ -0,0 +1 @@ +int lib() { return 0; } diff --git a/Tests/VSResource/lib.rc b/Tests/VSResource/lib.rc new file mode 100644 index 0000000..1ffade6 --- /dev/null +++ b/Tests/VSResource/lib.rc @@ -0,0 +1,4 @@ +STRINGTABLE +BEGIN + 1234 "5" +END diff --git a/Tests/VSResource/main.cpp b/Tests/VSResource/main.cpp index 7ee0c74..ccf700c 100644 --- a/Tests/VSResource/main.cpp +++ b/Tests/VSResource/main.cpp @@ -1,6 +1,8 @@ #include <windows.h> #include <stdio.h> +extern int lib(); + struct x { const char *txt; @@ -76,5 +78,5 @@ int main(int argc, char** argv) } } - return ret; + return ret + lib(); } |