From 8372b4553bc58c00ad3ef923919ff5547746b95e Mon Sep 17 00:00:00 2001 From: "Daniele E. Domenichelli" Date: Mon, 3 Mar 2014 19:51:57 +0100 Subject: [PATCH] FeatureSummary: Add unit tests --- Tests/RunCMake/CMakeLists.txt | 1 + Tests/RunCMake/FeatureSummary/CMakeLists.txt | 3 +++ .../FeatureSummary/FeatureSummaryWhatAll-stdout.txt | 7 +++++++ .../RunCMake/FeatureSummary/FeatureSummaryWhatAll.cmake | 9 +++++++++ .../FeatureSummary/FeatureSummaryWhatList-stdout.txt | 7 +++++++ .../RunCMake/FeatureSummary/FeatureSummaryWhatList.cmake | 9 +++++++++ .../FeatureSummary/FeatureSummaryWhatListAll-result.txt | 1 + .../FeatureSummary/FeatureSummaryWhatListAll-stderr.txt | 6 ++++++ .../FeatureSummary/FeatureSummaryWhatListAll.cmake | 9 +++++++++ .../FeatureSummaryWhatListUnknown-result.txt | 1 + .../FeatureSummaryWhatListUnknown-stderr.txt | 6 ++++++ .../FeatureSummary/FeatureSummaryWhatListUnknown.cmake | 9 +++++++++ .../FeatureSummary/FeatureSummaryWhatSingle-stdout.txt | 1 + .../FeatureSummary/FeatureSummaryWhatSingle.cmake | 9 +++++++++ .../FeatureSummaryWhatSingleUnknown-result.txt | 1 + .../FeatureSummaryWhatSingleUnknown-stderr.txt | 6 ++++++ .../FeatureSummary/FeatureSummaryWhatSingleUnknown.cmake | 9 +++++++++ Tests/RunCMake/FeatureSummary/RunCMakeTest.cmake | 8 ++++++++ 18 files changed, 102 insertions(+) create mode 100644 Tests/RunCMake/FeatureSummary/CMakeLists.txt create mode 100644 Tests/RunCMake/FeatureSummary/FeatureSummaryWhatAll-stdout.txt create mode 100644 Tests/RunCMake/FeatureSummary/FeatureSummaryWhatAll.cmake create mode 100644 Tests/RunCMake/FeatureSummary/FeatureSummaryWhatList-stdout.txt create mode 100644 Tests/RunCMake/FeatureSummary/FeatureSummaryWhatList.cmake create mode 100644 Tests/RunCMake/FeatureSummary/FeatureSummaryWhatListAll-result.txt create mode 100644 Tests/RunCMake/FeatureSummary/FeatureSummaryWhatListAll-stderr.txt create mode 100644 Tests/RunCMake/FeatureSummary/FeatureSummaryWhatListAll.cmake create mode 100644 Tests/RunCMake/FeatureSummary/FeatureSummaryWhatListUnknown-result.txt create mode 100644 Tests/RunCMake/FeatureSummary/FeatureSummaryWhatListUnknown-stderr.txt create mode 100644 Tests/RunCMake/FeatureSummary/FeatureSummaryWhatListUnknown.cmake create mode 100644 Tests/RunCMake/FeatureSummary/FeatureSummaryWhatSingle-stdout.txt create mode 100644 Tests/RunCMake/FeatureSummary/FeatureSummaryWhatSingle.cmake create mode 100644 Tests/RunCMake/FeatureSummary/FeatureSummaryWhatSingleUnknown-result.txt create mode 100644 Tests/RunCMake/FeatureSummary/FeatureSummaryWhatSingleUnknown-stderr.txt create mode 100644 Tests/RunCMake/FeatureSummary/FeatureSummaryWhatSingleUnknown.cmake create mode 100644 Tests/RunCMake/FeatureSummary/RunCMakeTest.cmake diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index 9bb097b159..c043e57fc0 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -42,6 +42,7 @@ add_RunCMake_test(CompilerNotFound) add_RunCMake_test(Configure) add_RunCMake_test(DisallowedCommands) add_RunCMake_test(ExternalData) +add_RunCMake_test(FeatureSummary) add_RunCMake_test(FPHSA) add_RunCMake_test(GeneratorExpression) add_RunCMake_test(GeneratorToolset) diff --git a/Tests/RunCMake/FeatureSummary/CMakeLists.txt b/Tests/RunCMake/FeatureSummary/CMakeLists.txt new file mode 100644 index 0000000000..72abfc8099 --- /dev/null +++ b/Tests/RunCMake/FeatureSummary/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 2.8.11) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/FeatureSummary/FeatureSummaryWhatAll-stdout.txt b/Tests/RunCMake/FeatureSummary/FeatureSummaryWhatAll-stdout.txt new file mode 100644 index 0000000000..9a3f023872 --- /dev/null +++ b/Tests/RunCMake/FeatureSummary/FeatureSummaryWhatAll-stdout.txt @@ -0,0 +1,7 @@ +-- The following features have been enabled: + + \* Foo , Foo\. + +-- The following features have been disabled: + + \* Bar , Bar\. diff --git a/Tests/RunCMake/FeatureSummary/FeatureSummaryWhatAll.cmake b/Tests/RunCMake/FeatureSummary/FeatureSummaryWhatAll.cmake new file mode 100644 index 0000000000..ec5ebcb5fc --- /dev/null +++ b/Tests/RunCMake/FeatureSummary/FeatureSummaryWhatAll.cmake @@ -0,0 +1,9 @@ +include(FeatureSummary) + +set(WITH_FOO 1) +set(WITH_BAR 0) + +add_feature_info(Foo WITH_FOO "Foo.") +add_feature_info(Bar WITH_BAR "Bar.") + +feature_summary(WHAT ALL) diff --git a/Tests/RunCMake/FeatureSummary/FeatureSummaryWhatList-stdout.txt b/Tests/RunCMake/FeatureSummary/FeatureSummaryWhatList-stdout.txt new file mode 100644 index 0000000000..4d8f25f5e3 --- /dev/null +++ b/Tests/RunCMake/FeatureSummary/FeatureSummaryWhatList-stdout.txt @@ -0,0 +1,7 @@ +-- The following features have been disabled: + + \* Bar , Bar\. + +-- The following features have been enabled: + + \* Foo , Foo\. diff --git a/Tests/RunCMake/FeatureSummary/FeatureSummaryWhatList.cmake b/Tests/RunCMake/FeatureSummary/FeatureSummaryWhatList.cmake new file mode 100644 index 0000000000..d04ba885ab --- /dev/null +++ b/Tests/RunCMake/FeatureSummary/FeatureSummaryWhatList.cmake @@ -0,0 +1,9 @@ +include(FeatureSummary) + +set(WITH_FOO 1) +set(WITH_BAR 0) + +add_feature_info(Foo WITH_FOO "Foo.") +add_feature_info(Bar WITH_BAR "Bar.") + +feature_summary(WHAT DISABLED_FEATURES ENABLED_FEATURES) diff --git a/Tests/RunCMake/FeatureSummary/FeatureSummaryWhatListAll-result.txt b/Tests/RunCMake/FeatureSummary/FeatureSummaryWhatListAll-result.txt new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/Tests/RunCMake/FeatureSummary/FeatureSummaryWhatListAll-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/FeatureSummary/FeatureSummaryWhatListAll-stderr.txt b/Tests/RunCMake/FeatureSummary/FeatureSummaryWhatListAll-stderr.txt new file mode 100644 index 0000000000..18d9ebdee9 --- /dev/null +++ b/Tests/RunCMake/FeatureSummary/FeatureSummaryWhatListAll-stderr.txt @@ -0,0 +1,6 @@ +CMake Error at .*/Modules/FeatureSummary\.cmake:[0-9]+. \(message\): + The WHAT argument of FEATURE_SUMMARY\(\) contains ALL, which cannot be + combined with other values\. +Call Stack \(most recent call first\): + FeatureSummaryWhatListAll\.cmake:[0-9]+ \(feature_summary\) + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/FeatureSummary/FeatureSummaryWhatListAll.cmake b/Tests/RunCMake/FeatureSummary/FeatureSummaryWhatListAll.cmake new file mode 100644 index 0000000000..1877ea5a26 --- /dev/null +++ b/Tests/RunCMake/FeatureSummary/FeatureSummaryWhatListAll.cmake @@ -0,0 +1,9 @@ +include(FeatureSummary) + +set(WITH_FOO 1) +set(WITH_BAR 0) + +add_feature_info(Foo WITH_FOO "Foo.") +add_feature_info(Bar WITH_BAR "Bar.") + +feature_summary(WHAT ENABLED_FEATURES ALL) diff --git a/Tests/RunCMake/FeatureSummary/FeatureSummaryWhatListUnknown-result.txt b/Tests/RunCMake/FeatureSummary/FeatureSummaryWhatListUnknown-result.txt new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/Tests/RunCMake/FeatureSummary/FeatureSummaryWhatListUnknown-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/FeatureSummary/FeatureSummaryWhatListUnknown-stderr.txt b/Tests/RunCMake/FeatureSummary/FeatureSummaryWhatListUnknown-stderr.txt new file mode 100644 index 0000000000..3ad3750309 --- /dev/null +++ b/Tests/RunCMake/FeatureSummary/FeatureSummaryWhatListUnknown-stderr.txt @@ -0,0 +1,6 @@ +CMake Error at .*/Modules/FeatureSummary\.cmake:[0-9]+. \(message\): + The WHAT argument of FEATURE_SUMMARY\(\) contains FOO, which is not a valid + value\. +Call Stack \(most recent call first\): + FeatureSummaryWhatListUnknown\.cmake:[0-9]+ \(feature_summary\) + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/FeatureSummary/FeatureSummaryWhatListUnknown.cmake b/Tests/RunCMake/FeatureSummary/FeatureSummaryWhatListUnknown.cmake new file mode 100644 index 0000000000..46088d4179 --- /dev/null +++ b/Tests/RunCMake/FeatureSummary/FeatureSummaryWhatListUnknown.cmake @@ -0,0 +1,9 @@ +include(FeatureSummary) + +set(WITH_FOO 1) +set(WITH_BAR 0) + +add_feature_info(Foo WITH_FOO "Foo.") +add_feature_info(Bar WITH_BAR "Bar.") + +feature_summary(WHAT ENABLED_FEATURES FOO) diff --git a/Tests/RunCMake/FeatureSummary/FeatureSummaryWhatSingle-stdout.txt b/Tests/RunCMake/FeatureSummary/FeatureSummaryWhatSingle-stdout.txt new file mode 100644 index 0000000000..240632dda9 --- /dev/null +++ b/Tests/RunCMake/FeatureSummary/FeatureSummaryWhatSingle-stdout.txt @@ -0,0 +1 @@ + \* Foo , Foo\. diff --git a/Tests/RunCMake/FeatureSummary/FeatureSummaryWhatSingle.cmake b/Tests/RunCMake/FeatureSummary/FeatureSummaryWhatSingle.cmake new file mode 100644 index 0000000000..593dfb6a1c --- /dev/null +++ b/Tests/RunCMake/FeatureSummary/FeatureSummaryWhatSingle.cmake @@ -0,0 +1,9 @@ +include(FeatureSummary) + +set(WITH_FOO 1) +set(WITH_BAR 0) + +add_feature_info(Foo WITH_FOO "Foo.") +add_feature_info(Bar WITH_BAR "Bar.") + +feature_summary(WHAT ENABLED_FEATURES) diff --git a/Tests/RunCMake/FeatureSummary/FeatureSummaryWhatSingleUnknown-result.txt b/Tests/RunCMake/FeatureSummary/FeatureSummaryWhatSingleUnknown-result.txt new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/Tests/RunCMake/FeatureSummary/FeatureSummaryWhatSingleUnknown-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/FeatureSummary/FeatureSummaryWhatSingleUnknown-stderr.txt b/Tests/RunCMake/FeatureSummary/FeatureSummaryWhatSingleUnknown-stderr.txt new file mode 100644 index 0000000000..c78853c751 --- /dev/null +++ b/Tests/RunCMake/FeatureSummary/FeatureSummaryWhatSingleUnknown-stderr.txt @@ -0,0 +1,6 @@ +CMake Error at .*/Modules/FeatureSummary\.cmake:[0-9]+. \(message\): + The WHAT argument of FEATURE_SUMMARY\(\) contains FOO, which is not a valid + value\. +Call Stack \(most recent call first\): + FeatureSummaryWhatSingleUnknown\.cmake:[0-9]+ \(feature_summary\) + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/FeatureSummary/FeatureSummaryWhatSingleUnknown.cmake b/Tests/RunCMake/FeatureSummary/FeatureSummaryWhatSingleUnknown.cmake new file mode 100644 index 0000000000..c2d6d2ee43 --- /dev/null +++ b/Tests/RunCMake/FeatureSummary/FeatureSummaryWhatSingleUnknown.cmake @@ -0,0 +1,9 @@ +include(FeatureSummary) + +set(WITH_FOO 1) +set(WITH_BAR 0) + +add_feature_info(Foo WITH_FOO "Foo.") +add_feature_info(Bar WITH_BAR "Bar.") + +feature_summary(WHAT FOO) diff --git a/Tests/RunCMake/FeatureSummary/RunCMakeTest.cmake b/Tests/RunCMake/FeatureSummary/RunCMakeTest.cmake new file mode 100644 index 0000000000..1417338ed1 --- /dev/null +++ b/Tests/RunCMake/FeatureSummary/RunCMakeTest.cmake @@ -0,0 +1,8 @@ +include(RunCMake) + +run_cmake(FeatureSummaryWhatAll) +run_cmake(FeatureSummaryWhatSingle) +run_cmake(FeatureSummaryWhatSingleUnknown) +run_cmake(FeatureSummaryWhatList) +run_cmake(FeatureSummaryWhatListUnknown) +run_cmake(FeatureSummaryWhatListAll)