summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
authorMichael Scott <michael.scott250@gmail.com>2015-12-21 21:39:27 (GMT)
committerBrad King <brad.king@kitware.com>2016-01-12 19:02:51 (GMT)
commit28f2d750edaf6ee1af660d3a0ae6792c65c47997 (patch)
tree3e22c760e48a58d34c9e337c9ffef0f6295f0ebe /Tests
parentb5009720d3020021f189570d72c099963795a5c5 (diff)
downloadCMake-28f2d750edaf6ee1af660d3a0ae6792c65c47997.zip
CMake-28f2d750edaf6ee1af660d3a0ae6792c65c47997.tar.gz
CMake-28f2d750edaf6ee1af660d3a0ae6792c65c47997.tar.bz2
Add -Werror and -Wno-error command-line options
Expand the -W set of cmake options to include support for the -Werror and -Wno-error format, which is used to control upgrading and downgrading warning and error messages. Implement support for these new formats for the dev and deprecated message types. Add tests and updated documentation for new options.
Diffstat (limited to 'Tests')
-rw-r--r--Tests/RunCMake/CommandLine/RunCMakeTest.cmake22
-rw-r--r--Tests/RunCMake/CommandLine/W_bad-arg3-result.txt (renamed from Tests/RunCMake/message/errormessage-result.txt)0
-rw-r--r--Tests/RunCMake/CommandLine/W_bad-arg3-stderr.txt2
-rw-r--r--Tests/RunCMake/CommandLine/Werror_deprecated-result.txt1
-rw-r--r--Tests/RunCMake/CommandLine/Werror_deprecated-stderr.txt4
-rw-r--r--Tests/RunCMake/CommandLine/Werror_deprecated.cmake1
-rw-r--r--Tests/RunCMake/CommandLine/Werror_dev-result.txt1
-rw-r--r--Tests/RunCMake/CommandLine/Werror_dev-stderr.txt11
-rw-r--r--Tests/RunCMake/CommandLine/Werror_dev.cmake7
-rw-r--r--Tests/RunCMake/CommandLine/Wno-error_deprecated-stderr.txt4
-rw-r--r--Tests/RunCMake/CommandLine/Wno-error_deprecated.cmake2
-rw-r--r--Tests/RunCMake/CommandLine/Wno-error_dev-stderr.txt11
-rw-r--r--Tests/RunCMake/CommandLine/Wno-error_dev.cmake7
-rw-r--r--Tests/RunCMake/message/RunCMakeTest.cmake6
-rw-r--r--Tests/RunCMake/message/errormessage-stderr.txt4
-rw-r--r--Tests/RunCMake/message/errormessage.cmake4
-rw-r--r--Tests/RunCMake/message/errormessage_deprecated-result.txt1
-rw-r--r--Tests/RunCMake/message/errormessage_deprecated-stderr.txt4
-rw-r--r--Tests/RunCMake/message/errormessage_deprecated.cmake3
-rw-r--r--Tests/RunCMake/message/errormessage_dev-result.txt1
-rw-r--r--Tests/RunCMake/message/errormessage_dev-stderr.txt5
-rw-r--r--Tests/RunCMake/message/errormessage_dev.cmake3
22 files changed, 95 insertions, 9 deletions
diff --git a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake
index 5e2200f..e77ba1f 100644
--- a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake
@@ -187,6 +187,14 @@ set(RunCMake_TEST_OPTIONS -Wdev)
run_cmake(Wdev)
unset(RunCMake_TEST_OPTIONS)
+set(RunCMake_TEST_OPTIONS -Werror=dev)
+run_cmake(Werror_dev)
+unset(RunCMake_TEST_OPTIONS)
+
+set(RunCMake_TEST_OPTIONS -Wno-error=dev)
+run_cmake(Wno-error_deprecated)
+unset(RunCMake_TEST_OPTIONS)
+
# -Wdev should not override deprecated options if specified
set(RunCMake_TEST_OPTIONS -Wdev -Wno-deprecated)
run_cmake(Wno-deprecated)
@@ -200,6 +208,11 @@ set(RunCMake_TEST_OPTIONS -Wdev)
run_cmake(Wdeprecated)
unset(RunCMake_TEST_OPTIONS)
+# -Werror=dev should enable deprecated errors as well
+set(RunCMake_TEST_OPTIONS -Werror=dev)
+run_cmake(Werror_deprecated)
+unset(RunCMake_TEST_OPTIONS)
+
set(RunCMake_TEST_OPTIONS -Wdeprecated)
run_cmake(Wdeprecated)
unset(RunCMake_TEST_OPTIONS)
@@ -208,6 +221,14 @@ set(RunCMake_TEST_OPTIONS -Wno-deprecated)
run_cmake(Wno-deprecated)
unset(RunCMake_TEST_OPTIONS)
+set(RunCMake_TEST_OPTIONS -Werror=deprecated)
+run_cmake(Werror_deprecated)
+unset(RunCMake_TEST_OPTIONS)
+
+set(RunCMake_TEST_OPTIONS -Wno-error=deprecated)
+run_cmake(Wno-error_deprecated)
+unset(RunCMake_TEST_OPTIONS)
+
# Dev warnings should be on by default
run_cmake(Wdev)
@@ -224,6 +245,7 @@ unset(RunCMake_TEST_OPTIONS)
run_cmake_command(W_bad-arg1 ${CMAKE_COMMAND} -W)
run_cmake_command(W_bad-arg2 ${CMAKE_COMMAND} -Wno-)
+run_cmake_command(W_bad-arg3 ${CMAKE_COMMAND} -Werror=)
set(RunCMake_TEST_OPTIONS --debug-output)
run_cmake(debug-output)
diff --git a/Tests/RunCMake/message/errormessage-result.txt b/Tests/RunCMake/CommandLine/W_bad-arg3-result.txt
index d00491f..d00491f 100644
--- a/Tests/RunCMake/message/errormessage-result.txt
+++ b/Tests/RunCMake/CommandLine/W_bad-arg3-result.txt
diff --git a/Tests/RunCMake/CommandLine/W_bad-arg3-stderr.txt b/Tests/RunCMake/CommandLine/W_bad-arg3-stderr.txt
new file mode 100644
index 0000000..cc643df
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/W_bad-arg3-stderr.txt
@@ -0,0 +1,2 @@
+CMake Error: No warning name provided.
+CMake Error: Problem processing arguments. Aborting.
diff --git a/Tests/RunCMake/CommandLine/Werror_deprecated-result.txt b/Tests/RunCMake/CommandLine/Werror_deprecated-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/Werror_deprecated-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CommandLine/Werror_deprecated-stderr.txt b/Tests/RunCMake/CommandLine/Werror_deprecated-stderr.txt
new file mode 100644
index 0000000..6acdc73
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/Werror_deprecated-stderr.txt
@@ -0,0 +1,4 @@
+^CMake Deprecation Error at Werror_deprecated.cmake:1 \(message\):
+ Some deprecated warning
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/CommandLine/Werror_deprecated.cmake b/Tests/RunCMake/CommandLine/Werror_deprecated.cmake
new file mode 100644
index 0000000..3142b42
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/Werror_deprecated.cmake
@@ -0,0 +1 @@
+message(DEPRECATION "Some deprecated warning")
diff --git a/Tests/RunCMake/CommandLine/Werror_dev-result.txt b/Tests/RunCMake/CommandLine/Werror_dev-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/Werror_dev-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CommandLine/Werror_dev-stderr.txt b/Tests/RunCMake/CommandLine/Werror_dev-stderr.txt
new file mode 100644
index 0000000..590ec96
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/Werror_dev-stderr.txt
@@ -0,0 +1,11 @@
+^CMake Error \(dev\) at Werror_dev.cmake:4 \(include\):
+ include\(\) given empty file name \(ignored\).
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
+This error is for project developers. Use -Wno-error=dev to suppress it.
+
+CMake Error \(dev\) at Werror_dev.cmake:7 \(message\):
+ Some author warning
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
+This error is for project developers. Use -Wno-error=dev to suppress it.$
diff --git a/Tests/RunCMake/CommandLine/Werror_dev.cmake b/Tests/RunCMake/CommandLine/Werror_dev.cmake
new file mode 100644
index 0000000..05f333a
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/Werror_dev.cmake
@@ -0,0 +1,7 @@
+# with -Werror=dev this will also cause an (upgraded) AUTHOR_ERROR message,
+# checks that messages issued outside of the message command, by other CMake
+# commands, also are affected by -Werror=dev
+include("")
+
+# message command sets fatal occurred flag, so run it last
+message(AUTHOR_WARNING "Some author warning")
diff --git a/Tests/RunCMake/CommandLine/Wno-error_deprecated-stderr.txt b/Tests/RunCMake/CommandLine/Wno-error_deprecated-stderr.txt
new file mode 100644
index 0000000..0ed1698
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/Wno-error_deprecated-stderr.txt
@@ -0,0 +1,4 @@
+^CMake Deprecation Warning at Wno-error_deprecated.cmake:2 \(message\):
+ Some deprecated warning
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/CommandLine/Wno-error_deprecated.cmake b/Tests/RunCMake/CommandLine/Wno-error_deprecated.cmake
new file mode 100644
index 0000000..676792a
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/Wno-error_deprecated.cmake
@@ -0,0 +1,2 @@
+# This should still produce a warning when -Wno-error=deprecated is specified
+message(DEPRECATION "Some deprecated warning")
diff --git a/Tests/RunCMake/CommandLine/Wno-error_dev-stderr.txt b/Tests/RunCMake/CommandLine/Wno-error_dev-stderr.txt
new file mode 100644
index 0000000..dd22d55
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/Wno-error_dev-stderr.txt
@@ -0,0 +1,11 @@
+^CMake Warning \(dev\) at Wno-error_dev.cmake:2 \(message\):
+ Some author warning
+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 Wno-error_dev.cmake:6 \(include\):
+ include\(\) given empty file name \(ignored\).
+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/CommandLine/Wno-error_dev.cmake b/Tests/RunCMake/CommandLine/Wno-error_dev.cmake
new file mode 100644
index 0000000..b700c19
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/Wno-error_dev.cmake
@@ -0,0 +1,7 @@
+# This should still produce a warning when -Wno-error=dev is specified
+message(AUTHOR_WARNING "Some author warning")
+
+# with -Wno-error=dev this will also cause an AUTHOR_WARNING message, checks
+# that messages issued outside of the message command, by other CMake commands,
+# also are affected by -Wno-error=dev
+include("")
diff --git a/Tests/RunCMake/message/RunCMakeTest.cmake b/Tests/RunCMake/message/RunCMakeTest.cmake
index 294dfbb..9489693 100644
--- a/Tests/RunCMake/message/RunCMakeTest.cmake
+++ b/Tests/RunCMake/message/RunCMakeTest.cmake
@@ -3,4 +3,8 @@ include(RunCMake)
run_cmake(defaultmessage)
run_cmake(nomessage)
run_cmake(warnmessage)
-run_cmake(errormessage)
+# message command sets fatal occurred flag, so check each type of error
+
+# seperately
+run_cmake(errormessage_deprecated)
+run_cmake(errormessage_dev)
diff --git a/Tests/RunCMake/message/errormessage-stderr.txt b/Tests/RunCMake/message/errormessage-stderr.txt
deleted file mode 100644
index 49e7ca9..0000000
--- a/Tests/RunCMake/message/errormessage-stderr.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-CMake Deprecation Error at errormessage.cmake:4 \(message\):
- This is an error
-Call Stack \(most recent call first\):
- CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/message/errormessage.cmake b/Tests/RunCMake/message/errormessage.cmake
deleted file mode 100644
index 7d3b779..0000000
--- a/Tests/RunCMake/message/errormessage.cmake
+++ /dev/null
@@ -1,4 +0,0 @@
-
-set(CMAKE_ERROR_DEPRECATED ON)
-
-message(DEPRECATION "This is an error")
diff --git a/Tests/RunCMake/message/errormessage_deprecated-result.txt b/Tests/RunCMake/message/errormessage_deprecated-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/message/errormessage_deprecated-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/message/errormessage_deprecated-stderr.txt b/Tests/RunCMake/message/errormessage_deprecated-stderr.txt
new file mode 100644
index 0000000..dd21c3b
--- /dev/null
+++ b/Tests/RunCMake/message/errormessage_deprecated-stderr.txt
@@ -0,0 +1,4 @@
+^CMake Deprecation Error at errormessage_deprecated.cmake:3 \(message\):
+ This is a deprecation error
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)$
diff --git a/Tests/RunCMake/message/errormessage_deprecated.cmake b/Tests/RunCMake/message/errormessage_deprecated.cmake
new file mode 100644
index 0000000..579275e
--- /dev/null
+++ b/Tests/RunCMake/message/errormessage_deprecated.cmake
@@ -0,0 +1,3 @@
+set(CMAKE_ERROR_DEPRECATED ON)
+
+message(DEPRECATION "This is a deprecation error")
diff --git a/Tests/RunCMake/message/errormessage_dev-result.txt b/Tests/RunCMake/message/errormessage_dev-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/message/errormessage_dev-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/message/errormessage_dev-stderr.txt b/Tests/RunCMake/message/errormessage_dev-stderr.txt
new file mode 100644
index 0000000..086b55c
--- /dev/null
+++ b/Tests/RunCMake/message/errormessage_dev-stderr.txt
@@ -0,0 +1,5 @@
+^CMake Error \(dev\) at errormessage_dev.cmake:3 \(message\):
+ This is a author error
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
+This error is for project developers. Use -Wno-error=dev to suppress it.$
diff --git a/Tests/RunCMake/message/errormessage_dev.cmake b/Tests/RunCMake/message/errormessage_dev.cmake
new file mode 100644
index 0000000..6ba1165
--- /dev/null
+++ b/Tests/RunCMake/message/errormessage_dev.cmake
@@ -0,0 +1,3 @@
+set(CMAKE_SUPPRESS_DEVELOPER_ERRORS OFF)
+
+message(AUTHOR_WARNING "This is a author error")