diff options
author | Sibi Siddharthan <sibisiddharthan.github@gmail.com> | 2020-08-11 18:33:59 (GMT) |
---|---|---|
committer | Sibi Siddharthan <sibisiddharthan.github@gmail.com> | 2020-08-26 15:52:50 (GMT) |
commit | 7de60beddf5b41f643e187fe487ffb91cd47e9f7 (patch) | |
tree | eb7719b6896f43414a5aea8d4ea5249ed33f21b2 /Tests | |
parent | 675be013e90eb1ae86e4259b55116d29cf2e1d73 (diff) | |
download | CMake-7de60beddf5b41f643e187fe487ffb91cd47e9f7.zip CMake-7de60beddf5b41f643e187fe487ffb91cd47e9f7.tar.gz CMake-7de60beddf5b41f643e187fe487ffb91cd47e9f7.tar.bz2 |
file: Add CHMOD and CHMOD_RECURSE subcommands
Fixes: #21057
Signed-off-by: Sibi Siddharthan <sibisiddharthan.github@gmail.com>
Diffstat (limited to 'Tests')
23 files changed, 100 insertions, 0 deletions
diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index 65e8b0b..b14b5b5 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -322,6 +322,7 @@ add_RunCMake_test(ctest_update) add_RunCMake_test(ctest_upload) add_RunCMake_test(ctest_fixtures) add_RunCMake_test(file) +add_RunCMake_test(file-CHMOD) add_RunCMake_test(find_file) add_RunCMake_test(find_library -DCYGWIN=${CYGWIN}) add_RunCMake_test(find_package) diff --git a/Tests/RunCMake/file-CHMOD/CHMOD-all-perms-result.txt b/Tests/RunCMake/file-CHMOD/CHMOD-all-perms-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/file-CHMOD/CHMOD-all-perms-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/file-CHMOD/CHMOD-all-perms-stderr.txt b/Tests/RunCMake/file-CHMOD/CHMOD-all-perms-stderr.txt new file mode 100644 index 0000000..b22387b --- /dev/null +++ b/Tests/RunCMake/file-CHMOD/CHMOD-all-perms-stderr.txt @@ -0,0 +1,5 @@ +CMake Error at CHMOD-all-perms\.cmake:[0-9]+ \(file\): + file Remove either PERMISSIONS or FILE_PERMISSIONS or DIRECTORY_PERMISSIONS + from the invocation +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/file-CHMOD/CHMOD-all-perms.cmake b/Tests/RunCMake/file-CHMOD/CHMOD-all-perms.cmake new file mode 100644 index 0000000..b49583d --- /dev/null +++ b/Tests/RunCMake/file-CHMOD/CHMOD-all-perms.cmake @@ -0,0 +1,6 @@ +file(REMOVE_RECURSE ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests) +file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests) + +file(TOUCH ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests/a) +file(CHMOD ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests/a PERMISSIONS OWNER_READ + FILE_PERMISSIONS OWNER_READ DIRECTORY_PERMISSIONS OWNER_READ) diff --git a/Tests/RunCMake/file-CHMOD/CHMOD-invalid-path-result.txt b/Tests/RunCMake/file-CHMOD/CHMOD-invalid-path-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/file-CHMOD/CHMOD-invalid-path-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/file-CHMOD/CHMOD-invalid-path-stderr.txt b/Tests/RunCMake/file-CHMOD/CHMOD-invalid-path-stderr.txt new file mode 100644 index 0000000..8d09e35 --- /dev/null +++ b/Tests/RunCMake/file-CHMOD/CHMOD-invalid-path-stderr.txt @@ -0,0 +1,6 @@ +CMake Error at CHMOD-invalid-path\.cmake:[0-9]+ \(file\): + file does not exist: + + .*/chmod-tests/I_dont_exist +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/file-CHMOD/CHMOD-invalid-path.cmake b/Tests/RunCMake/file-CHMOD/CHMOD-invalid-path.cmake new file mode 100644 index 0000000..36915c1 --- /dev/null +++ b/Tests/RunCMake/file-CHMOD/CHMOD-invalid-path.cmake @@ -0,0 +1,4 @@ +file(REMOVE_RECURSE ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests) +file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests) + +file(CHMOD ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests/I_dont_exist PERMISSIONS OWNER_READ) diff --git a/Tests/RunCMake/file-CHMOD/CHMOD-invalid-perms-result.txt b/Tests/RunCMake/file-CHMOD/CHMOD-invalid-perms-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/file-CHMOD/CHMOD-invalid-perms-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/file-CHMOD/CHMOD-invalid-perms-stderr.txt b/Tests/RunCMake/file-CHMOD/CHMOD-invalid-perms-stderr.txt new file mode 100644 index 0000000..84ba2a2 --- /dev/null +++ b/Tests/RunCMake/file-CHMOD/CHMOD-invalid-perms-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at CHMOD-invalid-perms\.cmake:[0-9]+ \(file\): + file INVALID_PERMISSION is an invalid permission specifier +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/file-CHMOD/CHMOD-invalid-perms.cmake b/Tests/RunCMake/file-CHMOD/CHMOD-invalid-perms.cmake new file mode 100644 index 0000000..22cab0b --- /dev/null +++ b/Tests/RunCMake/file-CHMOD/CHMOD-invalid-perms.cmake @@ -0,0 +1,5 @@ +file(REMOVE_RECURSE ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests) +file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests) + +file(TOUCH ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests/a) +file(CHMOD ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests/a PERMISSIONS INVALID_PERMISSION) diff --git a/Tests/RunCMake/file-CHMOD/CHMOD-no-keyword-result.txt b/Tests/RunCMake/file-CHMOD/CHMOD-no-keyword-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/file-CHMOD/CHMOD-no-keyword-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/file-CHMOD/CHMOD-no-keyword-stderr.txt b/Tests/RunCMake/file-CHMOD/CHMOD-no-keyword-stderr.txt new file mode 100644 index 0000000..2c248f8 --- /dev/null +++ b/Tests/RunCMake/file-CHMOD/CHMOD-no-keyword-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at CHMOD-no-keyword\.cmake:[0-9]+ \(file\): + file No permissions given +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/file-CHMOD/CHMOD-no-keyword.cmake b/Tests/RunCMake/file-CHMOD/CHMOD-no-keyword.cmake new file mode 100644 index 0000000..8b62106 --- /dev/null +++ b/Tests/RunCMake/file-CHMOD/CHMOD-no-keyword.cmake @@ -0,0 +1,5 @@ +file(REMOVE_RECURSE ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests) +file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests) + +file(TOUCH ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests/a) +file(CHMOD ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests/a) diff --git a/Tests/RunCMake/file-CHMOD/CHMOD-no-perms-result.txt b/Tests/RunCMake/file-CHMOD/CHMOD-no-perms-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/file-CHMOD/CHMOD-no-perms-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/file-CHMOD/CHMOD-no-perms-stderr.txt b/Tests/RunCMake/file-CHMOD/CHMOD-no-perms-stderr.txt new file mode 100644 index 0000000..a18609f --- /dev/null +++ b/Tests/RunCMake/file-CHMOD/CHMOD-no-perms-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at CHMOD-no-perms\.cmake:[0-9]+ \(file\): + file No permissions given +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/file-CHMOD/CHMOD-no-perms.cmake b/Tests/RunCMake/file-CHMOD/CHMOD-no-perms.cmake new file mode 100644 index 0000000..9fbd359 --- /dev/null +++ b/Tests/RunCMake/file-CHMOD/CHMOD-no-perms.cmake @@ -0,0 +1,5 @@ +file(REMOVE_RECURSE ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests) +file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests) + +file(TOUCH ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests/a) +file(CHMOD ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests/a PERMISSIONS) diff --git a/Tests/RunCMake/file-CHMOD/CHMOD-ok.cmake b/Tests/RunCMake/file-CHMOD/CHMOD-ok.cmake new file mode 100644 index 0000000..87e3e57 --- /dev/null +++ b/Tests/RunCMake/file-CHMOD/CHMOD-ok.cmake @@ -0,0 +1,5 @@ +file(REMOVE_RECURSE ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests) +file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests) + +file(TOUCH ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests/a) +file(CHMOD ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests/a PERMISSIONS OWNER_READ) diff --git a/Tests/RunCMake/file-CHMOD/CHMOD-override.cmake b/Tests/RunCMake/file-CHMOD/CHMOD-override.cmake new file mode 100644 index 0000000..d9226b8 --- /dev/null +++ b/Tests/RunCMake/file-CHMOD/CHMOD-override.cmake @@ -0,0 +1,6 @@ +file(REMOVE_RECURSE ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests) +file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests) + +file(TOUCH ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests/a) +file(CHMOD ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests/a PERMISSIONS OWNER_READ + FILE_PERMISSIONS OWNER_READ OWNER_WRITE) diff --git a/Tests/RunCMake/file-CHMOD/CHMOD-write-only-result.txt b/Tests/RunCMake/file-CHMOD/CHMOD-write-only-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/file-CHMOD/CHMOD-write-only-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/file-CHMOD/CHMOD-write-only-stderr.txt b/Tests/RunCMake/file-CHMOD/CHMOD-write-only-stderr.txt new file mode 100644 index 0000000..1c87a59 --- /dev/null +++ b/Tests/RunCMake/file-CHMOD/CHMOD-write-only-stderr.txt @@ -0,0 +1,6 @@ +CMake Error at CHMOD-write-only\.cmake:[0-9]+ \(file\): + file failed to open for reading \(Permission denied\): + + .*/chmod-tests/a +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/file-CHMOD/CHMOD-write-only.cmake b/Tests/RunCMake/file-CHMOD/CHMOD-write-only.cmake new file mode 100644 index 0000000..1289efc --- /dev/null +++ b/Tests/RunCMake/file-CHMOD/CHMOD-write-only.cmake @@ -0,0 +1,6 @@ +file(REMOVE_RECURSE ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests) +file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests) + +file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests/a "CONTENT") +file(CHMOD ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests/a PERMISSIONS OWNER_WRITE) +file(READ ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests/a content) diff --git a/Tests/RunCMake/file-CHMOD/CMakeLists.txt b/Tests/RunCMake/file-CHMOD/CMakeLists.txt new file mode 100644 index 0000000..2897109 --- /dev/null +++ b/Tests/RunCMake/file-CHMOD/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-CHMOD/RunCMakeTest.cmake b/Tests/RunCMake/file-CHMOD/RunCMakeTest.cmake new file mode 100644 index 0000000..c7bff15 --- /dev/null +++ b/Tests/RunCMake/file-CHMOD/RunCMakeTest.cmake @@ -0,0 +1,19 @@ +include(RunCMake) + +run_cmake(CHMOD-no-perms) +run_cmake(CHMOD-no-keyword) +run_cmake(CHMOD-all-perms) +run_cmake(CHMOD-invalid-perms) +run_cmake(CHMOD-invalid-path) +run_cmake(CHMOD-ok) +run_cmake(CHMOD-override) + +if(UNIX) + execute_process(COMMAND id -u $ENV{USER} + OUTPUT_VARIABLE uid + OUTPUT_STRIP_TRAILING_WHITESPACE) +endif() + +if(NOT WIN32 AND NOT "${uid}" STREQUAL "0") + run_cmake(CHMOD-write-only) +endif() |