summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2015-02-25 13:11:39 (GMT)
committerBrad King <brad.king@kitware.com>2015-02-25 13:28:05 (GMT)
commitf7f4ca55bde68b174b7542fe417426a7cbf76fe3 (patch)
treeae52bbf6b9dd2af24e63661542f736cb7b06886c /Tests/RunCMake
parentac80f0f95fc7cfbad17c2a5656a87e346b9f298a (diff)
downloadCMake-f7f4ca55bde68b174b7542fe417426a7cbf76fe3.zip
CMake-f7f4ca55bde68b174b7542fe417426a7cbf76fe3.tar.gz
CMake-f7f4ca55bde68b174b7542fe417426a7cbf76fe3.tar.bz2
ExternalData: Add support for custom algorithm-to-URL mapping
Allow URL templates to contain a %(algo:<key>) placeholder that is replaced by mapping the canonical hash algorithm name through a map defined by the <key>. Extend the Module.ExternalData test to cover the behavior. Extend the RunCMake.ExternalData test to cover error cases.
Diffstat (limited to 'Tests/RunCMake')
-rw-r--r--Tests/RunCMake/ExternalData/BadAlgoMap1-result.txt1
-rw-r--r--Tests/RunCMake/ExternalData/BadAlgoMap1-stderr.txt9
-rw-r--r--Tests/RunCMake/ExternalData/BadAlgoMap1.cmake5
-rw-r--r--Tests/RunCMake/ExternalData/BadAlgoMap2-result.txt1
-rw-r--r--Tests/RunCMake/ExternalData/BadAlgoMap2-stderr.txt9
-rw-r--r--Tests/RunCMake/ExternalData/BadAlgoMap2.cmake5
-rw-r--r--Tests/RunCMake/ExternalData/RunCMakeTest.cmake2
7 files changed, 32 insertions, 0 deletions
diff --git a/Tests/RunCMake/ExternalData/BadAlgoMap1-result.txt b/Tests/RunCMake/ExternalData/BadAlgoMap1-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/ExternalData/BadAlgoMap1-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/ExternalData/BadAlgoMap1-stderr.txt b/Tests/RunCMake/ExternalData/BadAlgoMap1-stderr.txt
new file mode 100644
index 0000000..c3708a9
--- /dev/null
+++ b/Tests/RunCMake/ExternalData/BadAlgoMap1-stderr.txt
@@ -0,0 +1,9 @@
+CMake Error at .*/Modules/ExternalData.cmake:[0-9]+ \(message\):
+ Bad %\(algo:\) in URL template:
+
+ file:///path/to/%\(algo:\)/%\(hash\)
+
+ The transform name must be a valid C identifier.
+Call Stack \(most recent call first\):
+ BadAlgoMap1.cmake:[0-9]+ \(ExternalData_Add_Target\)
+ CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/ExternalData/BadAlgoMap1.cmake b/Tests/RunCMake/ExternalData/BadAlgoMap1.cmake
new file mode 100644
index 0000000..542ec1d
--- /dev/null
+++ b/Tests/RunCMake/ExternalData/BadAlgoMap1.cmake
@@ -0,0 +1,5 @@
+include(ExternalData)
+set(ExternalData_URL_TEMPLATES
+ "file:///path/to/%(algo:)/%(hash)"
+ )
+ExternalData_Add_Target(Data)
diff --git a/Tests/RunCMake/ExternalData/BadAlgoMap2-result.txt b/Tests/RunCMake/ExternalData/BadAlgoMap2-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/ExternalData/BadAlgoMap2-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/ExternalData/BadAlgoMap2-stderr.txt b/Tests/RunCMake/ExternalData/BadAlgoMap2-stderr.txt
new file mode 100644
index 0000000..1f10644
--- /dev/null
+++ b/Tests/RunCMake/ExternalData/BadAlgoMap2-stderr.txt
@@ -0,0 +1,9 @@
+CMake Error at .*/Modules/ExternalData.cmake:[0-9]+ \(message\):
+ Bad %\(algo:0BadMap\(\) in URL template:
+
+ file:///path/to/%\(algo:0BadMap\(\)/%\(hash\)
+
+ The transform name must be a valid C identifier.
+Call Stack \(most recent call first\):
+ BadAlgoMap2.cmake:[0-9]+ \(ExternalData_Add_Target\)
+ CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/ExternalData/BadAlgoMap2.cmake b/Tests/RunCMake/ExternalData/BadAlgoMap2.cmake
new file mode 100644
index 0000000..0537a7b
--- /dev/null
+++ b/Tests/RunCMake/ExternalData/BadAlgoMap2.cmake
@@ -0,0 +1,5 @@
+include(ExternalData)
+set(ExternalData_URL_TEMPLATES
+ "file:///path/to/%(algo:0BadMap()/%(hash)"
+ )
+ExternalData_Add_Target(Data)
diff --git a/Tests/RunCMake/ExternalData/RunCMakeTest.cmake b/Tests/RunCMake/ExternalData/RunCMakeTest.cmake
index 7afd289..241fa1f 100644
--- a/Tests/RunCMake/ExternalData/RunCMakeTest.cmake
+++ b/Tests/RunCMake/ExternalData/RunCMakeTest.cmake
@@ -1,5 +1,7 @@
include(RunCMake)
+run_cmake(BadAlgoMap1)
+run_cmake(BadAlgoMap2)
run_cmake(BadCustom1)
run_cmake(BadCustom2)
run_cmake(BadCustom3)