summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2021-12-14 14:35:50 (GMT)
committerKitware Robot <kwrobot@kitware.com>2021-12-14 14:36:08 (GMT)
commit25a300b76e88903dfa44939dd3a564b5377b4640 (patch)
tree02b3fb3b80399009438e99024895a140b6e0be53 /Tests
parent7a408511bd264e49f2e94dfc74468aed87373303 (diff)
parent7dd3e99270431cace5086c62f4ee73441b9edc5e (diff)
downloadCMake-25a300b76e88903dfa44939dd3a564b5377b4640.zip
CMake-25a300b76e88903dfa44939dd3a564b5377b4640.tar.gz
CMake-25a300b76e88903dfa44939dd3a564b5377b4640.tar.bz2
Merge topic 'fix-list-transform-invalid-index-crashes'
7dd3e99270 cmListCommand: Handle invalid FOR selector ranges Acked-by: Kitware Robot <kwrobot@kitware.com> Tested-by: buildbot <buildbot@kitware.com> Merge-request: !6786
Diffstat (limited to 'Tests')
-rw-r--r--Tests/RunCMake/list/RunCMakeTest.cmake3
-rw-r--r--Tests/RunCMake/list/TRANSFORM-Selector-FOR-BackwardsRange-result.txt1
-rw-r--r--Tests/RunCMake/list/TRANSFORM-Selector-FOR-BackwardsRange-stderr.txt5
-rw-r--r--Tests/RunCMake/list/TRANSFORM-Selector-FOR-BackwardsRange.cmake2
-rw-r--r--Tests/RunCMake/list/TRANSFORM-Selector-FOR-NegativeStepArgument-result.txt1
-rw-r--r--Tests/RunCMake/list/TRANSFORM-Selector-FOR-NegativeStepArgument-stderr.txt5
-rw-r--r--Tests/RunCMake/list/TRANSFORM-Selector-FOR-NegativeStepArgument.cmake2
-rw-r--r--Tests/RunCMake/list/TRANSFORM-Selector-FOR-ZeroStepArgument-result.txt1
-rw-r--r--Tests/RunCMake/list/TRANSFORM-Selector-FOR-ZeroStepArgument-stderr.txt5
-rw-r--r--Tests/RunCMake/list/TRANSFORM-Selector-FOR-ZeroStepArgument.cmake2
10 files changed, 27 insertions, 0 deletions
diff --git a/Tests/RunCMake/list/RunCMakeTest.cmake b/Tests/RunCMake/list/RunCMakeTest.cmake
index c11891c..eb43ee0 100644
--- a/Tests/RunCMake/list/RunCMakeTest.cmake
+++ b/Tests/RunCMake/list/RunCMakeTest.cmake
@@ -77,6 +77,9 @@ run_cmake(TRANSFORM-Selector-FOR-NoEnoughArguments)
run_cmake(TRANSFORM-Selector-FOR-TooManyArguments)
run_cmake(TRANSFORM-Selector-FOR-BadArgument)
run_cmake(TRANSFORM-Selector-FOR-InvalidIndex)
+run_cmake(TRANSFORM-Selector-FOR-ZeroStepArgument)
+run_cmake(TRANSFORM-Selector-FOR-NegativeStepArgument)
+run_cmake(TRANSFORM-Selector-FOR-BackwardsRange)
# 'output' oriented tests
run_cmake(TRANSFORM-Output-OUTPUT_VARIABLE-NoArguments)
run_cmake(TRANSFORM-Output-OUTPUT_VARIABLE-TooManyArguments)
diff --git a/Tests/RunCMake/list/TRANSFORM-Selector-FOR-BackwardsRange-result.txt b/Tests/RunCMake/list/TRANSFORM-Selector-FOR-BackwardsRange-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/list/TRANSFORM-Selector-FOR-BackwardsRange-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/list/TRANSFORM-Selector-FOR-BackwardsRange-stderr.txt b/Tests/RunCMake/list/TRANSFORM-Selector-FOR-BackwardsRange-stderr.txt
new file mode 100644
index 0000000..1acdc15
--- /dev/null
+++ b/Tests/RunCMake/list/TRANSFORM-Selector-FOR-BackwardsRange-stderr.txt
@@ -0,0 +1,5 @@
+^CMake Error at TRANSFORM-Selector-FOR-BackwardsRange.cmake:2 \(list\):
+ list sub-command TRANSFORM, selector FOR expects <start> to be no greater
+ than <stop> \(2 > 1\)
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)$
diff --git a/Tests/RunCMake/list/TRANSFORM-Selector-FOR-BackwardsRange.cmake b/Tests/RunCMake/list/TRANSFORM-Selector-FOR-BackwardsRange.cmake
new file mode 100644
index 0000000..761c187
--- /dev/null
+++ b/Tests/RunCMake/list/TRANSFORM-Selector-FOR-BackwardsRange.cmake
@@ -0,0 +1,2 @@
+set(mylist alpha bravo charlie)
+list(TRANSFORM mylist TOUPPER FOR 2 1)
diff --git a/Tests/RunCMake/list/TRANSFORM-Selector-FOR-NegativeStepArgument-result.txt b/Tests/RunCMake/list/TRANSFORM-Selector-FOR-NegativeStepArgument-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/list/TRANSFORM-Selector-FOR-NegativeStepArgument-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/list/TRANSFORM-Selector-FOR-NegativeStepArgument-stderr.txt b/Tests/RunCMake/list/TRANSFORM-Selector-FOR-NegativeStepArgument-stderr.txt
new file mode 100644
index 0000000..b9845a7
--- /dev/null
+++ b/Tests/RunCMake/list/TRANSFORM-Selector-FOR-NegativeStepArgument-stderr.txt
@@ -0,0 +1,5 @@
+^CMake Error at TRANSFORM-Selector-FOR-NegativeStepArgument.cmake:2 \(list\):
+ list sub-command TRANSFORM, selector FOR expects positive numeric value for
+ <step>.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)$
diff --git a/Tests/RunCMake/list/TRANSFORM-Selector-FOR-NegativeStepArgument.cmake b/Tests/RunCMake/list/TRANSFORM-Selector-FOR-NegativeStepArgument.cmake
new file mode 100644
index 0000000..0876512
--- /dev/null
+++ b/Tests/RunCMake/list/TRANSFORM-Selector-FOR-NegativeStepArgument.cmake
@@ -0,0 +1,2 @@
+set(mylist alpha bravo charlie)
+list(TRANSFORM mylist TOUPPER FOR 0 2 -1)
diff --git a/Tests/RunCMake/list/TRANSFORM-Selector-FOR-ZeroStepArgument-result.txt b/Tests/RunCMake/list/TRANSFORM-Selector-FOR-ZeroStepArgument-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/list/TRANSFORM-Selector-FOR-ZeroStepArgument-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/list/TRANSFORM-Selector-FOR-ZeroStepArgument-stderr.txt b/Tests/RunCMake/list/TRANSFORM-Selector-FOR-ZeroStepArgument-stderr.txt
new file mode 100644
index 0000000..e8be4f1
--- /dev/null
+++ b/Tests/RunCMake/list/TRANSFORM-Selector-FOR-ZeroStepArgument-stderr.txt
@@ -0,0 +1,5 @@
+^CMake Error at TRANSFORM-Selector-FOR-ZeroStepArgument.cmake:2 \(list\):
+ list sub-command TRANSFORM, selector FOR expects positive numeric value for
+ <step>.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)$
diff --git a/Tests/RunCMake/list/TRANSFORM-Selector-FOR-ZeroStepArgument.cmake b/Tests/RunCMake/list/TRANSFORM-Selector-FOR-ZeroStepArgument.cmake
new file mode 100644
index 0000000..7b14eb6
--- /dev/null
+++ b/Tests/RunCMake/list/TRANSFORM-Selector-FOR-ZeroStepArgument.cmake
@@ -0,0 +1,2 @@
+set(mylist alpha bravo charlie)
+list(TRANSFORM mylist TOUPPER FOR 0 2 0)