diff options
author | Daniele E. Domenichelli <ddomenichelli@drdanz.it> | 2017-01-26 09:48:13 (GMT) |
---|---|---|
committer | Daniele E. Domenichelli <ddomenichelli@drdanz.it> | 2017-01-26 09:52:09 (GMT) |
commit | 4cf4acebe347bfd55e051354b9748a5b0c25b58a (patch) | |
tree | c3796b7a55aea283be2e0a033facfbfe16cd4abf | |
parent | 614a97a57b65454a14231ed60346884bab2399be (diff) | |
download | CMake-4cf4acebe347bfd55e051354b9748a5b0c25b58a.zip CMake-4cf4acebe347bfd55e051354b9748a5b0c25b58a.tar.gz CMake-4cf4acebe347bfd55e051354b9748a5b0c25b58a.tar.bz2 |
FeatureSummary: Add unit tests
16 files changed, 259 insertions, 0 deletions
diff --git a/Tests/RunCMake/FeatureSummary/FeatureSummaryFatalOnMissingRequiredPackages-result.txt b/Tests/RunCMake/FeatureSummary/FeatureSummaryFatalOnMissingRequiredPackages-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/FeatureSummary/FeatureSummaryFatalOnMissingRequiredPackages-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/FeatureSummary/FeatureSummaryFatalOnMissingRequiredPackages-stderr.txt b/Tests/RunCMake/FeatureSummary/FeatureSummaryFatalOnMissingRequiredPackages-stderr.txt new file mode 100644 index 0000000..214d74a --- /dev/null +++ b/Tests/RunCMake/FeatureSummary/FeatureSummaryFatalOnMissingRequiredPackages-stderr.txt @@ -0,0 +1,6 @@ +CMake Error at .*/Modules/FeatureSummary\.cmake:[0-9]+. \(message\): + feature_summary\(\) Error: REQUIRED package\(s\) are missing, aborting CMake + run. +Call Stack \(most recent call first\): + FeatureSummaryFatalOnMissingRequiredPackages.cmake:[0-9]+ \(feature_summary\) + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/FeatureSummary/FeatureSummaryFatalOnMissingRequiredPackages-stdout.txt b/Tests/RunCMake/FeatureSummary/FeatureSummaryFatalOnMissingRequiredPackages-stdout.txt new file mode 100644 index 0000000..6bd6427 --- /dev/null +++ b/Tests/RunCMake/FeatureSummary/FeatureSummaryFatalOnMissingRequiredPackages-stdout.txt @@ -0,0 +1,17 @@ +-- The following REQUIRED packages have been found: + + \* Foo, The Foo package, <https://foo.example/> + +-- The following OPTIONAL packages have not been found: + + \* Bar + +-- The following REQUIRED packages have been found: + + \* Foo, The Foo package, <https://foo.example/> + +-- The following REQUIRED packages have not been found: + + \* Bar + +-- Configuring incomplete, errors occurred! diff --git a/Tests/RunCMake/FeatureSummary/FeatureSummaryFatalOnMissingRequiredPackages.cmake b/Tests/RunCMake/FeatureSummary/FeatureSummaryFatalOnMissingRequiredPackages.cmake new file mode 100644 index 0000000..9563186 --- /dev/null +++ b/Tests/RunCMake/FeatureSummary/FeatureSummaryFatalOnMissingRequiredPackages.cmake @@ -0,0 +1,12 @@ +include(FeatureSummary) + +list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}) + +find_package(Foo) +find_package(Bar) + +set_package_properties(Foo PROPERTIES TYPE REQUIRED) +feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES) + +set_package_properties(Bar PROPERTIES TYPE REQUIRED) +feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES) diff --git a/Tests/RunCMake/FeatureSummary/FeatureSummaryIncludeQuietPackages-stdout.txt b/Tests/RunCMake/FeatureSummary/FeatureSummaryIncludeQuietPackages-stdout.txt new file mode 100644 index 0000000..58599e0 --- /dev/null +++ b/Tests/RunCMake/FeatureSummary/FeatureSummaryIncludeQuietPackages-stdout.txt @@ -0,0 +1,14 @@ +-- The following OPTIONAL packages have not been found: + + \* Baz + +-- The following OPTIONAL packages have been found: + + \* Foo, The Foo package, <https://foo.example/> + +-- The following OPTIONAL packages have not been found: + + \* Bar + \* Baz + +-- Configuring done diff --git a/Tests/RunCMake/FeatureSummary/FeatureSummaryIncludeQuietPackages.cmake b/Tests/RunCMake/FeatureSummary/FeatureSummaryIncludeQuietPackages.cmake new file mode 100644 index 0000000..5cdb443 --- /dev/null +++ b/Tests/RunCMake/FeatureSummary/FeatureSummaryIncludeQuietPackages.cmake @@ -0,0 +1,11 @@ +include(FeatureSummary) + +list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}) + +find_package(Foo QUIET) +find_package(Bar QUIET) +find_package(Baz) + +feature_summary(WHAT ALL) + +feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES) diff --git a/Tests/RunCMake/FeatureSummary/FeatureSummaryPurpose-stdout.txt b/Tests/RunCMake/FeatureSummary/FeatureSummaryPurpose-stdout.txt new file mode 100644 index 0000000..78e4fe1 --- /dev/null +++ b/Tests/RunCMake/FeatureSummary/FeatureSummaryPurpose-stdout.txt @@ -0,0 +1,16 @@ +The following OPTIONAL packages have been found: + + \* Foo, The Foo package, <https://foo.example/> + +-- The following OPTIONAL packages have been found: + + \* Foo, The Foo package, <https://foo.example/> + Because everyone needs some Foo. + +-- The following OPTIONAL packages have been found: + + \* Foo, The Foo package, <https://foo.example/> + Because everyone needs some Foo. + Because Foo is better than Bar. + +-- Configuring done diff --git a/Tests/RunCMake/FeatureSummary/FeatureSummaryPurpose.cmake b/Tests/RunCMake/FeatureSummary/FeatureSummaryPurpose.cmake new file mode 100644 index 0000000..64735b6 --- /dev/null +++ b/Tests/RunCMake/FeatureSummary/FeatureSummaryPurpose.cmake @@ -0,0 +1,16 @@ +include(FeatureSummary) + +list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}) + +find_package(Foo) + +# Purpose not set +feature_summary(WHAT ALL) + +# Purpose set once +set_package_properties(Foo PROPERTIES PURPOSE "Because everyone needs some Foo.") +feature_summary(WHAT ALL) + +# Purpose set twice +set_package_properties(Foo PROPERTIES PURPOSE "Because Foo is better than Bar.") +feature_summary(WHAT ALL) diff --git a/Tests/RunCMake/FeatureSummary/FeatureSummaryTypes-stdout.txt b/Tests/RunCMake/FeatureSummary/FeatureSummaryTypes-stdout.txt new file mode 100644 index 0000000..79bb1e3 --- /dev/null +++ b/Tests/RunCMake/FeatureSummary/FeatureSummaryTypes-stdout.txt @@ -0,0 +1,45 @@ +-- The following OPTIONAL packages have been found: + + \* Foo, The Foo package, <https://foo.example/> + +-- The following RUNTIME packages have been found: + + \* Foo, The Foo package, <https://foo.example/> + +-- The following OPTIONAL packages have been found: + + \* Foo, The Foo package, <https://foo.example/> + +-- The following OPTIONAL packages have been found: + + \* Foo, The Foo package, <https://foo.example/> + +-- The following RECOMMENDED packages have been found: + + \* Foo, The Foo package, <https://foo.example/> + +-- The following RECOMMENDED packages have been found: + + \* Foo, The Foo package, <https://foo.example/> + +-- The following RECOMMENDED packages have been found: + + \* Foo, The Foo package, <https://foo.example/> + +-- The following REQUIRED packages have been found: + + \* Foo, The Foo package, <https://foo.example/> + +-- The following REQUIRED packages have been found: + + \* Foo, The Foo package, <https://foo.example/> + +-- The following REQUIRED packages have been found: + + \* Foo, The Foo package, <https://foo.example/> + +-- The following REQUIRED packages have been found: + + \* Foo, The Foo package, <https://foo.example/> + +-- Configuring done diff --git a/Tests/RunCMake/FeatureSummary/FeatureSummaryTypes.cmake b/Tests/RunCMake/FeatureSummary/FeatureSummaryTypes.cmake new file mode 100644 index 0000000..09d1e7a --- /dev/null +++ b/Tests/RunCMake/FeatureSummary/FeatureSummaryTypes.cmake @@ -0,0 +1,48 @@ +include(FeatureSummary) + +list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}) + +find_package(Foo) + +# Type not set => OPTIONAL +feature_summary(WHAT ALL) + +# RUNTIME > not set => RUNTIME +set_package_properties(Foo PROPERTIES TYPE RUNTIME) +feature_summary(WHAT ALL) + +# OPTIONAL > RUNTIME => OPTIONAL +set_package_properties(Foo PROPERTIES TYPE OPTIONAL) +feature_summary(WHAT ALL) + +# RUNTIME < OPTIONAL => OPTIONAL +set_package_properties(Foo PROPERTIES TYPE OPTIONAL) +feature_summary(WHAT ALL) + +# RECOMMENDED > OPTIONAL => RECOMMENDED +set_package_properties(Foo PROPERTIES TYPE RECOMMENDED) +feature_summary(WHAT ALL) + +# OPTIONAL < RECOMMENDED => RECOMMENDED +set_package_properties(Foo PROPERTIES TYPE OPTIONAL) +feature_summary(WHAT ALL) + +# RUNTIME < RECOMMENDED => RECOMMENDED +set_package_properties(Foo PROPERTIES TYPE RUNTIME) +feature_summary(WHAT ALL) + +# REQUIRED > RECOMMENDED => REQUIRED +set_package_properties(Foo PROPERTIES TYPE REQUIRED) +feature_summary(WHAT ALL) + +# RECOMMENDED < REQUIRED => REQUIRED +set_package_properties(Foo PROPERTIES TYPE RECOMMENDED) +feature_summary(WHAT ALL) + +# OPTIONAL < REQUIRED => REQUIRED +set_package_properties(Foo PROPERTIES TYPE OPTIONAL) +feature_summary(WHAT ALL) + +# RUNTIME < REQUIRED => REQUIRED +set_package_properties(Foo PROPERTIES TYPE RUNTIME) +feature_summary(WHAT ALL) diff --git a/Tests/RunCMake/FeatureSummary/FeatureSummaryURLDescription-stdout.txt b/Tests/RunCMake/FeatureSummary/FeatureSummaryURLDescription-stdout.txt new file mode 100644 index 0000000..6a55bdf --- /dev/null +++ b/Tests/RunCMake/FeatureSummary/FeatureSummaryURLDescription-stdout.txt @@ -0,0 +1,32 @@ +-- The following OPTIONAL packages have been found: + + \* Foo, The Foo package, <https://foo.example/> + +-- The following OPTIONAL packages have not been found: + + \* Bar + \* Baz + +-- The following OPTIONAL packages have been found: + + \* Foo, The Foo package, <https://foo.example/> + +-- The following OPTIONAL packages have not been found: + + \* Bar, <https://bar.net/> + \* Baz, A Baz package + +-- Warning: Property DESCRIPTION for package Foo already set to "The Foo package", overriding it with "A Foo package" +-- Warning: Property URL already set to "https://foo.example/", overriding it with "https://foo.net/" +-- Warning: Property URL already set to "https://bar.net/", overriding it with "https://bar.example/" +-- Warning: Property DESCRIPTION for package Baz already set to "A Baz package", overriding it with "The Baz package" +-- The following OPTIONAL packages have been found: + + \* Foo, A Foo package, <https://foo.net/> + +-- The following OPTIONAL packages have not been found: + + \* Bar, The Bar package, <https://bar.example/> + \* Baz, The Baz package, <https://baz.example/> + +-- Configuring done diff --git a/Tests/RunCMake/FeatureSummary/FeatureSummaryURLDescription.cmake b/Tests/RunCMake/FeatureSummary/FeatureSummaryURLDescription.cmake new file mode 100644 index 0000000..77fcf28 --- /dev/null +++ b/Tests/RunCMake/FeatureSummary/FeatureSummaryURLDescription.cmake @@ -0,0 +1,28 @@ +include(FeatureSummary) + +list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}) + +find_package(Foo) # URL and DESCRIPTION are set in the FindFoo.cmake file +find_package(Bar) # URL and DESCRIPTION are not set +find_package(Baz) # URL and DESCRIPTION are not set + +feature_summary(WHAT ALL) + +set_package_properties(Bar PROPERTIES URL "https://bar.net/") # URL and no DESCRIPTION +set_package_properties(Baz PROPERTIES DESCRIPTION "A Baz package") # DESCRIPTION and no URL +feature_summary(WHAT ALL) + +# Overwrite with the same value (no warning) +set_package_properties(Foo PROPERTIES URL "https://foo.example/" + DESCRIPTION "The Foo package") +set_package_properties(Bar PROPERTIES URL "https://bar.net/") +set_package_properties(Baz PROPERTIES DESCRIPTION "A Baz package") + +# Overwrite with different values (warnings) +set_package_properties(Foo PROPERTIES URL "https://foo.net/" + DESCRIPTION "A Foo package") # Overwrite URL and DESCRIPTION +set_package_properties(Bar PROPERTIES URL "https://bar.example/" + DESCRIPTION "The Bar package") # Overwrite URL and add DESCRIPTION +set_package_properties(Baz PROPERTIES URL "https://baz.example/" + DESCRIPTION "The Baz package") # Overwrite URL and add DESCRIPTION +feature_summary(WHAT ALL) diff --git a/Tests/RunCMake/FeatureSummary/FindBar.cmake b/Tests/RunCMake/FeatureSummary/FindBar.cmake new file mode 100644 index 0000000..45f4d54 --- /dev/null +++ b/Tests/RunCMake/FeatureSummary/FindBar.cmake @@ -0,0 +1,2 @@ +include(FeatureSummary) +set(Bar_FOUND 0) diff --git a/Tests/RunCMake/FeatureSummary/FindBaz.cmake b/Tests/RunCMake/FeatureSummary/FindBaz.cmake new file mode 100644 index 0000000..73aafcd --- /dev/null +++ b/Tests/RunCMake/FeatureSummary/FindBaz.cmake @@ -0,0 +1,2 @@ +include(FeatureSummary) +set(Baz_FOUND 0) diff --git a/Tests/RunCMake/FeatureSummary/FindFoo.cmake b/Tests/RunCMake/FeatureSummary/FindFoo.cmake new file mode 100644 index 0000000..baec987 --- /dev/null +++ b/Tests/RunCMake/FeatureSummary/FindFoo.cmake @@ -0,0 +1,4 @@ +include(FeatureSummary) +set_package_properties(Foo PROPERTIES URL "https://foo.example/" + DESCRIPTION "The Foo package") +set(Foo_FOUND 1) diff --git a/Tests/RunCMake/FeatureSummary/RunCMakeTest.cmake b/Tests/RunCMake/FeatureSummary/RunCMakeTest.cmake index 6a5fc28..2edd8a5 100644 --- a/Tests/RunCMake/FeatureSummary/RunCMakeTest.cmake +++ b/Tests/RunCMake/FeatureSummary/RunCMakeTest.cmake @@ -7,3 +7,8 @@ run_cmake(FeatureSummaryWhatList) run_cmake(FeatureSummaryWhatListUnknown) run_cmake(FeatureSummaryWhatListAll) run_cmake(FeatureSummaryWhatOnce) +run_cmake(FeatureSummaryPurpose) +run_cmake(FeatureSummaryURLDescription) +run_cmake(FeatureSummaryTypes) +run_cmake(FeatureSummaryFatalOnMissingRequiredPackages) +run_cmake(FeatureSummaryIncludeQuietPackages) |