diff options
Diffstat (limited to 'Tests/RunCMake')
250 files changed, 1752 insertions, 47 deletions
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/RunCMake/get_property/BadArgument.cmake b/Tests/RunCMake/get_property/BadArgument.cmake new file mode 100644 index 0000000..382dabb --- /dev/null +++ b/Tests/RunCMake/get_property/BadArgument.cmake @@ -0,0 +1 @@ +get_property(FOO GLOBAL PROPERTY FOO FOO) 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/RunCMake/get_property/BadDirectory.cmake b/Tests/RunCMake/get_property/BadDirectory.cmake new file mode 100644 index 0000000..cdbfa80 --- /dev/null +++ b/Tests/RunCMake/get_property/BadDirectory.cmake @@ -0,0 +1 @@ +get_property(FOO DIRECTORY NonExistentSubDir PROPERTY FOO) 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/RunCMake/get_property/BadScope.cmake b/Tests/RunCMake/get_property/BadScope.cmake new file mode 100644 index 0000000..ea8566b --- /dev/null +++ b/Tests/RunCMake/get_property/BadScope.cmake @@ -0,0 +1 @@ +get_property(FOO FOO FOO) 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/RunCMake/get_property/BadTarget.cmake b/Tests/RunCMake/get_property/BadTarget.cmake new file mode 100644 index 0000000..9992dab --- /dev/null +++ b/Tests/RunCMake/get_property/BadTarget.cmake @@ -0,0 +1 @@ +get_property(FOO TARGET FOO PROPERTY FOO) 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/RunCMake/get_property/BadTest.cmake b/Tests/RunCMake/get_property/BadTest.cmake new file mode 100644 index 0000000..44bf3eb --- /dev/null +++ b/Tests/RunCMake/get_property/BadTest.cmake @@ -0,0 +1 @@ +get_property(FOO TEST FOO PROPERTY FOO) 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/RunCMake/get_property/GlobalName.cmake b/Tests/RunCMake/get_property/GlobalName.cmake new file mode 100644 index 0000000..497700c --- /dev/null +++ b/Tests/RunCMake/get_property/GlobalName.cmake @@ -0,0 +1 @@ +get_property(FOO GLOBAL FOO PROPERTY FOO) 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/RunCMake/get_property/MissingArgument.cmake b/Tests/RunCMake/get_property/MissingArgument.cmake new file mode 100644 index 0000000..f0d004d --- /dev/null +++ b/Tests/RunCMake/get_property/MissingArgument.cmake @@ -0,0 +1 @@ +get_property() 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/RunCMake/get_property/NoCache.cmake b/Tests/RunCMake/get_property/NoCache.cmake new file mode 100644 index 0000000..9719fe7 --- /dev/null +++ b/Tests/RunCMake/get_property/NoCache.cmake @@ -0,0 +1 @@ +get_property(FOO CACHE PROPERTY FOO) 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/RunCMake/get_property/NoProperty.cmake b/Tests/RunCMake/get_property/NoProperty.cmake new file mode 100644 index 0000000..bee230d --- /dev/null +++ b/Tests/RunCMake/get_property/NoProperty.cmake @@ -0,0 +1 @@ +get_property(FOO GLOBAL PROPERTY) 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/RunCMake/get_property/NoSource.cmake b/Tests/RunCMake/get_property/NoSource.cmake new file mode 100644 index 0000000..89773c8 --- /dev/null +++ b/Tests/RunCMake/get_property/NoSource.cmake @@ -0,0 +1 @@ +get_property(FOO SOURCE PROPERTY FOO) 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/RunCMake/get_property/NoTarget.cmake b/Tests/RunCMake/get_property/NoTarget.cmake new file mode 100644 index 0000000..8f1fa23 --- /dev/null +++ b/Tests/RunCMake/get_property/NoTarget.cmake @@ -0,0 +1 @@ +get_property(FOO TARGET PROPERTY FOO) 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/RunCMake/get_property/NoTest.cmake b/Tests/RunCMake/get_property/NoTest.cmake new file mode 100644 index 0000000..045bd56 --- /dev/null +++ b/Tests/RunCMake/get_property/NoTest.cmake @@ -0,0 +1 @@ +get_property(FOO TEST PROPERTY FOO) 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/RunCMake/get_property/VariableName.cmake b/Tests/RunCMake/get_property/VariableName.cmake new file mode 100644 index 0000000..9190f80 --- /dev/null +++ b/Tests/RunCMake/get_property/VariableName.cmake @@ -0,0 +1 @@ +get_property(FOO VARIABLE FOO PROPERTY FOO) 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/RunCMake/if/InvalidArgument1.cmake b/Tests/RunCMake/if/InvalidArgument1.cmake new file mode 100644 index 0000000..b4fb97f --- /dev/null +++ b/Tests/RunCMake/if/InvalidArgument1.cmake @@ -0,0 +1,2 @@ +if (NOT foo bar STREQUAL "foo bar") +endif() 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/RunCMake/list/GET-CMP0007-WARN.cmake b/Tests/RunCMake/list/GET-CMP0007-WARN.cmake new file mode 100644 index 0000000..833f352 --- /dev/null +++ b/Tests/RunCMake/list/GET-CMP0007-WARN.cmake @@ -0,0 +1,7 @@ +cmake_policy(VERSION 2.4) +set(thelist "" NEW OLD) + +list(GET thelist 1 thevalue) +if (NOT thevalue STREQUAL "OLD") + message(SEND_ERROR "returned element '${thevalue}', but expected 'OLD'") +endif() 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/RunCMake/list/GET-InvalidIndex.cmake b/Tests/RunCMake/list/GET-InvalidIndex.cmake new file mode 100644 index 0000000..178295a --- /dev/null +++ b/Tests/RunCMake/list/GET-InvalidIndex.cmake @@ -0,0 +1,2 @@ +set(mylist alpha bravo charlie) +list(GET mylist 3 result) 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/RunCMake/list/INSERT-InvalidIndex.cmake b/Tests/RunCMake/list/INSERT-InvalidIndex.cmake new file mode 100644 index 0000000..4103d97 --- /dev/null +++ b/Tests/RunCMake/list/INSERT-InvalidIndex.cmake @@ -0,0 +1,2 @@ +set(mylist alpha bravo charlie) +list(INSERT mylist 3 delta) 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/RunCMake/list/InvalidSubcommand.cmake b/Tests/RunCMake/list/InvalidSubcommand.cmake new file mode 100644 index 0000000..f35a118 --- /dev/null +++ b/Tests/RunCMake/list/InvalidSubcommand.cmake @@ -0,0 +1 @@ +list(NO_SUCH_SUBCOMMAND mylist) 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/RunCMake/list/LENGTH-TooManyArguments.cmake b/Tests/RunCMake/list/LENGTH-TooManyArguments.cmake new file mode 100644 index 0000000..327db6a --- /dev/null +++ b/Tests/RunCMake/list/LENGTH-TooManyArguments.cmake @@ -0,0 +1 @@ +list(LENGTH mylist result one_too_many) 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/RunCMake/list/NoArguments.cmake b/Tests/RunCMake/list/NoArguments.cmake new file mode 100644 index 0000000..7916aaa --- /dev/null +++ b/Tests/RunCMake/list/NoArguments.cmake @@ -0,0 +1 @@ +list() 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/RunCMake/list/REMOVE_AT-InvalidIndex.cmake b/Tests/RunCMake/list/REMOVE_AT-InvalidIndex.cmake new file mode 100644 index 0000000..d4f3921 --- /dev/null +++ b/Tests/RunCMake/list/REMOVE_AT-InvalidIndex.cmake @@ -0,0 +1,2 @@ +set(mylist alpha bravo charlie) +list(REMOVE_AT mylist 3) 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/RunCMake/list/REMOVE_AT-NotList.cmake b/Tests/RunCMake/list/REMOVE_AT-NotList.cmake new file mode 100644 index 0000000..5266c7f --- /dev/null +++ b/Tests/RunCMake/list/REMOVE_AT-NotList.cmake @@ -0,0 +1,2 @@ +unset(nosuchlist) +list(REMOVE_AT nosuchlist 0) 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/RunCMake/list/REMOVE_DUPLICATES-NotList.cmake b/Tests/RunCMake/list/REMOVE_DUPLICATES-NotList.cmake new file mode 100644 index 0000000..218f227 --- /dev/null +++ b/Tests/RunCMake/list/REMOVE_DUPLICATES-NotList.cmake @@ -0,0 +1,2 @@ +unset(nosuchlist) +list(REMOVE_DUPLICATES nosuchlist) 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/RunCMake/list/REMOVE_DUPLICATES-TooManyArguments.cmake b/Tests/RunCMake/list/REMOVE_DUPLICATES-TooManyArguments.cmake new file mode 100644 index 0000000..b5eb46e --- /dev/null +++ b/Tests/RunCMake/list/REMOVE_DUPLICATES-TooManyArguments.cmake @@ -0,0 +1 @@ +list(REMOVE_DUPLICATES mylist one_too_many) 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/RunCMake/list/REMOVE_ITEM-NotList.cmake b/Tests/RunCMake/list/REMOVE_ITEM-NotList.cmake new file mode 100644 index 0000000..079e7fb --- /dev/null +++ b/Tests/RunCMake/list/REMOVE_ITEM-NotList.cmake @@ -0,0 +1,2 @@ +unset(nosuchlist) +list(REMOVE_ITEM nosuchlist alpha) 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/RunCMake/list/REVERSE-NotList.cmake b/Tests/RunCMake/list/REVERSE-NotList.cmake new file mode 100644 index 0000000..977e2cc --- /dev/null +++ b/Tests/RunCMake/list/REVERSE-NotList.cmake @@ -0,0 +1,2 @@ +unset(nosuchlist) +list(REVERSE nosuchlist) 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/RunCMake/list/REVERSE-TooManyArguments.cmake b/Tests/RunCMake/list/REVERSE-TooManyArguments.cmake new file mode 100644 index 0000000..3a554a0 --- /dev/null +++ b/Tests/RunCMake/list/REVERSE-TooManyArguments.cmake @@ -0,0 +1 @@ +list(REVERSE mylist one_too_many) 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/RunCMake/list/SORT-NotList.cmake b/Tests/RunCMake/list/SORT-NotList.cmake new file mode 100644 index 0000000..8f48e10 --- /dev/null +++ b/Tests/RunCMake/list/SORT-NotList.cmake @@ -0,0 +1,2 @@ +unset(nosuchlist) +list(SORT nosuchlist) 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/RunCMake/list/SORT-TooManyArguments.cmake b/Tests/RunCMake/list/SORT-TooManyArguments.cmake new file mode 100644 index 0000000..81b195d --- /dev/null +++ b/Tests/RunCMake/list/SORT-TooManyArguments.cmake @@ -0,0 +1 @@ +list(SORT mylist one_too_many) 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/RunCMake/while/EndAlone.cmake b/Tests/RunCMake/while/EndAlone.cmake new file mode 100644 index 0000000..82c09a0 --- /dev/null +++ b/Tests/RunCMake/while/EndAlone.cmake @@ -0,0 +1 @@ +endwhile() 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/RunCMake/while/EndAloneArgs.cmake b/Tests/RunCMake/while/EndAloneArgs.cmake new file mode 100644 index 0000000..886d98c --- /dev/null +++ b/Tests/RunCMake/while/EndAloneArgs.cmake @@ -0,0 +1 @@ +endwhile(a) 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/RunCMake/while/EndMismatch.cmake b/Tests/RunCMake/while/EndMismatch.cmake new file mode 100644 index 0000000..5c338d6 --- /dev/null +++ b/Tests/RunCMake/while/EndMismatch.cmake @@ -0,0 +1,2 @@ +while(a) +endwhile(b) 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/RunCMake/while/EndMissing.cmake b/Tests/RunCMake/while/EndMissing.cmake new file mode 100644 index 0000000..1abaaaf --- /dev/null +++ b/Tests/RunCMake/while/EndMissing.cmake @@ -0,0 +1 @@ +while(a) 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/RunCMake/while/MissingArgument.cmake b/Tests/RunCMake/while/MissingArgument.cmake new file mode 100644 index 0000000..32eaa26 --- /dev/null +++ b/Tests/RunCMake/while/MissingArgument.cmake @@ -0,0 +1 @@ +while() 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) |