summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2022-03-04 18:20:50 (GMT)
committerBrad King <brad.king@kitware.com>2022-03-04 18:55:12 (GMT)
commit30313aa72166ef06cde8c64ab1e582f8a242502e (patch)
treedce3c7dbe42dc55cd68912e8efe338f498dacb2e /Tests/RunCMake
parent8895284e115648ecfed020af2e55403341f3dd76 (diff)
downloadCMake-30313aa72166ef06cde8c64ab1e582f8a242502e.zip
CMake-30313aa72166ef06cde8c64ab1e582f8a242502e.tar.gz
CMake-30313aa72166ef06cde8c64ab1e582f8a242502e.tar.bz2
while: diagnose errors during condition evaluation
Add a policy to diagnose condition errors in a compatible way. Fixes: #23296
Diffstat (limited to 'Tests/RunCMake')
-rw-r--r--Tests/RunCMake/while/CMP0130-NEW-result.txt1
-rw-r--r--Tests/RunCMake/while/CMP0130-NEW-stderr.txt9
-rw-r--r--Tests/RunCMake/while/CMP0130-NEW.cmake2
-rw-r--r--Tests/RunCMake/while/CMP0130-OLD-stdout.txt (renamed from Tests/RunCMake/while/unbalanced-parenthesis-stdout.txt)0
-rw-r--r--Tests/RunCMake/while/CMP0130-OLD.cmake2
-rw-r--r--Tests/RunCMake/while/CMP0130-WARN-stderr.txt14
-rw-r--r--Tests/RunCMake/while/CMP0130-WARN-stdout.txt1
-rw-r--r--Tests/RunCMake/while/CMP0130-WARN.cmake2
-rw-r--r--Tests/RunCMake/while/CMP0130-common.cmake (renamed from Tests/RunCMake/while/unbalanced-parenthesis.cmake)1
-rw-r--r--Tests/RunCMake/while/RunCMakeTest.cmake4
10 files changed, 34 insertions, 2 deletions
diff --git a/Tests/RunCMake/while/CMP0130-NEW-result.txt b/Tests/RunCMake/while/CMP0130-NEW-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/while/CMP0130-NEW-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/while/CMP0130-NEW-stderr.txt b/Tests/RunCMake/while/CMP0130-NEW-stderr.txt
new file mode 100644
index 0000000..df492d5
--- /dev/null
+++ b/Tests/RunCMake/while/CMP0130-NEW-stderr.txt
@@ -0,0 +1,9 @@
+^CMake Error at CMP0130-common.cmake:[0-9]+ \(while\):
+ while\(\) given incorrect arguments:
+
+ "\("
+
+ mismatched parenthesis in condition
+Call Stack \(most recent call first\):
+ CMP0130-NEW.cmake:[0-9]+ \(include\)
+ CMakeLists.txt:[0-9]+ \(include\)$
diff --git a/Tests/RunCMake/while/CMP0130-NEW.cmake b/Tests/RunCMake/while/CMP0130-NEW.cmake
new file mode 100644
index 0000000..3cc5027
--- /dev/null
+++ b/Tests/RunCMake/while/CMP0130-NEW.cmake
@@ -0,0 +1,2 @@
+cmake_policy(SET CMP0130 NEW)
+include(CMP0130-common.cmake)
diff --git a/Tests/RunCMake/while/unbalanced-parenthesis-stdout.txt b/Tests/RunCMake/while/CMP0130-OLD-stdout.txt
index d45e194..d45e194 100644
--- a/Tests/RunCMake/while/unbalanced-parenthesis-stdout.txt
+++ b/Tests/RunCMake/while/CMP0130-OLD-stdout.txt
diff --git a/Tests/RunCMake/while/CMP0130-OLD.cmake b/Tests/RunCMake/while/CMP0130-OLD.cmake
new file mode 100644
index 0000000..15a4290
--- /dev/null
+++ b/Tests/RunCMake/while/CMP0130-OLD.cmake
@@ -0,0 +1,2 @@
+cmake_policy(SET CMP0130 OLD)
+include(CMP0130-common.cmake)
diff --git a/Tests/RunCMake/while/CMP0130-WARN-stderr.txt b/Tests/RunCMake/while/CMP0130-WARN-stderr.txt
new file mode 100644
index 0000000..bc88c5e
--- /dev/null
+++ b/Tests/RunCMake/while/CMP0130-WARN-stderr.txt
@@ -0,0 +1,14 @@
+^CMake Warning \(dev\) at CMP0130-common.cmake:[0-9]+ \(while\):
+ Policy CMP0130 is not set: while\(\) diagnoses condition evaluation errors.
+ Run "cmake --help-policy CMP0130" for policy details. Use the cmake_policy
+ command to set the policy and suppress this warning.
+
+ while\(\) given incorrect arguments:
+
+ "\("
+
+ mismatched parenthesis in condition
+Call Stack \(most recent call first\):
+ CMP0130-WARN.cmake:[0-9]+ \(include\)
+ CMakeLists.txt:[0-9]+ \(include\)
+This warning is for project developers. Use -Wno-dev to suppress it.$
diff --git a/Tests/RunCMake/while/CMP0130-WARN-stdout.txt b/Tests/RunCMake/while/CMP0130-WARN-stdout.txt
new file mode 100644
index 0000000..d45e194
--- /dev/null
+++ b/Tests/RunCMake/while/CMP0130-WARN-stdout.txt
@@ -0,0 +1 @@
+-- Code incorrectly accepted
diff --git a/Tests/RunCMake/while/CMP0130-WARN.cmake b/Tests/RunCMake/while/CMP0130-WARN.cmake
new file mode 100644
index 0000000..562c25d
--- /dev/null
+++ b/Tests/RunCMake/while/CMP0130-WARN.cmake
@@ -0,0 +1,2 @@
+# CMP0130 left unset
+include(CMP0130-common.cmake)
diff --git a/Tests/RunCMake/while/unbalanced-parenthesis.cmake b/Tests/RunCMake/while/CMP0130-common.cmake
index 39d736b..15322e0 100644
--- a/Tests/RunCMake/while/unbalanced-parenthesis.cmake
+++ b/Tests/RunCMake/while/CMP0130-common.cmake
@@ -3,5 +3,4 @@ while(${paren})
message(STATUS "Condition incorrectly true")
break()
endwhile()
-# FIXME(#23296): The above condition error is tolerated for compatibility.
message(STATUS "Code incorrectly accepted")
diff --git a/Tests/RunCMake/while/RunCMakeTest.cmake b/Tests/RunCMake/while/RunCMakeTest.cmake
index bb9b991..d018b16 100644
--- a/Tests/RunCMake/while/RunCMakeTest.cmake
+++ b/Tests/RunCMake/while/RunCMakeTest.cmake
@@ -6,4 +6,6 @@ run_cmake(EndMismatch)
run_cmake(EndAlone)
run_cmake(EndAloneArgs)
-run_cmake(unbalanced-parenthesis)
+run_cmake(CMP0130-OLD)
+run_cmake(CMP0130-WARN)
+run_cmake(CMP0130-NEW)