summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/ExternalData
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2014-04-17 13:31:41 (GMT)
committerBrad King <brad.king@kitware.com>2014-04-17 13:45:09 (GMT)
commitccd29b9af849316a9361ceb8d0addb24e7158382 (patch)
tree7375d552f4c19075a7191ef4010a462fd3724c00 /Tests/RunCMake/ExternalData
parentfd8bb3427858017754d5b08a2eb1f57116feebb6 (diff)
downloadCMake-ccd29b9af849316a9361ceb8d0addb24e7158382.zip
CMake-ccd29b9af849316a9361ceb8d0addb24e7158382.tar.gz
CMake-ccd29b9af849316a9361ceb8d0addb24e7158382.tar.bz2
ExternalData: Warn on missing file instead of failing
When the primary source tree path named by a DATA{} reference does not exist, produce an AUTHOR_WARNING instead of a FATAL_ERROR. This is useful when writing a new DATA{} reference to a test reference output that has not been created yet. This way the developer can run the test, manually verify the output, and then copy it into place to provide the reference and eliminate the warning. If the named source tree path is expected to be a file but exists as a directory, we still need to produce a FATAL_ERROR.
Diffstat (limited to 'Tests/RunCMake/ExternalData')
-rw-r--r--Tests/RunCMake/ExternalData/Directory1-stderr.txt2
-rw-r--r--Tests/RunCMake/ExternalData/Directory3-result.txt1
-rw-r--r--Tests/RunCMake/ExternalData/Directory3-stderr.txt3
-rw-r--r--Tests/RunCMake/ExternalData/MissingData-result.txt1
-rw-r--r--Tests/RunCMake/ExternalData/MissingData-stderr.txt5
-rw-r--r--Tests/RunCMake/ExternalData/MissingData-stdout.txt1
-rw-r--r--Tests/RunCMake/ExternalData/MissingData.cmake13
-rw-r--r--Tests/RunCMake/ExternalData/MissingDataWithAssociated-stderr.txt15
-rw-r--r--Tests/RunCMake/ExternalData/MissingDataWithAssociated-stdout.txt1
-rw-r--r--Tests/RunCMake/ExternalData/MissingDataWithAssociated.cmake10
-rw-r--r--Tests/RunCMake/ExternalData/RunCMakeTest.cmake1
11 files changed, 43 insertions, 10 deletions
diff --git a/Tests/RunCMake/ExternalData/Directory1-stderr.txt b/Tests/RunCMake/ExternalData/Directory1-stderr.txt
index 85c250f..2bc3c60 100644
--- a/Tests/RunCMake/ExternalData/Directory1-stderr.txt
+++ b/Tests/RunCMake/ExternalData/Directory1-stderr.txt
@@ -7,7 +7,7 @@ CMake Error at .*/Modules/ExternalData.cmake:[0-9]+ \(message\):
Directory1
- that does not exist as a file \(with or without an extension\)!
+ that is directory instead of a file!
Call Stack \(most recent call first\):
.*
Directory1.cmake:3 \(ExternalData_Add_Test\)
diff --git a/Tests/RunCMake/ExternalData/Directory3-result.txt b/Tests/RunCMake/ExternalData/Directory3-result.txt
deleted file mode 100644
index d00491f..0000000
--- a/Tests/RunCMake/ExternalData/Directory3-result.txt
+++ /dev/null
@@ -1 +0,0 @@
-1
diff --git a/Tests/RunCMake/ExternalData/Directory3-stderr.txt b/Tests/RunCMake/ExternalData/Directory3-stderr.txt
index 56a341e..ceed2a0 100644
--- a/Tests/RunCMake/ExternalData/Directory3-stderr.txt
+++ b/Tests/RunCMake/ExternalData/Directory3-stderr.txt
@@ -1,4 +1,4 @@
-CMake Error at .*/Modules/ExternalData.cmake:[0-9]+ \(message\):
+CMake Warning \(dev\) at .*/Modules/ExternalData.cmake:[0-9]+ \(message\):
Data file referenced by argument
DATA{Directory3/\*}
@@ -12,3 +12,4 @@ Call Stack \(most recent call first\):
.*
Directory3.cmake:3 \(ExternalData_Add_Test\)
CMakeLists.txt:3 \(include\)
+This warning is for project developers. Use -Wno-dev to suppress it.
diff --git a/Tests/RunCMake/ExternalData/MissingData-result.txt b/Tests/RunCMake/ExternalData/MissingData-result.txt
deleted file mode 100644
index d00491f..0000000
--- a/Tests/RunCMake/ExternalData/MissingData-result.txt
+++ /dev/null
@@ -1 +0,0 @@
-1
diff --git a/Tests/RunCMake/ExternalData/MissingData-stderr.txt b/Tests/RunCMake/ExternalData/MissingData-stderr.txt
index e794f95..39ed2f1 100644
--- a/Tests/RunCMake/ExternalData/MissingData-stderr.txt
+++ b/Tests/RunCMake/ExternalData/MissingData-stderr.txt
@@ -1,4 +1,4 @@
-CMake Error at .*/Modules/ExternalData.cmake:[0-9]+ \(message\):
+CMake Warning \(dev\) at .*/Modules/ExternalData.cmake:[0-9]+ \(message\):
Data file referenced by argument
DATA{MissingData.txt}
@@ -10,5 +10,6 @@ CMake Error at .*/Modules/ExternalData.cmake:[0-9]+ \(message\):
that does not exist as a file \(with or without an extension\)!
Call Stack \(most recent call first\):
.*
- MissingData.cmake:2 \(ExternalData_Add_Test\)
+ MissingData.cmake:4 \(ExternalData_Expand_Arguments\)
CMakeLists.txt:3 \(include\)
+This warning is for project developers. Use -Wno-dev to suppress it.
diff --git a/Tests/RunCMake/ExternalData/MissingData-stdout.txt b/Tests/RunCMake/ExternalData/MissingData-stdout.txt
new file mode 100644
index 0000000..addd40e
--- /dev/null
+++ b/Tests/RunCMake/ExternalData/MissingData-stdout.txt
@@ -0,0 +1 @@
+-- Missing data reference correctly transformed!
diff --git a/Tests/RunCMake/ExternalData/MissingData.cmake b/Tests/RunCMake/ExternalData/MissingData.cmake
index b3c8a5c..f5fefd5 100644
--- a/Tests/RunCMake/ExternalData/MissingData.cmake
+++ b/Tests/RunCMake/ExternalData/MissingData.cmake
@@ -1,5 +1,10 @@
include(ExternalData)
-ExternalData_Add_Test(Data
- NAME Test
- COMMAND ${CMAKE_COMMAND} -E echo DATA{MissingData.txt}
- )
+
+set(output "${CMAKE_SOURCE_DIR}/MissingData.txt")
+ExternalData_Expand_Arguments(Data args DATA{MissingData.txt})
+if("x${args}" STREQUAL "x${output}")
+ message(STATUS "Missing data reference correctly transformed!")
+else()
+ message(FATAL_ERROR "Missing data reference transformed to:\n ${args}\n"
+ "but we expected:\n ${output}")
+endif()
diff --git a/Tests/RunCMake/ExternalData/MissingDataWithAssociated-stderr.txt b/Tests/RunCMake/ExternalData/MissingDataWithAssociated-stderr.txt
new file mode 100644
index 0000000..315af5e
--- /dev/null
+++ b/Tests/RunCMake/ExternalData/MissingDataWithAssociated-stderr.txt
@@ -0,0 +1,15 @@
+CMake Warning \(dev\) at .*/Modules/ExternalData.cmake:[0-9]+ \(message\):
+ Data file referenced by argument
+
+ DATA{MissingData.txt,Data.txt}
+
+ corresponds to source tree path
+
+ MissingData.txt
+
+ that does not exist as a file \(with or without an extension\)!
+Call Stack \(most recent call first\):
+ .*
+ MissingDataWithAssociated.cmake:4 \(ExternalData_Expand_Arguments\)
+ CMakeLists.txt:3 \(include\)
+This warning is for project developers. Use -Wno-dev to suppress it.
diff --git a/Tests/RunCMake/ExternalData/MissingDataWithAssociated-stdout.txt b/Tests/RunCMake/ExternalData/MissingDataWithAssociated-stdout.txt
new file mode 100644
index 0000000..addd40e
--- /dev/null
+++ b/Tests/RunCMake/ExternalData/MissingDataWithAssociated-stdout.txt
@@ -0,0 +1 @@
+-- Missing data reference correctly transformed!
diff --git a/Tests/RunCMake/ExternalData/MissingDataWithAssociated.cmake b/Tests/RunCMake/ExternalData/MissingDataWithAssociated.cmake
new file mode 100644
index 0000000..a4c4638
--- /dev/null
+++ b/Tests/RunCMake/ExternalData/MissingDataWithAssociated.cmake
@@ -0,0 +1,10 @@
+include(ExternalData)
+
+set(output "${CMAKE_BINARY_DIR}/MissingData.txt")
+ExternalData_Expand_Arguments(Data args DATA{MissingData.txt,Data.txt})
+if("x${args}" STREQUAL "x${output}")
+ message(STATUS "Missing data reference correctly transformed!")
+else()
+ message(FATAL_ERROR "Missing data reference transformed to:\n ${args}\n"
+ "but we expected:\n ${output}")
+endif()
diff --git a/Tests/RunCMake/ExternalData/RunCMakeTest.cmake b/Tests/RunCMake/ExternalData/RunCMakeTest.cmake
index 93ff08f..04e3d59 100644
--- a/Tests/RunCMake/ExternalData/RunCMakeTest.cmake
+++ b/Tests/RunCMake/ExternalData/RunCMakeTest.cmake
@@ -15,6 +15,7 @@ run_cmake(LinkContentMD5)
run_cmake(LinkContentSHA1)
run_cmake(LinkDirectory1)
run_cmake(MissingData)
+run_cmake(MissingDataWithAssociated)
run_cmake(NoLinkInSource)
run_cmake(NoURLTemplates)
run_cmake(NormalData1)