diff options
author | Shane Parris <shane.lee.parris@gmail.com> | 2018-01-26 18:42:35 (GMT) |
---|---|---|
committer | Shane Parris <shane.lee.parris@gmail.com> | 2018-02-15 15:54:18 (GMT) |
commit | 602988e1e568048dd30e9e2213bc788f7c7ff708 (patch) | |
tree | b151fbe9f470fbd8e6e6dee34a43356fda794343 /Tests/RunCMake/file | |
parent | a2ec98b7d97df67d50e90e790b2bd235f7c278cc (diff) | |
download | CMake-602988e1e568048dd30e9e2213bc788f7c7ff708.zip CMake-602988e1e568048dd30e9e2213bc788f7c7ff708.tar.gz CMake-602988e1e568048dd30e9e2213bc788f7c7ff708.tar.bz2 |
Adds file(TOUCH) and file(TOUCH_NOCREATE) sub-commands
Diffstat (limited to 'Tests/RunCMake/file')
10 files changed, 36 insertions, 0 deletions
diff --git a/Tests/RunCMake/file/RunCMakeTest.cmake b/Tests/RunCMake/file/RunCMakeTest.cmake index 3be4fb7..9a72333 100644 --- a/Tests/RunCMake/file/RunCMakeTest.cmake +++ b/Tests/RunCMake/file/RunCMakeTest.cmake @@ -5,6 +5,9 @@ run_cmake(DOWNLOAD-unused-argument) run_cmake(DOWNLOAD-httpheader-not-set) run_cmake(DOWNLOAD-netrc-bad) run_cmake(DOWNLOAD-pass-not-set) +run_cmake(TOUCH) +run_cmake(TOUCH-error-in-source-directory) +run_cmake(TOUCH-error-missing-directory) run_cmake(UPLOAD-unused-argument) run_cmake(UPLOAD-httpheader-not-set) run_cmake(UPLOAD-netrc-bad) diff --git a/Tests/RunCMake/file/TOUCH-error-in-source-directory-result.txt b/Tests/RunCMake/file/TOUCH-error-in-source-directory-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/file/TOUCH-error-in-source-directory-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/file/TOUCH-error-in-source-directory-stderr.txt b/Tests/RunCMake/file/TOUCH-error-in-source-directory-stderr.txt new file mode 100644 index 0000000..f899c75 --- /dev/null +++ b/Tests/RunCMake/file/TOUCH-error-in-source-directory-stderr.txt @@ -0,0 +1 @@ +.*file attempted to touch a file: diff --git a/Tests/RunCMake/file/TOUCH-error-in-source-directory.cmake b/Tests/RunCMake/file/TOUCH-error-in-source-directory.cmake new file mode 100644 index 0000000..9aa7c56 --- /dev/null +++ b/Tests/RunCMake/file/TOUCH-error-in-source-directory.cmake @@ -0,0 +1,2 @@ +set(CMAKE_DISABLE_SOURCE_CHANGES ON) +file(TOUCH "${CMAKE_CURRENT_SOURCE_DIR}/touch_test") diff --git a/Tests/RunCMake/file/TOUCH-error-missing-directory-result.txt b/Tests/RunCMake/file/TOUCH-error-missing-directory-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/file/TOUCH-error-missing-directory-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/file/TOUCH-error-missing-directory-stderr.txt b/Tests/RunCMake/file/TOUCH-error-missing-directory-stderr.txt new file mode 100644 index 0000000..f52e11a --- /dev/null +++ b/Tests/RunCMake/file/TOUCH-error-missing-directory-stderr.txt @@ -0,0 +1 @@ +.*file problem touching file: diff --git a/Tests/RunCMake/file/TOUCH-error-missing-directory.cmake b/Tests/RunCMake/file/TOUCH-error-missing-directory.cmake new file mode 100644 index 0000000..0cfb8d9 --- /dev/null +++ b/Tests/RunCMake/file/TOUCH-error-missing-directory.cmake @@ -0,0 +1 @@ +file(TOUCH "${CMAKE_CURRENT_BINARY_DIR}/missing/directory/file.to-touch") diff --git a/Tests/RunCMake/file/TOUCH-result.txt b/Tests/RunCMake/file/TOUCH-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/file/TOUCH-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/file/TOUCH-stderr.txt b/Tests/RunCMake/file/TOUCH-stderr.txt new file mode 100644 index 0000000..9f31676 --- /dev/null +++ b/Tests/RunCMake/file/TOUCH-stderr.txt @@ -0,0 +1,9 @@ +^CMake Error at TOUCH\.cmake:[0-9]+ \(file\): + file must be called with at least two arguments\. +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Error at TOUCH\.cmake:[0-9]+ \(file\): + file must be called with at least two arguments\. +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/file/TOUCH.cmake b/Tests/RunCMake/file/TOUCH.cmake new file mode 100644 index 0000000..8931eb5 --- /dev/null +++ b/Tests/RunCMake/file/TOUCH.cmake @@ -0,0 +1,16 @@ +set(file "${CMAKE_CURRENT_BINARY_DIR}/file-to-touch") + +file(REMOVE "${file}") +file(TOUCH_NOCREATE "${file}") +if(EXISTS "${file}") + message(FATAL_ERROR "error: TOUCH_NOCREATE created a file!") +endif() + +file(TOUCH "${file}") +if(NOT EXISTS "${file}") + message(FATAL_ERROR "error: TOUCH did not create a file!") +endif() +file(REMOVE "${file}") + +file(TOUCH) +file(TOUCH_NOCREATE) |