diff options
Diffstat (limited to 'Tests')
33 files changed, 150 insertions, 20 deletions
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 971d7ff..a22521b 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -396,6 +396,7 @@ if(BUILD_TESTING) ADD_TEST_MACRO(CompatibleInterface CompatibleInterface) ADD_TEST_MACRO(AliasTarget AliasTarget) ADD_TEST_MACRO(StagingPrefix StagingPrefix) + ADD_TEST_MACRO(ImportedSameName ImportedSameName) ADD_TEST_MACRO(InterfaceLibrary InterfaceLibrary) if (CMAKE_BUILD_TYPE MATCHES "[Dd][Ee][Bb][Uu][Gg]") set(ConfigSources_BUILD_OPTIONS -DCMAKE_BUILD_TYPE=Debug) diff --git a/Tests/ImportedSameName/A/CMakeLists.txt b/Tests/ImportedSameName/A/CMakeLists.txt new file mode 100644 index 0000000..0a31b40 --- /dev/null +++ b/Tests/ImportedSameName/A/CMakeLists.txt @@ -0,0 +1,8 @@ +add_library(a STATIC a.c) +target_compile_definitions(a INTERFACE DEF_A) + +add_library(sameName INTERFACE IMPORTED) +target_link_libraries(sameName INTERFACE a) + +add_library(ifaceA INTERFACE) +target_link_libraries(ifaceA INTERFACE sameName) diff --git a/Tests/ImportedSameName/A/a.c b/Tests/ImportedSameName/A/a.c new file mode 100644 index 0000000..4ef3698 --- /dev/null +++ b/Tests/ImportedSameName/A/a.c @@ -0,0 +1,3 @@ +void a(void) +{ +} diff --git a/Tests/ImportedSameName/B/CMakeLists.txt b/Tests/ImportedSameName/B/CMakeLists.txt new file mode 100644 index 0000000..d930326 --- /dev/null +++ b/Tests/ImportedSameName/B/CMakeLists.txt @@ -0,0 +1,8 @@ +add_library(b STATIC b.c) +target_compile_definitions(b INTERFACE DEF_B) + +add_library(sameName INTERFACE IMPORTED) +target_link_libraries(sameName INTERFACE b) + +add_library(ifaceB INTERFACE) +target_link_libraries(ifaceB INTERFACE sameName) diff --git a/Tests/ImportedSameName/B/b.c b/Tests/ImportedSameName/B/b.c new file mode 100644 index 0000000..c7c7df4 --- /dev/null +++ b/Tests/ImportedSameName/B/b.c @@ -0,0 +1,3 @@ +void b(void) +{ +} diff --git a/Tests/ImportedSameName/CMakeLists.txt b/Tests/ImportedSameName/CMakeLists.txt new file mode 100644 index 0000000..4292c12 --- /dev/null +++ b/Tests/ImportedSameName/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.12) +project(ImportedSameName C) + +add_subdirectory(A) +add_subdirectory(B) + +add_executable(ImportedSameName main.c) +target_link_libraries(ImportedSameName PRIVATE ifaceA ifaceB) diff --git a/Tests/ImportedSameName/main.c b/Tests/ImportedSameName/main.c new file mode 100644 index 0000000..a0cb27f --- /dev/null +++ b/Tests/ImportedSameName/main.c @@ -0,0 +1,16 @@ +#ifndef DEF_A +# error "DEF_A not defined" +#endif +#ifndef DEF_B +# error "DEF_B not defined" +#endif + +extern void a(void); +extern void b(void); + +int main(void) +{ + a(); + b(); + return 0; +} diff --git a/Tests/RunCMake/CPack/tests/PER_COMPONENT_FIELDS/VerifyResult.cmake b/Tests/RunCMake/CPack/tests/PER_COMPONENT_FIELDS/VerifyResult.cmake index 18ef63c..b4bdb61 100644 --- a/Tests/RunCMake/CPack/tests/PER_COMPONENT_FIELDS/VerifyResult.cmake +++ b/Tests/RunCMake/CPack/tests/PER_COMPONENT_FIELDS/VerifyResult.cmake @@ -1,7 +1,7 @@ function(checkPackageInfo_ TYPE FILE REGEX) getPackageInfo("${FILE}" "FILE_INFO_") if(NOT FILE_INFO_ MATCHES "${REGEX}") - message(FATAL_ERROR "Unexpected ${TYPE} in '${FILE}'; file info: '${FILE_INFO_}'") + message(FATAL_ERROR "Unexpected ${TYPE} in '${FILE}'; file info: '${FILE_INFO_}'; does not match '${REGEX}'") endif() endfunction() @@ -24,3 +24,15 @@ checkPackageInfo_("name" "${FOUND_FILE_3}" ".*${name_}${whitespaces_}:${whitespa checkPackageInfo_("group" "${FOUND_FILE_1}" ".*${group_}${whitespaces_}:${whitespaces_}default") checkPackageInfo_("group" "${FOUND_FILE_2}" ".*${group_}${whitespaces_}:${whitespaces_}second_group") checkPackageInfo_("group" "${FOUND_FILE_3}" ".*${group_}${whitespaces_}:${whitespaces_}default") + +# check package summaries (not available in DEB) +if(GENERATOR_TYPE STREQUAL "RPM") + checkPackageInfo_("summary" "${FOUND_FILE_1}" ".*Summary${whitespaces_}:${whitespaces_}Global summary") + checkPackageInfo_("summary" "${FOUND_FILE_2}" ".*Summary${whitespaces_}:${whitespaces_}Summary for pkg_2") + checkPackageInfo_("summary" "${FOUND_FILE_3}" ".*Summary${whitespaces_}:${whitespaces_}Global summary") +endif() + +# check package description +checkPackageInfo_("description" "${FOUND_FILE_1}" ".*Description${whitespaces_}:${whitespaces_}Description for pkg_1") +checkPackageInfo_("description" "${FOUND_FILE_2}" ".*Description${whitespaces_}:${whitespaces_}Description for pkg_2") +checkPackageInfo_("description" "${FOUND_FILE_3}" ".*Description${whitespaces_}:${whitespaces_}Description for pkg_3") diff --git a/Tests/RunCMake/CPack/tests/PER_COMPONENT_FIELDS/test.cmake b/Tests/RunCMake/CPack/tests/PER_COMPONENT_FIELDS/test.cmake index 8719c0b..dc61d0a 100644 --- a/Tests/RunCMake/CPack/tests/PER_COMPONENT_FIELDS/test.cmake +++ b/Tests/RunCMake/CPack/tests/PER_COMPONENT_FIELDS/test.cmake @@ -11,6 +11,13 @@ if(GENERATOR_TYPE STREQUAL "DEB" OR GENERATOR_TYPE STREQUAL "RPM") set(CPACK_${GENERATOR_TYPE}${generator_type_suffix_}_PACKAGE_${group_} "default") set(CPACK_${GENERATOR_TYPE}${generator_type_suffix_}_PKG_2_PACKAGE_NAME "second") set(CPACK_${GENERATOR_TYPE}${generator_type_suffix_}_PKG_2_PACKAGE_${group_} "second_group") + + set(CPACK_${GENERATOR_TYPE}${generator_type_suffix_}_PACKAGE_SUMMARY "Global summary") # not used for DEB + set(CPACK_${GENERATOR_TYPE}${generator_type_suffix_}_PKG_2_PACKAGE_SUMMARY "Summary for pkg_2") # not used for DEB + + set(CPACK_COMPONENT_PKG_1_DESCRIPTION "Description for pkg_1") + set(CPACK_COMPONENT_PKG_2_DESCRIPTION "Description for pkg_2") + set(CPACK_COMPONENT_PKG_3_DESCRIPTION "Description for pkg_3") endif() install(FILES CMakeLists.txt DESTINATION foo COMPONENT pkg_1) diff --git a/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake index 3033c9c..9e8d050 100644 --- a/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake +++ b/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake @@ -111,8 +111,8 @@ endfunction() 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) +# our threshold and that they then run once the load average drops. +run_TestLoad(test-load-wait 3) # Verify that warning message is displayed but tests still start when # an invalid argument is given. diff --git a/Tests/RunCMake/CTestCommandLine/test-load-fail-stderr.txt b/Tests/RunCMake/CTestCommandLine/test-load-fail-stderr.txt deleted file mode 100644 index eafba1c..0000000 --- a/Tests/RunCMake/CTestCommandLine/test-load-fail-stderr.txt +++ /dev/null @@ -1 +0,0 @@ -No tests were found!!! diff --git a/Tests/RunCMake/CTestCommandLine/test-load-fail-stdout.txt b/Tests/RunCMake/CTestCommandLine/test-load-fail-stdout.txt deleted file mode 100644 index 153da09..0000000 --- a/Tests/RunCMake/CTestCommandLine/test-load-fail-stdout.txt +++ /dev/null @@ -1,2 +0,0 @@ -^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-pass-stderr.txt b/Tests/RunCMake/CTestCommandLine/test-load-pass-stderr.txt deleted file mode 100644 index 10f3293..0000000 --- a/Tests/RunCMake/CTestCommandLine/test-load-pass-stderr.txt +++ /dev/null @@ -1 +0,0 @@ -^$ diff --git a/Tests/RunCMake/CTestCommandLine/test-load-wait-stdout.txt b/Tests/RunCMake/CTestCommandLine/test-load-wait-stdout.txt new file mode 100644 index 0000000..11a768a --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/test-load-wait-stdout.txt @@ -0,0 +1,8 @@ +^Test project .*/Tests/RunCMake/CTestCommandLine/TestLoad +\*\*\*\*\* WAITING, System Load: 5, Max Allowed Load: 3, Smallest test TestLoad[1-2] requires 1\*\*\*\*\* + 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/ExternalProject/IncludeScope-Add-result.txt b/Tests/RunCMake/ExternalProject/IncludeScope-Add-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/ExternalProject/IncludeScope-Add-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/ExternalProject/IncludeScope-Add-stderr.txt b/Tests/RunCMake/ExternalProject/IncludeScope-Add-stderr.txt new file mode 100644 index 0000000..ff3e5c1 --- /dev/null +++ b/Tests/RunCMake/ExternalProject/IncludeScope-Add-stderr.txt @@ -0,0 +1,7 @@ +^CMake Error at .*/Modules/ExternalProject.cmake:[0-9]+ \(message\): + error: ExternalProject module must be explicitly included before using + ExternalProject_Add function +Call Stack \(most recent call first\): + .*/Modules/ExternalProject.cmake:[0-9]+ \(_ep_parse_arguments\) + IncludeScope-Add.cmake:[0-9]+ \(ExternalProject_Add\) + CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/ExternalProject/IncludeScope-Add.cmake b/Tests/RunCMake/ExternalProject/IncludeScope-Add.cmake new file mode 100644 index 0000000..1061ffd --- /dev/null +++ b/Tests/RunCMake/ExternalProject/IncludeScope-Add.cmake @@ -0,0 +1,12 @@ +function(IncludeScope_IncludeOnly) + include(ExternalProject) +endfunction() + +IncludeScope_IncludeOnly() + +ExternalProject_Add(MyProj + SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR} + CONFIGURE_COMMAND "" + BUILD_COMMAND "" + INSTALL_COMMAND "" +) diff --git a/Tests/RunCMake/ExternalProject/IncludeScope-Add_Step-result.txt b/Tests/RunCMake/ExternalProject/IncludeScope-Add_Step-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/ExternalProject/IncludeScope-Add_Step-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/ExternalProject/IncludeScope-Add_Step-stderr.txt b/Tests/RunCMake/ExternalProject/IncludeScope-Add_Step-stderr.txt new file mode 100644 index 0000000..cbad4be --- /dev/null +++ b/Tests/RunCMake/ExternalProject/IncludeScope-Add_Step-stderr.txt @@ -0,0 +1,7 @@ +^CMake Error at .*/Modules/ExternalProject.cmake:[0-9]+ \(message\): + error: ExternalProject module must be explicitly included before using + ExternalProject_Add_Step function +Call Stack \(most recent call first\): + .*/Modules/ExternalProject.cmake:[0-9]+ \(_ep_parse_arguments\) + IncludeScope-Add_Step.cmake:[0-9]+ \(ExternalProject_Add_Step\) + CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/ExternalProject/IncludeScope-Add_Step.cmake b/Tests/RunCMake/ExternalProject/IncludeScope-Add_Step.cmake new file mode 100644 index 0000000..2a820f8 --- /dev/null +++ b/Tests/RunCMake/ExternalProject/IncludeScope-Add_Step.cmake @@ -0,0 +1,13 @@ +function(IncludeScope_DefineProj) + include(ExternalProject) + ExternalProject_Add(MyProj + SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR} + CONFIGURE_COMMAND "" + BUILD_COMMAND "" + INSTALL_COMMAND "" + ) +endfunction() + +IncludeScope_DefineProj() + +ExternalProject_Add_Step(MyProj extraStep COMMENT "Foo") diff --git a/Tests/RunCMake/ExternalProject/RunCMakeTest.cmake b/Tests/RunCMake/ExternalProject/RunCMakeTest.cmake index 09607f6..bf11381 100644 --- a/Tests/RunCMake/ExternalProject/RunCMakeTest.cmake +++ b/Tests/RunCMake/ExternalProject/RunCMakeTest.cmake @@ -1,5 +1,7 @@ include(RunCMake) +run_cmake(IncludeScope-Add) +run_cmake(IncludeScope-Add_Step) run_cmake(NoOptions) run_cmake(SourceEmpty) run_cmake(SourceMissing) diff --git a/Tests/RunCMake/ctest_start/NoAppendDifferentTrack-stdout.txt b/Tests/RunCMake/ctest_start/NoAppendDifferentTrack-stdout.txt new file mode 100644 index 0000000..4a6f1e9 --- /dev/null +++ b/Tests/RunCMake/ctest_start/NoAppendDifferentTrack-stdout.txt @@ -0,0 +1,8 @@ +Run dashboard with model Experimental + Source directory: .*/Tests/RunCMake/ctest_start/NoAppendDifferentTrack + Build directory: .*/Tests/RunCMake/ctest_start/NoAppendDifferentTrack-build + Track: ExperimentalDifferent + Reading ctest configuration file: .*/Tests/RunCMake/ctest_start/NoAppendDifferentTrack/CTestConfig.cmake + Site: test-site + Build name: test-build-name + Use ExperimentalDifferent tag: [0-9-]+ diff --git a/Tests/RunCMake/ctest_start/RunCMakeTest.cmake b/Tests/RunCMake/ctest_start/RunCMakeTest.cmake index 2e8aa75..9b57b1b 100644 --- a/Tests/RunCMake/ctest_start/RunCMakeTest.cmake +++ b/Tests/RunCMake/ctest_start/RunCMakeTest.cmake @@ -30,6 +30,7 @@ run_ctest_start(AppendSameModel Continuous APPEND) run_ctest_start(AppendDifferentModel Experimental APPEND) run_ctest_start(AppendNoModel APPEND) run_ctest_start(AppendDifferentTrack TRACK ExperimentalDifferent APPEND) +run_ctest_start(NoAppendDifferentTrack Experimental TRACK ExperimentalDifferent) run_ctest_start(AppendNoMatchingTrack Continuous APPEND) run_ctest_start(AppendOldContinuous Continuous APPEND) run_ctest_start(AppendOldNoModel APPEND) diff --git a/Tests/RunCMake/ctest_start/test.cmake.in b/Tests/RunCMake/ctest_start/test.cmake.in index 172baf7..8cd3cff 100644 --- a/Tests/RunCMake/ctest_start/test.cmake.in +++ b/Tests/RunCMake/ctest_start/test.cmake.in @@ -14,7 +14,7 @@ function(setup_tests) ctest_start(${ctest_start_args}) endfunction() -if("@CASE_NAME@" MATCHES "^Append") +if("@CASE_NAME@" MATCHES "^(No)?Append") if("@CASE_NAME@" MATCHES "^AppendNoMatchingTrack$") file(WRITE "${CTEST_BINARY_DIRECTORY}/Testing/TAG" "19551112-2204\nSomeWeirdTrackName\n") else() diff --git a/Tests/RunCMake/ctest_test/CTestTestLoadFail-result.txt b/Tests/RunCMake/ctest_test/CTestTestLoadFail-result.txt deleted file mode 100644 index b57e2de..0000000 --- a/Tests/RunCMake/ctest_test/CTestTestLoadFail-result.txt +++ /dev/null @@ -1 +0,0 @@ -(-1|255) diff --git a/Tests/RunCMake/ctest_test/CTestTestLoadFail-stderr.txt b/Tests/RunCMake/ctest_test/CTestTestLoadFail-stderr.txt deleted file mode 100644 index eafba1c..0000000 --- a/Tests/RunCMake/ctest_test/CTestTestLoadFail-stderr.txt +++ /dev/null @@ -1 +0,0 @@ -No tests were found!!! diff --git a/Tests/RunCMake/ctest_test/CTestTestLoadFail-stdout.txt b/Tests/RunCMake/ctest_test/CTestTestLoadFail-stdout.txt deleted file mode 100644 index e203c10..0000000 --- a/Tests/RunCMake/ctest_test/CTestTestLoadFail-stdout.txt +++ /dev/null @@ -1,2 +0,0 @@ -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/CTestTestLoadWait-stdout.txt b/Tests/RunCMake/ctest_test/CTestTestLoadWait-stdout.txt new file mode 100644 index 0000000..2af3838 --- /dev/null +++ b/Tests/RunCMake/ctest_test/CTestTestLoadWait-stdout.txt @@ -0,0 +1,8 @@ +Test project .*/Tests/RunCMake/ctest_test/CTestTestLoadWait-build +\*\*\*\*\* WAITING, System Load: 5, Max Allowed Load: 4, Smallest test RunCMakeVersion requires 1\*\*\*\*\* + 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 1b31726..6877e6a 100644 --- a/Tests/RunCMake/ctest_test/RunCMakeTest.cmake +++ b/Tests/RunCMake/ctest_test/RunCMakeTest.cmake @@ -21,8 +21,8 @@ set(ENV{__CTEST_FAKE_LOAD_AVERAGE_FOR_TESTING} 5) 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) +# our threshold and that they then run once the load average drops. +run_ctest_test(TestLoadWait TEST_LOAD 2) # Verify that when an invalid "TEST_LOAD" value is given, a warning # message is displayed and the value is ignored. @@ -34,9 +34,9 @@ set(CASE_CTEST_TEST_LOAD 7) run_ctest_test(CTestTestLoadPass) # Verify that new tests are not started when the load average exceeds -# our threshold. +# our threshold and that they then run once the load average drops. set(CASE_CTEST_TEST_LOAD 4) -run_ctest_test(CTestTestLoadFail) +run_ctest_test(CTestTestLoadWait) # Verify that when an invalid "CTEST_TEST_LOAD" value is given, # a warning message is displayed and the value is ignored. diff --git a/Tests/RunCMake/ctest_test/TestLoadFail-result.txt b/Tests/RunCMake/ctest_test/TestLoadFail-result.txt deleted file mode 100644 index b57e2de..0000000 --- a/Tests/RunCMake/ctest_test/TestLoadFail-result.txt +++ /dev/null @@ -1 +0,0 @@ -(-1|255) diff --git a/Tests/RunCMake/ctest_test/TestLoadFail-stderr.txt b/Tests/RunCMake/ctest_test/TestLoadFail-stderr.txt deleted file mode 100644 index eafba1c..0000000 --- a/Tests/RunCMake/ctest_test/TestLoadFail-stderr.txt +++ /dev/null @@ -1 +0,0 @@ -No tests were found!!! diff --git a/Tests/RunCMake/ctest_test/TestLoadFail-stdout.txt b/Tests/RunCMake/ctest_test/TestLoadFail-stdout.txt deleted file mode 100644 index 4d7ce48..0000000 --- a/Tests/RunCMake/ctest_test/TestLoadFail-stdout.txt +++ /dev/null @@ -1,2 +0,0 @@ -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/TestLoadWait-stdout.txt b/Tests/RunCMake/ctest_test/TestLoadWait-stdout.txt new file mode 100644 index 0000000..07f4ed3 --- /dev/null +++ b/Tests/RunCMake/ctest_test/TestLoadWait-stdout.txt @@ -0,0 +1,8 @@ +Test project .*/Tests/RunCMake/ctest_test/TestLoadWait-build +\*\*\*\*\* WAITING, System Load: 5, Max Allowed Load: 2, Smallest test RunCMakeVersion requires 1\*\*\*\*\* + 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$ |