diff options
author | Brad King <brad.king@kitware.com> | 2014-04-17 09:31:41 -0400 |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2014-04-17 09:45:09 -0400 |
commit | ccd29b9af849316a9361ceb8d0addb24e7158382 (patch) | |
tree | 7375d552f4c19075a7191ef4010a462fd3724c00 /Tests/Module | |
parent | fd8bb3427858017754d5b08a2eb1f57116feebb6 (diff) | |
download | cmake-ccd29b9af849316a9361ceb8d0addb24e7158382.tar.gz |
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/Module')
-rw-r--r-- | Tests/Module/ExternalData/CMakeLists.txt | 2 | ||||
-rw-r--r-- | Tests/Module/ExternalData/Data1Check.cmake | 22 |
2 files changed, 24 insertions, 0 deletions
diff --git a/Tests/Module/ExternalData/CMakeLists.txt b/Tests/Module/ExternalData/CMakeLists.txt index 5a6f3d50f7..ebca48e449 100644 --- a/Tests/Module/ExternalData/CMakeLists.txt +++ b/Tests/Module/ExternalData/CMakeLists.txt @@ -23,6 +23,8 @@ ExternalData_Add_Test(Data1 COMMAND ${CMAKE_COMMAND} -D Data=DATA{Data.dat} ${Data1CheckSpaces} + -D DataMissing=DATA{DataMissing.dat} + -D DataMissingWithAssociated=DATA{DataMissing.dat,Data.dat} -D SeriesA=DATA{SeriesA.dat,:} -D SeriesB=DATA{SeriesB.dat,:} -D SeriesC=DATA{SeriesC.dat,:} diff --git a/Tests/Module/ExternalData/Data1Check.cmake b/Tests/Module/ExternalData/Data1Check.cmake index 57702453e1..485b5c6c24 100644 --- a/Tests/Module/ExternalData/Data1Check.cmake +++ b/Tests/Module/ExternalData/Data1Check.cmake @@ -8,6 +8,28 @@ if(DEFINED DataSpace) message(SEND_ERROR "Input file:\n ${DataSpace}\ndoes not have expected content, but [[${lines}]]") endif() endif() +if(DataMissing) + if(EXISTS "${DataMissing}") + message(SEND_ERROR + "Input file:\n" + " ${DataMissing}\n" + "exists but should not." + ) + endif() +else() + message(SEND_ERROR "DataMissing is not set!") +endif() +if(DataMissingWithAssociated) + if(EXISTS "${DataMissingWithAssociated}") + message(SEND_ERROR + "Input file:\n" + " ${DataMissingWithAssociated}\n" + "exists but should not." + ) + endif() +else() + message(SEND_ERROR "DataMissingWithAssociated is not set!") +endif() set(SeriesAn1 "1\\.dat") set(SeriesBn1 "_1\\.dat") set(SeriesCn1 "\\.1\\.dat") |