diff options
Diffstat (limited to 'Tests/RunCMake/file')
114 files changed, 609 insertions, 0 deletions
diff --git a/Tests/RunCMake/file/CMakeLists.txt b/Tests/RunCMake/file/CMakeLists.txt new file mode 100644 index 0000000..2897109 --- /dev/null +++ b/Tests/RunCMake/file/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.0) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/file/DOWNLOAD-hash-mismatch-result.txt b/Tests/RunCMake/file/DOWNLOAD-hash-mismatch-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/file/DOWNLOAD-hash-mismatch-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/file/DOWNLOAD-hash-mismatch-stderr.txt b/Tests/RunCMake/file/DOWNLOAD-hash-mismatch-stderr.txt new file mode 100644 index 0000000..406e315 --- /dev/null +++ b/Tests/RunCMake/file/DOWNLOAD-hash-mismatch-stderr.txt @@ -0,0 +1,12 @@ +^CMake Error at DOWNLOAD-hash-mismatch.cmake:[0-9]+ \(file\): + file DOWNLOAD HASH mismatch + + for file: \[.*/Tests/RunCMake/file/DOWNLOAD-hash-mismatch-build/hash-mismatch.txt\] + expected hash: \[0123456789abcdef0123456789abcdef01234567\] + actual hash: \[da39a3ee5e6b4b0d3255bfef95601890afd80709\] + status: \[0;"No error"\] + +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) ++ +status='1;HASH mismatch: expected: 0123456789abcdef0123456789abcdef01234567 actual: da39a3ee5e6b4b0d3255bfef95601890afd80709'$ diff --git a/Tests/RunCMake/file/DOWNLOAD-hash-mismatch.cmake b/Tests/RunCMake/file/DOWNLOAD-hash-mismatch.cmake new file mode 100644 index 0000000..a91b217 --- /dev/null +++ b/Tests/RunCMake/file/DOWNLOAD-hash-mismatch.cmake @@ -0,0 +1,10 @@ +if(NOT "${CMAKE_CURRENT_SOURCE_DIR}" MATCHES "^/") + set(slash /) +endif() +file(DOWNLOAD + "file://${slash}${CMAKE_CURRENT_SOURCE_DIR}/DOWNLOAD-hash-mismatch.txt" + ${CMAKE_CURRENT_BINARY_DIR}/hash-mismatch.txt + EXPECTED_HASH SHA1=0123456789abcdef0123456789abcdef01234567 + STATUS status + ) +message("status='${status}'") diff --git a/Tests/RunCMake/file/DOWNLOAD-hash-mismatch.txt b/Tests/RunCMake/file/DOWNLOAD-hash-mismatch.txt new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/file/DOWNLOAD-hash-mismatch.txt diff --git a/Tests/RunCMake/file/DOWNLOAD-httpheader-not-set-result.txt b/Tests/RunCMake/file/DOWNLOAD-httpheader-not-set-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/file/DOWNLOAD-httpheader-not-set-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/file/DOWNLOAD-httpheader-not-set-stderr.txt b/Tests/RunCMake/file/DOWNLOAD-httpheader-not-set-stderr.txt new file mode 100644 index 0000000..247923b --- /dev/null +++ b/Tests/RunCMake/file/DOWNLOAD-httpheader-not-set-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at DOWNLOAD-httpheader-not-set.cmake:[0-9]+ \(file\): + file DOWNLOAD missing string for HTTPHEADER. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/file/DOWNLOAD-httpheader-not-set.cmake b/Tests/RunCMake/file/DOWNLOAD-httpheader-not-set.cmake new file mode 100644 index 0000000..6efc958 --- /dev/null +++ b/Tests/RunCMake/file/DOWNLOAD-httpheader-not-set.cmake @@ -0,0 +1 @@ +file(DOWNLOAD "" "" HTTPHEADER "Content-Type: application/x-compressed-tar" HTTPHEADER) diff --git a/Tests/RunCMake/file/DOWNLOAD-netrc-bad-result.txt b/Tests/RunCMake/file/DOWNLOAD-netrc-bad-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/file/DOWNLOAD-netrc-bad-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/file/DOWNLOAD-netrc-bad-stderr.txt b/Tests/RunCMake/file/DOWNLOAD-netrc-bad-stderr.txt new file mode 100644 index 0000000..96ce62a --- /dev/null +++ b/Tests/RunCMake/file/DOWNLOAD-netrc-bad-stderr.txt @@ -0,0 +1,19 @@ +^CMake Error at DOWNLOAD-netrc-bad\.cmake:[0-9]+ \(file\): + file DOWNLOAD missing level value for NETRC\. +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Error at DOWNLOAD-netrc-bad\.cmake:[0-9]+ \(file\): + file DOWNLOAD missing file value for NETRC_FILE\. +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Error at DOWNLOAD-netrc-bad\.cmake:[0-9]+ \(file\): + file NETRC accepts OPTIONAL, IGNORED or REQUIRED but got: INVALID +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Error at DOWNLOAD-netrc-bad\.cmake:[0-9]+ \(file\): + file NETRC accepts OPTIONAL, IGNORED or REQUIRED but got: FALSE +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/file/DOWNLOAD-netrc-bad.cmake b/Tests/RunCMake/file/DOWNLOAD-netrc-bad.cmake new file mode 100644 index 0000000..6a62df9 --- /dev/null +++ b/Tests/RunCMake/file/DOWNLOAD-netrc-bad.cmake @@ -0,0 +1,15 @@ +if(NOT "${CMAKE_CURRENT_SOURCE_DIR}" MATCHES "^/") + set(slash /) +endif() +file(DOWNLOAD "" "" NETRC) +file(DOWNLOAD "" "" NETRC_FILE) +set(CMAKE_NETRC FALSE) +file(DOWNLOAD + "file://${slash}${CMAKE_CURRENT_SOURCE_DIR}/DOWNLOAD-netrc-bad.txt" + "${CMAKE_CURRENT_BINARY_DIR}/netrc-bad.txt" + NETRC INVALID + ) +file(DOWNLOAD + "file://${slash}${CMAKE_CURRENT_SOURCE_DIR}/DOWNLOAD-netrc-bad.txt" + "${CMAKE_CURRENT_BINARY_DIR}/netrc-bad.txt" + ) diff --git a/Tests/RunCMake/file/DOWNLOAD-netrc-bad.txt b/Tests/RunCMake/file/DOWNLOAD-netrc-bad.txt new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/file/DOWNLOAD-netrc-bad.txt diff --git a/Tests/RunCMake/file/DOWNLOAD-pass-not-set-result.txt b/Tests/RunCMake/file/DOWNLOAD-pass-not-set-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/file/DOWNLOAD-pass-not-set-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/file/DOWNLOAD-pass-not-set-stderr.txt b/Tests/RunCMake/file/DOWNLOAD-pass-not-set-stderr.txt new file mode 100644 index 0000000..2fa2731 --- /dev/null +++ b/Tests/RunCMake/file/DOWNLOAD-pass-not-set-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at DOWNLOAD-pass-not-set.cmake:[0-9]+ \(file\): + file DOWNLOAD missing string for USERPWD. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/file/DOWNLOAD-pass-not-set.cmake b/Tests/RunCMake/file/DOWNLOAD-pass-not-set.cmake new file mode 100644 index 0000000..61eff6d --- /dev/null +++ b/Tests/RunCMake/file/DOWNLOAD-pass-not-set.cmake @@ -0,0 +1 @@ +file(DOWNLOAD "" "" USERPWD) diff --git a/Tests/RunCMake/file/DOWNLOAD-unused-argument-result.txt b/Tests/RunCMake/file/DOWNLOAD-unused-argument-result.txt new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/file/DOWNLOAD-unused-argument-result.txt diff --git a/Tests/RunCMake/file/DOWNLOAD-unused-argument-stderr.txt b/Tests/RunCMake/file/DOWNLOAD-unused-argument-stderr.txt new file mode 100644 index 0000000..82a78c9 --- /dev/null +++ b/Tests/RunCMake/file/DOWNLOAD-unused-argument-stderr.txt @@ -0,0 +1,5 @@ +^CMake Warning \(dev\) at DOWNLOAD-unused-argument.cmake:[0-9]+ \(file\): + Unexpected argument: JUNK +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) +This warning is for project developers. Use -Wno-dev to suppress it.$ diff --git a/Tests/RunCMake/file/DOWNLOAD-unused-argument.cmake b/Tests/RunCMake/file/DOWNLOAD-unused-argument.cmake new file mode 100644 index 0000000..2fa5482 --- /dev/null +++ b/Tests/RunCMake/file/DOWNLOAD-unused-argument.cmake @@ -0,0 +1,8 @@ +if(NOT "${CMAKE_CURRENT_SOURCE_DIR}" MATCHES "^/") + set(slash /) +endif() +file(DOWNLOAD + "file://${slash}${CMAKE_CURRENT_SOURCE_DIR}/DOWNLOAD-unused-argument.txt" + "${CMAKE_CURRENT_BINARY_DIR}/unused-argument.txt" + JUNK + ) diff --git a/Tests/RunCMake/file/DOWNLOAD-unused-argument.txt b/Tests/RunCMake/file/DOWNLOAD-unused-argument.txt new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/file/DOWNLOAD-unused-argument.txt diff --git a/Tests/RunCMake/file/FileOpenFailRead-result.txt b/Tests/RunCMake/file/FileOpenFailRead-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/file/FileOpenFailRead-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/file/FileOpenFailRead-stderr.txt b/Tests/RunCMake/file/FileOpenFailRead-stderr.txt new file mode 100644 index 0000000..23d4337 --- /dev/null +++ b/Tests/RunCMake/file/FileOpenFailRead-stderr.txt @@ -0,0 +1,6 @@ +CMake Error at FileOpenFailRead.cmake:[0-9]+ \(file\): + file failed to open for reading \(.*\): + + .*/Tests/RunCMake/file/does_not_exist/file.txt +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/file/FileOpenFailRead.cmake b/Tests/RunCMake/file/FileOpenFailRead.cmake new file mode 100644 index 0000000..4d4c6dc --- /dev/null +++ b/Tests/RunCMake/file/FileOpenFailRead.cmake @@ -0,0 +1 @@ +file(READ "${CMAKE_CURRENT_SOURCE_DIR}/does_not_exist/file.txt" content) diff --git a/Tests/RunCMake/file/GLOB-error-LIST_DIRECTORIES-no-arg-result.txt b/Tests/RunCMake/file/GLOB-error-LIST_DIRECTORIES-no-arg-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/file/GLOB-error-LIST_DIRECTORIES-no-arg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/file/GLOB-error-LIST_DIRECTORIES-no-arg-stderr.txt b/Tests/RunCMake/file/GLOB-error-LIST_DIRECTORIES-no-arg-stderr.txt new file mode 100644 index 0000000..9629cfd --- /dev/null +++ b/Tests/RunCMake/file/GLOB-error-LIST_DIRECTORIES-no-arg-stderr.txt @@ -0,0 +1 @@ +.*file LIST_DIRECTORIES missing bool value\. diff --git a/Tests/RunCMake/file/GLOB-error-LIST_DIRECTORIES-no-arg.cmake b/Tests/RunCMake/file/GLOB-error-LIST_DIRECTORIES-no-arg.cmake new file mode 100644 index 0000000..a8e15f2 --- /dev/null +++ b/Tests/RunCMake/file/GLOB-error-LIST_DIRECTORIES-no-arg.cmake @@ -0,0 +1 @@ +file(GLOB CONTENT_LIST LIST_DIRECTORIES) diff --git a/Tests/RunCMake/file/GLOB-error-LIST_DIRECTORIES-not-boolean-result.txt b/Tests/RunCMake/file/GLOB-error-LIST_DIRECTORIES-not-boolean-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/file/GLOB-error-LIST_DIRECTORIES-not-boolean-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/file/GLOB-error-LIST_DIRECTORIES-not-boolean-stderr.txt b/Tests/RunCMake/file/GLOB-error-LIST_DIRECTORIES-not-boolean-stderr.txt new file mode 100644 index 0000000..9629cfd --- /dev/null +++ b/Tests/RunCMake/file/GLOB-error-LIST_DIRECTORIES-not-boolean-stderr.txt @@ -0,0 +1 @@ +.*file LIST_DIRECTORIES missing bool value\. diff --git a/Tests/RunCMake/file/GLOB-error-LIST_DIRECTORIES-not-boolean.cmake b/Tests/RunCMake/file/GLOB-error-LIST_DIRECTORIES-not-boolean.cmake new file mode 100644 index 0000000..f735433 --- /dev/null +++ b/Tests/RunCMake/file/GLOB-error-LIST_DIRECTORIES-not-boolean.cmake @@ -0,0 +1 @@ +file(GLOB CONTENT_LIST LIST_DIRECTORIES 13) diff --git a/Tests/RunCMake/file/GLOB-noexp-LIST_DIRECTORIES.cmake b/Tests/RunCMake/file/GLOB-noexp-LIST_DIRECTORIES.cmake new file mode 100644 index 0000000..37a9d54 --- /dev/null +++ b/Tests/RunCMake/file/GLOB-noexp-LIST_DIRECTORIES.cmake @@ -0,0 +1 @@ +file(GLOB CONTENT_LIST LIST_DIRECTORIES false) diff --git a/Tests/RunCMake/file/GLOB-stderr.txt b/Tests/RunCMake/file/GLOB-stderr.txt new file mode 100644 index 0000000..c47dc40 --- /dev/null +++ b/Tests/RunCMake/file/GLOB-stderr.txt @@ -0,0 +1,6 @@ +content: 6[ ] +.*/test/dir 1/dir 1 file;.*/test/dir 1/empty_dir;.*/test/dir 1/non_empty_dir;.*/test/dir 2/dir 2 file;.*/test/dir 2/empty_dir;.*/test/dir 2/non_empty_dir +content: 6[ ] +.*/test/dir 1/dir 1 file;.*/test/dir 1/empty_dir;.*/test/dir 1/non_empty_dir;.*/test/dir 2/dir 2 file;.*/test/dir 2/empty_dir;.*/test/dir 2/non_empty_dir +content: 2[ ] +.*/test/dir 1/dir 1 file;.*/test/dir 2/dir 2 file diff --git a/Tests/RunCMake/file/GLOB.cmake b/Tests/RunCMake/file/GLOB.cmake new file mode 100644 index 0000000..c524e42 --- /dev/null +++ b/Tests/RunCMake/file/GLOB.cmake @@ -0,0 +1,25 @@ +file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/test/dir 1/empty_dir") +file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/test/dir 1/non_empty_dir") +file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/test/dir 2/empty_dir") +file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/test/dir 2/non_empty_dir") + +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/test/dir 1/dir 1 file" "test file") +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/test/dir 1/non_empty_dir/dir 1 subdir file" "test file") + +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/test/dir 2/dir 2 file" "test file") +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/test/dir 2/non_empty_dir/dir 2 subdir file" "test file") + +file(GLOB CONTENT_LIST "${CMAKE_CURRENT_BINARY_DIR}/test/*/*") +list(LENGTH CONTENT_LIST CONTENT_COUNT) +message("content: ${CONTENT_COUNT} ") +message("${CONTENT_LIST}") + +file(GLOB CONTENT_LIST LIST_DIRECTORIES true "${CMAKE_CURRENT_BINARY_DIR}/test/*/*") +list(LENGTH CONTENT_LIST CONTENT_COUNT) +message("content: ${CONTENT_COUNT} ") +message("${CONTENT_LIST}") + +file(GLOB CONTENT_LIST LIST_DIRECTORIES false "${CMAKE_CURRENT_BINARY_DIR}/test/*/*") +list(LENGTH CONTENT_LIST CONTENT_COUNT) +message("content: ${CONTENT_COUNT} ") +message("${CONTENT_LIST}") diff --git a/Tests/RunCMake/file/GLOB_RECURSE-cyclic-recursion-stderr.txt b/Tests/RunCMake/file/GLOB_RECURSE-cyclic-recursion-stderr.txt new file mode 100644 index 0000000..f73aa83 --- /dev/null +++ b/Tests/RunCMake/file/GLOB_RECURSE-cyclic-recursion-stderr.txt @@ -0,0 +1,15 @@ +.*Cyclic recursion detected while globbing for.* +.*/test/depth1/depth2/depth3.* +.*/test/depth1/depth2/depth3/recursion.* +content: 4[ ] +.*/test/abc;.*/test/depth1/depth2/depth3/file_symlink;.*/test/depth1/depth2/depth3/recursion/abc;.*/test/depth1/depth2/depth3/recursion/depth1/depth2/depth3/file_symlink +.*Cyclic recursion detected while globbing for.* +.*/test/depth1/depth2/depth3.* +.*/test/depth1/depth2/depth3/recursion.* +content: 4[ ] +.*/test/abc;.*/test/depth1/depth2/depth3/file_symlink;.*/test/depth1/depth2/depth3/recursion/abc;.*/test/depth1/depth2/depth3/recursion/depth1/depth2/depth3/file_symlink +.*Cyclic recursion detected while globbing for.* +.*/test/depth1/depth2/depth3.* +.*/test/depth1/depth2/depth3/recursion.* +content: 11[ ] +.*/test/abc;.*/test/depth1;.*/test/depth1/depth2;.*/test/depth1/depth2/depth3;.*/test/depth1/depth2/depth3/file_symlink;.*/test/depth1/depth2/depth3/recursion;.*/test/depth1/depth2/depth3/recursion/abc;.*/test/depth1/depth2/depth3/recursion/depth1;.*/test/depth1/depth2/depth3/recursion/depth1/depth2;.*/test/depth1/depth2/depth3/recursion/depth1/depth2/depth3;.*/test/depth1/depth2/depth3/recursion/depth1/depth2/depth3/file_symlink diff --git a/Tests/RunCMake/file/GLOB_RECURSE-cyclic-recursion.cmake b/Tests/RunCMake/file/GLOB_RECURSE-cyclic-recursion.cmake new file mode 100644 index 0000000..fb8be42 --- /dev/null +++ b/Tests/RunCMake/file/GLOB_RECURSE-cyclic-recursion.cmake @@ -0,0 +1,20 @@ +file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/test/depth1/depth2/depth3") +execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink "${CMAKE_CURRENT_BINARY_DIR}/test" "${CMAKE_CURRENT_BINARY_DIR}/test/depth1/depth2/depth3/recursion") + +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/test/abc" "message to write") +execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink "${CMAKE_CURRENT_BINARY_DIR}/test/abc" "${CMAKE_CURRENT_BINARY_DIR}/test/depth1/depth2/depth3/file_symlink") + +file(GLOB_RECURSE CONTENT_LIST FOLLOW_SYMLINKS "${CMAKE_CURRENT_BINARY_DIR}/test/*") +list(LENGTH CONTENT_LIST CONTENT_COUNT) +message("content: ${CONTENT_COUNT} ") +message("${CONTENT_LIST}") + +file(GLOB_RECURSE CONTENT_LIST LIST_DIRECTORIES false FOLLOW_SYMLINKS "${CMAKE_CURRENT_BINARY_DIR}/test/*") +list(LENGTH CONTENT_LIST CONTENT_COUNT) +message("content: ${CONTENT_COUNT} ") +message("${CONTENT_LIST}") + +file(GLOB_RECURSE CONTENT_LIST LIST_DIRECTORIES true FOLLOW_SYMLINKS "${CMAKE_CURRENT_BINARY_DIR}/test/*") +list(LENGTH CONTENT_LIST CONTENT_COUNT) +message("content: ${CONTENT_COUNT} ") +message("${CONTENT_LIST}") diff --git a/Tests/RunCMake/file/GLOB_RECURSE-stderr.txt b/Tests/RunCMake/file/GLOB_RECURSE-stderr.txt new file mode 100644 index 0000000..5d48e47 --- /dev/null +++ b/Tests/RunCMake/file/GLOB_RECURSE-stderr.txt @@ -0,0 +1,6 @@ +content: 4[ ] +.*/test/dir 1/dir 1 file;.*/test/dir 1/non_empty_dir/dir 1 subdir file;.*/test/dir 2/dir 2 file;.*/test/dir 2/non_empty_dir/dir 2 subdir file +content: 4[ ] +.*/test/dir 1/dir 1 file;.*/test/dir 1/non_empty_dir/dir 1 subdir file;.*/test/dir 2/dir 2 file;.*/test/dir 2/non_empty_dir/dir 2 subdir file +content: 8[ ] +.*/test/dir 1/dir 1 file;.*/test/dir 1/empty_dir;.*/test/dir 1/non_empty_dir;.*/test/dir 1/non_empty_dir/dir 1 subdir file;.*/test/dir 2/dir 2 file;.*/test/dir 2/empty_dir;.*/test/dir 2/non_empty_dir;.*/test/dir 2/non_empty_dir/dir 2 subdir file diff --git a/Tests/RunCMake/file/GLOB_RECURSE.cmake b/Tests/RunCMake/file/GLOB_RECURSE.cmake new file mode 100644 index 0000000..530930f --- /dev/null +++ b/Tests/RunCMake/file/GLOB_RECURSE.cmake @@ -0,0 +1,25 @@ +file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/test/dir 1/empty_dir") +file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/test/dir 1/non_empty_dir") +file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/test/dir 2/empty_dir") +file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/test/dir 2/non_empty_dir") + +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/test/dir 1/dir 1 file" "test file") +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/test/dir 1/non_empty_dir/dir 1 subdir file" "test file") + +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/test/dir 2/dir 2 file" "test file") +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/test/dir 2/non_empty_dir/dir 2 subdir file" "test file") + +file(GLOB_RECURSE CONTENT_LIST "${CMAKE_CURRENT_BINARY_DIR}/test/*/*") +list(LENGTH CONTENT_LIST CONTENT_COUNT) +message("content: ${CONTENT_COUNT} ") +message("${CONTENT_LIST}") + +file(GLOB_RECURSE CONTENT_LIST LIST_DIRECTORIES false "${CMAKE_CURRENT_BINARY_DIR}/test/*/*") +list(LENGTH CONTENT_LIST CONTENT_COUNT) +message("content: ${CONTENT_COUNT} ") +message("${CONTENT_LIST}") + +file(GLOB_RECURSE CONTENT_LIST LIST_DIRECTORIES true "${CMAKE_CURRENT_BINARY_DIR}/test/*/*") +list(LENGTH CONTENT_LIST CONTENT_COUNT) +message("content: ${CONTENT_COUNT} ") +message("${CONTENT_LIST}") diff --git a/Tests/RunCMake/file/INSTALL-DIRECTORY-stdout.txt b/Tests/RunCMake/file/INSTALL-DIRECTORY-stdout.txt new file mode 100644 index 0000000..561a6b1 --- /dev/null +++ b/Tests/RunCMake/file/INSTALL-DIRECTORY-stdout.txt @@ -0,0 +1,8 @@ +-- Before Installing +-- Installing: .*/Tests/RunCMake/file/INSTALL-DIRECTORY-build/dir +-- Installing: .*/Tests/RunCMake/file/INSTALL-DIRECTORY-build/dir/empty.txt +-- Up-to-date: .*/Tests/RunCMake/file/INSTALL-DIRECTORY-build/dir +-- Up-to-date: .*/Tests/RunCMake/file/INSTALL-DIRECTORY-build/dir/empty.txt +-- Up-to-date: .*/Tests/RunCMake/file/INSTALL-DIRECTORY-build/dir +-- Up-to-date: .*/Tests/RunCMake/file/INSTALL-DIRECTORY-build/dir/empty.txt +-- After Installing diff --git a/Tests/RunCMake/file/INSTALL-DIRECTORY.cmake b/Tests/RunCMake/file/INSTALL-DIRECTORY.cmake new file mode 100644 index 0000000..0bc1d18 --- /dev/null +++ b/Tests/RunCMake/file/INSTALL-DIRECTORY.cmake @@ -0,0 +1,10 @@ +set(src ${CMAKE_CURRENT_SOURCE_DIR}/dir) +set(dst ${CMAKE_CURRENT_BINARY_DIR}/dir) +file(REMOVE RECURSE ${dst}) +message(STATUS "Before Installing") +file(INSTALL FILES ${src}/ DESTINATION ${dst} TYPE DIRECTORY) +file(INSTALL FILES ${src}/ DESTINATION ${dst} TYPE DIRECTORY) +file(INSTALL FILES ${src}/ DESTINATION ${dst} TYPE DIRECTORY MESSAGE_NEVER) +file(INSTALL FILES ${src}/ DESTINATION ${dst} TYPE DIRECTORY MESSAGE_LAZY) +file(INSTALL FILES ${src}/ DESTINATION ${dst} TYPE DIRECTORY MESSAGE_ALWAYS) +message(STATUS "After Installing") diff --git a/Tests/RunCMake/file/INSTALL-FILES_FROM_DIR-bad-result.txt b/Tests/RunCMake/file/INSTALL-FILES_FROM_DIR-bad-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/file/INSTALL-FILES_FROM_DIR-bad-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/file/INSTALL-FILES_FROM_DIR-bad-stderr.txt b/Tests/RunCMake/file/INSTALL-FILES_FROM_DIR-bad-stderr.txt new file mode 100644 index 0000000..9d5f876 --- /dev/null +++ b/Tests/RunCMake/file/INSTALL-FILES_FROM_DIR-bad-stderr.txt @@ -0,0 +1,15 @@ +^CMake Error at INSTALL-FILES_FROM_DIR-bad.cmake:[0-9]+ \(file\): + file option FILES_FROM_DIR requires all files to be specified as relative + paths\. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) ++ +CMake Error at INSTALL-FILES_FROM_DIR-bad.cmake:[0-9]+ \(file\): + file INSTALL option RENAME may not be combined with FILES_FROM_DIR\. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) ++ +CMake Error at INSTALL-FILES_FROM_DIR-bad.cmake:[0-9]+ \(file\): + file option FILES_FROM_DIR may not appear after PATTERN or REGEX\. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/file/INSTALL-FILES_FROM_DIR-bad.cmake b/Tests/RunCMake/file/INSTALL-FILES_FROM_DIR-bad.cmake new file mode 100644 index 0000000..807b704 --- /dev/null +++ b/Tests/RunCMake/file/INSTALL-FILES_FROM_DIR-bad.cmake @@ -0,0 +1,5 @@ +set(src ${CMAKE_CURRENT_SOURCE_DIR}/from) +set(dst ${CMAKE_CURRENT_BINARY_DIR}/from) +file(INSTALL FILES ${src}/a.txt FILES_FROM_DIR ${src} DESTINATION ${dst}) +file(INSTALL FILES a.txt FILES_FROM_DIR ${src} DESTINATION ${dst} RENAME b.txt) +file(INSTALL FILES a.txt DESTINATION ${dst} PATTERN *.txt FILES_FROM_DIR) diff --git a/Tests/RunCMake/file/INSTALL-FILES_FROM_DIR-stdout.txt b/Tests/RunCMake/file/INSTALL-FILES_FROM_DIR-stdout.txt new file mode 100644 index 0000000..1c3c693 --- /dev/null +++ b/Tests/RunCMake/file/INSTALL-FILES_FROM_DIR-stdout.txt @@ -0,0 +1,8 @@ +-- Before Installing +-- Installing: .*/Tests/RunCMake/file/INSTALL-FILES_FROM_DIR-build/from/a.txt +-- Installing: .*/Tests/RunCMake/file/INSTALL-FILES_FROM_DIR-build/from/a/b.txt +-- Installing: .*/Tests/RunCMake/file/INSTALL-FILES_FROM_DIR-build/from/a/b/c.txt +-- Up-to-date: .*/Tests/RunCMake/file/INSTALL-FILES_FROM_DIR-build/from/a.txt +-- Up-to-date: .*/Tests/RunCMake/file/INSTALL-FILES_FROM_DIR-build/from/a/b.txt +-- Up-to-date: .*/Tests/RunCMake/file/INSTALL-FILES_FROM_DIR-build/from/a/b/c.txt +-- After Installing diff --git a/Tests/RunCMake/file/INSTALL-FILES_FROM_DIR.cmake b/Tests/RunCMake/file/INSTALL-FILES_FROM_DIR.cmake new file mode 100644 index 0000000..24e5282 --- /dev/null +++ b/Tests/RunCMake/file/INSTALL-FILES_FROM_DIR.cmake @@ -0,0 +1,7 @@ +set(src ${CMAKE_CURRENT_SOURCE_DIR}/from) +set(dst ${CMAKE_CURRENT_BINARY_DIR}/from) +file(REMOVE RECURSE ${dst}) +message(STATUS "Before Installing") +file(INSTALL FILES a.txt a/b.txt a/b/c.txt FILES_FROM_DIR ${src} DESTINATION ${dst}) +file(INSTALL FILES a.txt a/b.txt a/b/c.txt FILES_FROM_DIR from DESTINATION ${dst}) +message(STATUS "After Installing") diff --git a/Tests/RunCMake/file/INSTALL-MESSAGE-bad-result.txt b/Tests/RunCMake/file/INSTALL-MESSAGE-bad-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/file/INSTALL-MESSAGE-bad-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/file/INSTALL-MESSAGE-bad-stderr.txt b/Tests/RunCMake/file/INSTALL-MESSAGE-bad-stderr.txt new file mode 100644 index 0000000..557b817 --- /dev/null +++ b/Tests/RunCMake/file/INSTALL-MESSAGE-bad-stderr.txt @@ -0,0 +1,32 @@ +CMake Error at INSTALL-MESSAGE-bad.cmake:1 \(file\): + file INSTALL options MESSAGE_ALWAYS, MESSAGE_LAZY, and MESSAGE_NEVER are + mutually exclusive. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Error at INSTALL-MESSAGE-bad.cmake:2 \(file\): + file INSTALL options MESSAGE_ALWAYS, MESSAGE_LAZY, and MESSAGE_NEVER are + mutually exclusive. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Error at INSTALL-MESSAGE-bad.cmake:3 \(file\): + file INSTALL options MESSAGE_ALWAYS, MESSAGE_LAZY, and MESSAGE_NEVER are + mutually exclusive. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Error at INSTALL-MESSAGE-bad.cmake:4 \(file\): + file option MESSAGE_ALWAYS may not appear after PATTERN or REGEX. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Error at INSTALL-MESSAGE-bad.cmake:5 \(file\): + file option MESSAGE_LAZY may not appear after PATTERN or REGEX. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Error at INSTALL-MESSAGE-bad.cmake:6 \(file\): + file option MESSAGE_NEVER may not appear after PATTERN or REGEX. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/file/INSTALL-MESSAGE-bad.cmake b/Tests/RunCMake/file/INSTALL-MESSAGE-bad.cmake new file mode 100644 index 0000000..f878c69 --- /dev/null +++ b/Tests/RunCMake/file/INSTALL-MESSAGE-bad.cmake @@ -0,0 +1,6 @@ +file(INSTALL DESTINATION dir MESSAGE_ALWAYS MESSAGE_LAZY) +file(INSTALL DESTINATION dir MESSAGE_ALWAYS MESSAGE_NEVER) +file(INSTALL DESTINATION dir MESSAGE_LAZY MESSAGE_NEVER) +file(INSTALL DESTINATION dir PATTERN *.txt MESSAGE_ALWAYS) +file(INSTALL DESTINATION dir PATTERN *.txt MESSAGE_LAZY) +file(INSTALL DESTINATION dir PATTERN *.txt MESSAGE_NEVER) diff --git a/Tests/RunCMake/file/INSTALL-SYMLINK-stdout.txt b/Tests/RunCMake/file/INSTALL-SYMLINK-stdout.txt new file mode 100644 index 0000000..9fb8e10 --- /dev/null +++ b/Tests/RunCMake/file/INSTALL-SYMLINK-stdout.txt @@ -0,0 +1,3 @@ +-- Before Installing +-- Installing: .*/Tests/RunCMake/file/INSTALL-SYMLINK-build/dst/current_dir_symlink +-- After Installing diff --git a/Tests/RunCMake/file/INSTALL-SYMLINK.cmake b/Tests/RunCMake/file/INSTALL-SYMLINK.cmake new file mode 100644 index 0000000..5a4284a --- /dev/null +++ b/Tests/RunCMake/file/INSTALL-SYMLINK.cmake @@ -0,0 +1,13 @@ +set(src "${CMAKE_CURRENT_BINARY_DIR}/src") +set(dst "${CMAKE_CURRENT_BINARY_DIR}/dst") +file(REMOVE RECURSE "${src}") +file(REMOVE RECURSE "${dst}") + +file(MAKE_DIRECTORY "${src}") +execute_process(COMMAND + ${CMAKE_COMMAND} -E create_symlink source "${src}/current_dir_symlink") + +message(STATUS "Before Installing") +file(INSTALL FILES "${src}/current_dir_symlink" + DESTINATION ${dst} TYPE DIRECTORY) +message(STATUS "After Installing") diff --git a/Tests/RunCMake/file/LOCK-error-file-create-fail-result.txt b/Tests/RunCMake/file/LOCK-error-file-create-fail-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/file/LOCK-error-file-create-fail-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/file/LOCK-error-file-create-fail-stderr.txt b/Tests/RunCMake/file/LOCK-error-file-create-fail-stderr.txt new file mode 100644 index 0000000..72b7fe0 --- /dev/null +++ b/Tests/RunCMake/file/LOCK-error-file-create-fail-stderr.txt @@ -0,0 +1,8 @@ +CMake Error at LOCK-error-file-create-fail\.cmake:[0-9]+ \(file\): + file + + ".*" + + creation failed \(check permissions\)\. +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/file/LOCK-error-file-create-fail.cmake b/Tests/RunCMake/file/LOCK-error-file-create-fail.cmake new file mode 100644 index 0000000..4868cfe --- /dev/null +++ b/Tests/RunCMake/file/LOCK-error-file-create-fail.cmake @@ -0,0 +1,3 @@ +set(tmp "${CMAKE_CURRENT_BINARY_DIR}/temp-directory") +file(MAKE_DIRECTORY "${tmp}") +file(LOCK "${tmp}") diff --git a/Tests/RunCMake/file/LOCK-error-guard-incorrect-result.txt b/Tests/RunCMake/file/LOCK-error-guard-incorrect-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/file/LOCK-error-guard-incorrect-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/file/LOCK-error-guard-incorrect-stderr.txt b/Tests/RunCMake/file/LOCK-error-guard-incorrect-stderr.txt new file mode 100644 index 0000000..85136b4 --- /dev/null +++ b/Tests/RunCMake/file/LOCK-error-guard-incorrect-stderr.txt @@ -0,0 +1,6 @@ +CMake Error at LOCK-error-guard-incorrect\.cmake:[0-9]+ \(file\): + expected FUNCTION, FILE or PROCESS after GUARD, but got: + + "FUNCTIO"\. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/file/LOCK-error-guard-incorrect.cmake b/Tests/RunCMake/file/LOCK-error-guard-incorrect.cmake new file mode 100644 index 0000000..51daa7c --- /dev/null +++ b/Tests/RunCMake/file/LOCK-error-guard-incorrect.cmake @@ -0,0 +1 @@ +file(LOCK "${CMAKE_CURRENT_BINARY_DIR}/file-to-lock" GUARD FUNCTIO) diff --git a/Tests/RunCMake/file/LOCK-error-incorrect-timeout-result.txt b/Tests/RunCMake/file/LOCK-error-incorrect-timeout-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/file/LOCK-error-incorrect-timeout-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/file/LOCK-error-incorrect-timeout-stderr.txt b/Tests/RunCMake/file/LOCK-error-incorrect-timeout-stderr.txt new file mode 100644 index 0000000..c6ae1e0 --- /dev/null +++ b/Tests/RunCMake/file/LOCK-error-incorrect-timeout-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at LOCK-error-incorrect-timeout\.cmake:[0-9]+ \(file\): + TIMEOUT value "qwerty" is not an unsigned integer\. +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/file/LOCK-error-incorrect-timeout-trail-result.txt b/Tests/RunCMake/file/LOCK-error-incorrect-timeout-trail-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/file/LOCK-error-incorrect-timeout-trail-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/file/LOCK-error-incorrect-timeout-trail-stderr.txt b/Tests/RunCMake/file/LOCK-error-incorrect-timeout-trail-stderr.txt new file mode 100644 index 0000000..6ea2507 --- /dev/null +++ b/Tests/RunCMake/file/LOCK-error-incorrect-timeout-trail-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at LOCK-error-incorrect-timeout-trail\.cmake:[0-9]+ \(file\): + TIMEOUT value "123xyz" is not an unsigned integer\. +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/file/LOCK-error-incorrect-timeout-trail.cmake b/Tests/RunCMake/file/LOCK-error-incorrect-timeout-trail.cmake new file mode 100644 index 0000000..c4f1b75 --- /dev/null +++ b/Tests/RunCMake/file/LOCK-error-incorrect-timeout-trail.cmake @@ -0,0 +1 @@ +file(LOCK "${CMAKE_CURRENT_BINARY_DIR}/file-to-lock" TIMEOUT 123xyz) diff --git a/Tests/RunCMake/file/LOCK-error-incorrect-timeout.cmake b/Tests/RunCMake/file/LOCK-error-incorrect-timeout.cmake new file mode 100644 index 0000000..d882467 --- /dev/null +++ b/Tests/RunCMake/file/LOCK-error-incorrect-timeout.cmake @@ -0,0 +1 @@ +file(LOCK "${CMAKE_CURRENT_BINARY_DIR}/file-to-lock" TIMEOUT qwerty) diff --git a/Tests/RunCMake/file/LOCK-error-lock-fail-result.txt b/Tests/RunCMake/file/LOCK-error-lock-fail-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/file/LOCK-error-lock-fail-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/file/LOCK-error-lock-fail-stderr.txt b/Tests/RunCMake/file/LOCK-error-lock-fail-stderr.txt new file mode 100644 index 0000000..a7b0447 --- /dev/null +++ b/Tests/RunCMake/file/LOCK-error-lock-fail-stderr.txt @@ -0,0 +1,6 @@ +CMake Error at LOCK-error-lock-fail.cmake:[0-9]+ \(file\): + directory + + ".*" + + creation failed \(check permissions\)\. diff --git a/Tests/RunCMake/file/LOCK-error-lock-fail.cmake b/Tests/RunCMake/file/LOCK-error-lock-fail.cmake new file mode 100644 index 0000000..aa7f663 --- /dev/null +++ b/Tests/RunCMake/file/LOCK-error-lock-fail.cmake @@ -0,0 +1,6 @@ +set(lfile "${CMAKE_CURRENT_BINARY_DIR}/file-to-lock") +FILE(WRITE "${lfile}" "") + +# Try to lock file '${lfile}/cmake.lock'. Since `lfile` is not a directory +# expected that operation will fail. +file(LOCK "${lfile}" DIRECTORY) diff --git a/Tests/RunCMake/file/LOCK-error-negative-timeout-result.txt b/Tests/RunCMake/file/LOCK-error-negative-timeout-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/file/LOCK-error-negative-timeout-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/file/LOCK-error-negative-timeout-stderr.txt b/Tests/RunCMake/file/LOCK-error-negative-timeout-stderr.txt new file mode 100644 index 0000000..0d159c1 --- /dev/null +++ b/Tests/RunCMake/file/LOCK-error-negative-timeout-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at LOCK-error-negative-timeout\.cmake:[0-9]+ \(file\): + TIMEOUT value "-2" is not an unsigned integer\. +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/file/LOCK-error-negative-timeout.cmake b/Tests/RunCMake/file/LOCK-error-negative-timeout.cmake new file mode 100644 index 0000000..6a0f190 --- /dev/null +++ b/Tests/RunCMake/file/LOCK-error-negative-timeout.cmake @@ -0,0 +1 @@ +file(LOCK "${CMAKE_CURRENT_BINARY_DIR}/file-to-lock" TIMEOUT -2) diff --git a/Tests/RunCMake/file/LOCK-error-no-function-result.txt b/Tests/RunCMake/file/LOCK-error-no-function-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/file/LOCK-error-no-function-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/file/LOCK-error-no-function-stderr.txt b/Tests/RunCMake/file/LOCK-error-no-function-stderr.txt new file mode 100644 index 0000000..51ed12d --- /dev/null +++ b/Tests/RunCMake/file/LOCK-error-no-function-stderr.txt @@ -0,0 +1,8 @@ +CMake Error at LOCK-error-no-function\.cmake:[0-9]+ \(file\): + error locking file + + ".*" + + 'GUARD FUNCTION' not used in function definition\. +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/file/LOCK-error-no-function.cmake b/Tests/RunCMake/file/LOCK-error-no-function.cmake new file mode 100644 index 0000000..1b8b06a --- /dev/null +++ b/Tests/RunCMake/file/LOCK-error-no-function.cmake @@ -0,0 +1 @@ +file(LOCK "${CMAKE_CURRENT_BINARY_DIR}/file-to-lock" GUARD FUNCTION) diff --git a/Tests/RunCMake/file/LOCK-error-no-guard-result.txt b/Tests/RunCMake/file/LOCK-error-no-guard-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/file/LOCK-error-no-guard-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/file/LOCK-error-no-guard-stderr.txt b/Tests/RunCMake/file/LOCK-error-no-guard-stderr.txt new file mode 100644 index 0000000..41177ce --- /dev/null +++ b/Tests/RunCMake/file/LOCK-error-no-guard-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at LOCK-error-no-guard\.cmake:[0-9]+ \(file\): + expected FUNCTION, FILE or PROCESS after GUARD +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/file/LOCK-error-no-guard.cmake b/Tests/RunCMake/file/LOCK-error-no-guard.cmake new file mode 100644 index 0000000..48ffc5e --- /dev/null +++ b/Tests/RunCMake/file/LOCK-error-no-guard.cmake @@ -0,0 +1 @@ +file(LOCK "${CMAKE_CURRENT_BINARY_DIR}/file-to-lock" GUARD) diff --git a/Tests/RunCMake/file/LOCK-error-no-path-result.txt b/Tests/RunCMake/file/LOCK-error-no-path-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/file/LOCK-error-no-path-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/file/LOCK-error-no-path-stderr.txt b/Tests/RunCMake/file/LOCK-error-no-path-stderr.txt new file mode 100644 index 0000000..2247aa6 --- /dev/null +++ b/Tests/RunCMake/file/LOCK-error-no-path-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at LOCK-error-no-path.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/LOCK-error-no-path.cmake b/Tests/RunCMake/file/LOCK-error-no-path.cmake new file mode 100644 index 0000000..12d79b7 --- /dev/null +++ b/Tests/RunCMake/file/LOCK-error-no-path.cmake @@ -0,0 +1 @@ +file(LOCK) diff --git a/Tests/RunCMake/file/LOCK-error-no-result-variable-result.txt b/Tests/RunCMake/file/LOCK-error-no-result-variable-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/file/LOCK-error-no-result-variable-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/file/LOCK-error-no-result-variable-stderr.txt b/Tests/RunCMake/file/LOCK-error-no-result-variable-stderr.txt new file mode 100644 index 0000000..b38e23c --- /dev/null +++ b/Tests/RunCMake/file/LOCK-error-no-result-variable-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at LOCK-error-no-result-variable\.cmake:[0-9]+ \(file\): + expected variable name after RESULT_VARIABLE +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/file/LOCK-error-no-result-variable.cmake b/Tests/RunCMake/file/LOCK-error-no-result-variable.cmake new file mode 100644 index 0000000..e6ac18d --- /dev/null +++ b/Tests/RunCMake/file/LOCK-error-no-result-variable.cmake @@ -0,0 +1 @@ +file(LOCK "${CMAKE_CURRENT_BINARY_DIR}/file-to-lock" RESULT_VARIABLE) diff --git a/Tests/RunCMake/file/LOCK-error-no-timeout-result.txt b/Tests/RunCMake/file/LOCK-error-no-timeout-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/file/LOCK-error-no-timeout-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/file/LOCK-error-no-timeout-stderr.txt b/Tests/RunCMake/file/LOCK-error-no-timeout-stderr.txt new file mode 100644 index 0000000..f34d46f --- /dev/null +++ b/Tests/RunCMake/file/LOCK-error-no-timeout-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at LOCK-error-no-timeout\.cmake:[0-9]+ \(file\): + expected timeout value after TIMEOUT +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/file/LOCK-error-no-timeout.cmake b/Tests/RunCMake/file/LOCK-error-no-timeout.cmake new file mode 100644 index 0000000..1618192 --- /dev/null +++ b/Tests/RunCMake/file/LOCK-error-no-timeout.cmake @@ -0,0 +1 @@ +file(LOCK "${CMAKE_CURRENT_BINARY_DIR}/file-to-lock" TIMEOUT) diff --git a/Tests/RunCMake/file/LOCK-error-timeout-result.txt b/Tests/RunCMake/file/LOCK-error-timeout-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/file/LOCK-error-timeout-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/file/LOCK-error-timeout-stderr.txt b/Tests/RunCMake/file/LOCK-error-timeout-stderr.txt new file mode 100644 index 0000000..4ad1f04 --- /dev/null +++ b/Tests/RunCMake/file/LOCK-error-timeout-stderr.txt @@ -0,0 +1,12 @@ +Output:[ ]* +Error: CMake Error at .*.timeout-script\.cmake:[0-9]+ \(file\): + error locking file + + ".*" + + Timeout reached\. ++ +CMake Error at LOCK-error-timeout\.cmake:[0-9]+ \(message\): + Result: 1 +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/file/LOCK-error-timeout-stdout.txt b/Tests/RunCMake/file/LOCK-error-timeout-stdout.txt new file mode 100644 index 0000000..8d98f9d --- /dev/null +++ b/Tests/RunCMake/file/LOCK-error-timeout-stdout.txt @@ -0,0 +1 @@ +.* diff --git a/Tests/RunCMake/file/LOCK-error-timeout.cmake b/Tests/RunCMake/file/LOCK-error-timeout.cmake new file mode 100644 index 0000000..b6b9476 --- /dev/null +++ b/Tests/RunCMake/file/LOCK-error-timeout.cmake @@ -0,0 +1,17 @@ +set(script "${CMAKE_CURRENT_LIST_DIR}/timeout-script.cmake") +set(file_to_lock "${CMAKE_CURRENT_BINARY_DIR}/file-to-lock") + +file(LOCK "${file_to_lock}") +execute_process( + COMMAND "${CMAKE_COMMAND}" "-Dfile_to_lock=${file_to_lock}" -P "${script}" + RESULT_VARIABLE result + OUTPUT_VARIABLE output + ERROR_VARIABLE error +) + +message("Output: ${output}") +message("Error: ${error}") + +if(NOT result EQUAL 0) + message(FATAL_ERROR "Result: ${result}") +endif() diff --git a/Tests/RunCMake/file/LOCK-error-unknown-option-result.txt b/Tests/RunCMake/file/LOCK-error-unknown-option-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/file/LOCK-error-unknown-option-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/file/LOCK-error-unknown-option-stderr.txt b/Tests/RunCMake/file/LOCK-error-unknown-option-stderr.txt new file mode 100644 index 0000000..ad596af --- /dev/null +++ b/Tests/RunCMake/file/LOCK-error-unknown-option-stderr.txt @@ -0,0 +1,6 @@ +CMake Error at LOCK-error-unknown-option\.cmake:[0-9]+ \(file\): + expected DIRECTORY, RELEASE, GUARD, RESULT_VARIABLE or TIMEOUT + + but got: "UNKNOWN"\. +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]* \(include\) diff --git a/Tests/RunCMake/file/LOCK-error-unknown-option.cmake b/Tests/RunCMake/file/LOCK-error-unknown-option.cmake new file mode 100644 index 0000000..88ef002 --- /dev/null +++ b/Tests/RunCMake/file/LOCK-error-unknown-option.cmake @@ -0,0 +1 @@ +file(LOCK "${CMAKE_CURRENT_BINARY_DIR}/temp-file" UNKNOWN) diff --git a/Tests/RunCMake/file/LOCK-lowercase.cmake b/Tests/RunCMake/file/LOCK-lowercase.cmake new file mode 100644 index 0000000..373afda --- /dev/null +++ b/Tests/RunCMake/file/LOCK-lowercase.cmake @@ -0,0 +1,11 @@ +set(lock "${CMAKE_CURRENT_BINARY_DIR}/file-to-lock") + +if(WIN32) + string(TOLOWER ${lock} lock) +endif() + +file(LOCK ${lock} TIMEOUT 0) +file(LOCK ${lock} RELEASE) + +file(LOCK ${lock} TIMEOUT 0) +file(LOCK ${lock} RELEASE) diff --git a/Tests/RunCMake/file/LOCK-stdout.txt b/Tests/RunCMake/file/LOCK-stdout.txt new file mode 100644 index 0000000..416126a --- /dev/null +++ b/Tests/RunCMake/file/LOCK-stdout.txt @@ -0,0 +1,11 @@ +-- Simple lock +-- Directory lock +-- Release +-- Lock function scope +-- Lock file scope +-- Lock in subdirectory +-- Lock process scope +-- Error double lock +-- Ok +-- Timeout 0 +-- Timeout not 0 diff --git a/Tests/RunCMake/file/LOCK.cmake b/Tests/RunCMake/file/LOCK.cmake new file mode 100644 index 0000000..8eff084 --- /dev/null +++ b/Tests/RunCMake/file/LOCK.cmake @@ -0,0 +1,40 @@ +set(lfile "${CMAKE_CURRENT_BINARY_DIR}/file-to-lock") +set(ldir "${CMAKE_CURRENT_BINARY_DIR}/dir-to-lock") + +message(STATUS "Simple lock") +file(LOCK ${lfile}) + +message(STATUS "Directory lock") +file(LOCK ${ldir} DIRECTORY) + +message(STATUS "Release") +file(LOCK ${lfile} RELEASE) + +function(foo) + file(LOCK "${lfile}" GUARD FUNCTION) +endfunction() + +message(STATUS "Lock function scope") +foo() + +message(STATUS "Lock file scope") +add_subdirectory(subdir_test_unlock) + +message(STATUS "Lock process scope") +file(LOCK "${lfile}" GUARD PROCESS) + +message(STATUS "Error double lock") +file(LOCK "${lfile}" RESULT_VARIABLE lock_result) +if(lock_result STREQUAL "File already locked") + message(STATUS "Ok") +else() + message(STATUS FATAL_ERROR "Expected error message") +endif() + +message(STATUS "Timeout 0") +file(LOCK "${lfile}" RELEASE) +file(LOCK "${lfile}" TIMEOUT 0) + +message(STATUS "Timeout not 0") +file(LOCK "${lfile}" RELEASE) +file(LOCK "${lfile}" TIMEOUT 3) diff --git a/Tests/RunCMake/file/READ_ELF-result.txt b/Tests/RunCMake/file/READ_ELF-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/file/READ_ELF-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/file/READ_ELF-stderr.txt b/Tests/RunCMake/file/READ_ELF-stderr.txt new file mode 100644 index 0000000..7b32804 --- /dev/null +++ b/Tests/RunCMake/file/READ_ELF-stderr.txt @@ -0,0 +1,2 @@ +.*file READ_ELF must be called with at least three additional arguments\. +.*file READ_ELF given FILE "XXX" that does not exist\. diff --git a/Tests/RunCMake/file/READ_ELF.cmake b/Tests/RunCMake/file/READ_ELF.cmake new file mode 100644 index 0000000..cd02c9b --- /dev/null +++ b/Tests/RunCMake/file/READ_ELF.cmake @@ -0,0 +1,2 @@ +file(READ_ELF XXX) +file(READ_ELF XXX RPATH YYY) diff --git a/Tests/RunCMake/file/RunCMakeTest.cmake b/Tests/RunCMake/file/RunCMakeTest.cmake new file mode 100644 index 0000000..3be4fb7 --- /dev/null +++ b/Tests/RunCMake/file/RunCMakeTest.cmake @@ -0,0 +1,44 @@ +include(RunCMake) + +run_cmake(DOWNLOAD-hash-mismatch) +run_cmake(DOWNLOAD-unused-argument) +run_cmake(DOWNLOAD-httpheader-not-set) +run_cmake(DOWNLOAD-netrc-bad) +run_cmake(DOWNLOAD-pass-not-set) +run_cmake(UPLOAD-unused-argument) +run_cmake(UPLOAD-httpheader-not-set) +run_cmake(UPLOAD-netrc-bad) +run_cmake(UPLOAD-pass-not-set) +run_cmake(INSTALL-DIRECTORY) +run_cmake(INSTALL-FILES_FROM_DIR) +run_cmake(INSTALL-FILES_FROM_DIR-bad) +run_cmake(INSTALL-MESSAGE-bad) +run_cmake(FileOpenFailRead) +run_cmake(LOCK) +run_cmake(LOCK-error-file-create-fail) +run_cmake(LOCK-error-guard-incorrect) +run_cmake(LOCK-error-incorrect-timeout) +run_cmake(LOCK-error-incorrect-timeout-trail) +run_cmake(LOCK-error-lock-fail) +run_cmake(LOCK-error-negative-timeout) +run_cmake(LOCK-error-no-function) +run_cmake(LOCK-error-no-guard) +run_cmake(LOCK-error-no-path) +run_cmake(LOCK-error-no-result-variable) +run_cmake(LOCK-error-no-timeout) +run_cmake(LOCK-error-timeout) +run_cmake(LOCK-error-unknown-option) +run_cmake(LOCK-lowercase) +run_cmake(READ_ELF) +run_cmake(GLOB) +run_cmake(GLOB_RECURSE) +# test is valid both for GLOB and GLOB_RECURSE +run_cmake(GLOB-error-LIST_DIRECTORIES-not-boolean) +# test is valid both for GLOB and GLOB_RECURSE +run_cmake(GLOB-error-LIST_DIRECTORIES-no-arg) +run_cmake(GLOB-noexp-LIST_DIRECTORIES) + +if(NOT WIN32 OR CYGWIN) + run_cmake(GLOB_RECURSE-cyclic-recursion) + run_cmake(INSTALL-SYMLINK) +endif() diff --git a/Tests/RunCMake/file/UPLOAD-httpheader-not-set-result.txt b/Tests/RunCMake/file/UPLOAD-httpheader-not-set-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/file/UPLOAD-httpheader-not-set-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/file/UPLOAD-httpheader-not-set-stderr.txt b/Tests/RunCMake/file/UPLOAD-httpheader-not-set-stderr.txt new file mode 100644 index 0000000..341baf5 --- /dev/null +++ b/Tests/RunCMake/file/UPLOAD-httpheader-not-set-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at UPLOAD-httpheader-not-set.cmake:[0-9]+ \(file\): + file UPLOAD missing string for HTTPHEADER. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/file/UPLOAD-httpheader-not-set.cmake b/Tests/RunCMake/file/UPLOAD-httpheader-not-set.cmake new file mode 100644 index 0000000..18d43cc --- /dev/null +++ b/Tests/RunCMake/file/UPLOAD-httpheader-not-set.cmake @@ -0,0 +1 @@ +file(UPLOAD "" "" HTTPHEADER "Content-Type: application/x-compressed-tar" HTTPHEADER) diff --git a/Tests/RunCMake/file/UPLOAD-netrc-bad-result.txt b/Tests/RunCMake/file/UPLOAD-netrc-bad-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/file/UPLOAD-netrc-bad-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/file/UPLOAD-netrc-bad-stderr.txt b/Tests/RunCMake/file/UPLOAD-netrc-bad-stderr.txt new file mode 100644 index 0000000..d5752ea --- /dev/null +++ b/Tests/RunCMake/file/UPLOAD-netrc-bad-stderr.txt @@ -0,0 +1,19 @@ +^CMake Error at UPLOAD-netrc-bad\.cmake:[0-9]+ \(file\): + file UPLOAD missing level value for NETRC\. +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Error at UPLOAD-netrc-bad\.cmake:[0-9]+ \(file\): + file UPLOAD missing file value for NETRC_FILE\. +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Error at UPLOAD-netrc-bad\.cmake:[0-9]+ \(file\): + file NETRC accepts OPTIONAL, IGNORED or REQUIRED but got: INVALID +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Error at UPLOAD-netrc-bad\.cmake:[0-9]+ \(file\): + file NETRC accepts OPTIONAL, IGNORED or REQUIRED but got: FALSE +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/file/UPLOAD-netrc-bad.cmake b/Tests/RunCMake/file/UPLOAD-netrc-bad.cmake new file mode 100644 index 0000000..e59a2c4 --- /dev/null +++ b/Tests/RunCMake/file/UPLOAD-netrc-bad.cmake @@ -0,0 +1,15 @@ +if(NOT "${CMAKE_CURRENT_SOURCE_DIR}" MATCHES "^/") + set(slash /) +endif() +file(UPLOAD "" "" NETRC) +file(UPLOAD "" "" NETRC_FILE) +set(CMAKE_NETRC FALSE) +file(UPLOAD + "${CMAKE_CURRENT_SOURCE_DIR}/UPLOAD-netrc-bad.txt" + "file://${slash}${CMAKE_CURRENT_BINARY_DIR}/netrc-bad.txt" + NETRC INVALID + ) +file(UPLOAD + "${CMAKE_CURRENT_SOURCE_DIR}/UPLOAD-netrc-bad.txt" + "file://${slash}${CMAKE_CURRENT_BINARY_DIR}/netrc-bad.txt" + ) diff --git a/Tests/RunCMake/file/UPLOAD-netrc-bad.txt b/Tests/RunCMake/file/UPLOAD-netrc-bad.txt new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/file/UPLOAD-netrc-bad.txt diff --git a/Tests/RunCMake/file/UPLOAD-pass-not-set-result.txt b/Tests/RunCMake/file/UPLOAD-pass-not-set-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/file/UPLOAD-pass-not-set-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/file/UPLOAD-pass-not-set-stderr.txt b/Tests/RunCMake/file/UPLOAD-pass-not-set-stderr.txt new file mode 100644 index 0000000..089c0ad --- /dev/null +++ b/Tests/RunCMake/file/UPLOAD-pass-not-set-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at UPLOAD-pass-not-set.cmake:[0-9]+ \(file\): + file UPLOAD missing string for USERPWD. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/file/UPLOAD-pass-not-set.cmake b/Tests/RunCMake/file/UPLOAD-pass-not-set.cmake new file mode 100644 index 0000000..4f3d86c --- /dev/null +++ b/Tests/RunCMake/file/UPLOAD-pass-not-set.cmake @@ -0,0 +1 @@ +file(UPLOAD "" "" USERPWD) diff --git a/Tests/RunCMake/file/UPLOAD-unused-argument-result.txt b/Tests/RunCMake/file/UPLOAD-unused-argument-result.txt new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/file/UPLOAD-unused-argument-result.txt diff --git a/Tests/RunCMake/file/UPLOAD-unused-argument-stderr.txt b/Tests/RunCMake/file/UPLOAD-unused-argument-stderr.txt new file mode 100644 index 0000000..3c1b744 --- /dev/null +++ b/Tests/RunCMake/file/UPLOAD-unused-argument-stderr.txt @@ -0,0 +1,5 @@ +^CMake Warning \(dev\) at UPLOAD-unused-argument.cmake:[0-9]+ \(file\): + Unexpected argument: JUNK +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) +This warning is for project developers. Use -Wno-dev to suppress it.$ diff --git a/Tests/RunCMake/file/UPLOAD-unused-argument.cmake b/Tests/RunCMake/file/UPLOAD-unused-argument.cmake new file mode 100644 index 0000000..92c878c --- /dev/null +++ b/Tests/RunCMake/file/UPLOAD-unused-argument.cmake @@ -0,0 +1,8 @@ +if(NOT "${CMAKE_CURRENT_BINARY_DIR}" MATCHES "^/") + set(slash /) +endif() +file(UPLOAD + "${CMAKE_CURRENT_SOURCE_DIR}/UPLOAD-unused-argument.txt" + "file://${slash}${CMAKE_CURRENT_BINARY_DIR}/unused-argument.txt" + JUNK + ) diff --git a/Tests/RunCMake/file/UPLOAD-unused-argument.txt b/Tests/RunCMake/file/UPLOAD-unused-argument.txt new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/file/UPLOAD-unused-argument.txt diff --git a/Tests/RunCMake/file/dir/empty.txt b/Tests/RunCMake/file/dir/empty.txt new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/file/dir/empty.txt diff --git a/Tests/RunCMake/file/from/a.txt b/Tests/RunCMake/file/from/a.txt new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/file/from/a.txt diff --git a/Tests/RunCMake/file/from/a/b.txt b/Tests/RunCMake/file/from/a/b.txt new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/file/from/a/b.txt diff --git a/Tests/RunCMake/file/from/a/b/c.txt b/Tests/RunCMake/file/from/a/b/c.txt new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/file/from/a/b/c.txt diff --git a/Tests/RunCMake/file/subdir_test_unlock/CMakeLists.txt b/Tests/RunCMake/file/subdir_test_unlock/CMakeLists.txt new file mode 100644 index 0000000..c167cd7 --- /dev/null +++ b/Tests/RunCMake/file/subdir_test_unlock/CMakeLists.txt @@ -0,0 +1,2 @@ +message(STATUS "Lock in subdirectory") +file(LOCK "${lfile}" GUARD FILE) diff --git a/Tests/RunCMake/file/timeout-script.cmake b/Tests/RunCMake/file/timeout-script.cmake new file mode 100644 index 0000000..e07dbf0 --- /dev/null +++ b/Tests/RunCMake/file/timeout-script.cmake @@ -0,0 +1,5 @@ +if(NOT file_to_lock) + message(FATAL_ERROR "file_to_lock is empty") +endif() + +file(LOCK "${file_to_lock}" TIMEOUT 1) |