diff options
author | Kyle Edwards <kyle.edwards@kitware.com> | 2018-12-05 20:27:08 (GMT) |
---|---|---|
committer | Kyle Edwards <kyle.edwards@kitware.com> | 2018-12-06 15:11:51 (GMT) |
commit | 98a39be6cfb7b229ff78f7045c6d5bcd6b6c7509 (patch) | |
tree | 1f9810b45b6d79710d89457d2db530cf5be24613 /Tests/RunCMake/file | |
parent | 81bea69bd1d52977c3782d26560f34563394f487 (diff) | |
download | CMake-98a39be6cfb7b229ff78f7045c6d5bcd6b6c7509.zip CMake-98a39be6cfb7b229ff78f7045c6d5bcd6b6c7509.tar.gz CMake-98a39be6cfb7b229ff78f7045c6d5bcd6b6c7509.tar.bz2 |
file: Add READ_SYMLINK sub-command
Diffstat (limited to 'Tests/RunCMake/file')
-rw-r--r-- | Tests/RunCMake/file/READ_SYMLINK-noexist-result.txt | 1 | ||||
-rw-r--r-- | Tests/RunCMake/file/READ_SYMLINK-noexist-stderr.txt | 6 | ||||
-rw-r--r-- | Tests/RunCMake/file/READ_SYMLINK-noexist.cmake | 1 | ||||
-rw-r--r-- | Tests/RunCMake/file/READ_SYMLINK-notsymlink-result.txt | 1 | ||||
-rw-r--r-- | Tests/RunCMake/file/READ_SYMLINK-notsymlink-stderr.txt | 6 | ||||
-rw-r--r-- | Tests/RunCMake/file/READ_SYMLINK-notsymlink.cmake | 2 | ||||
-rw-r--r-- | Tests/RunCMake/file/READ_SYMLINK.cmake | 13 | ||||
-rw-r--r-- | Tests/RunCMake/file/RunCMakeTest.cmake | 3 |
8 files changed, 33 insertions, 0 deletions
diff --git a/Tests/RunCMake/file/READ_SYMLINK-noexist-result.txt b/Tests/RunCMake/file/READ_SYMLINK-noexist-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/file/READ_SYMLINK-noexist-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/file/READ_SYMLINK-noexist-stderr.txt b/Tests/RunCMake/file/READ_SYMLINK-noexist-stderr.txt new file mode 100644 index 0000000..32b3e85 --- /dev/null +++ b/Tests/RunCMake/file/READ_SYMLINK-noexist-stderr.txt @@ -0,0 +1,6 @@ +^CMake Error at READ_SYMLINK-noexist\.cmake:[0-9]+ \(file\): + file READ_SYMLINK requested of path that is not a symlink: + + .*/Tests/RunCMake/file/READ_SYMLINK-noexist-build/rel\.sym +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/file/READ_SYMLINK-noexist.cmake b/Tests/RunCMake/file/READ_SYMLINK-noexist.cmake new file mode 100644 index 0000000..9e57e4b --- /dev/null +++ b/Tests/RunCMake/file/READ_SYMLINK-noexist.cmake @@ -0,0 +1 @@ +file(READ_SYMLINK "${CMAKE_CURRENT_BINARY_DIR}/rel.sym" result) diff --git a/Tests/RunCMake/file/READ_SYMLINK-notsymlink-result.txt b/Tests/RunCMake/file/READ_SYMLINK-notsymlink-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/file/READ_SYMLINK-notsymlink-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/file/READ_SYMLINK-notsymlink-stderr.txt b/Tests/RunCMake/file/READ_SYMLINK-notsymlink-stderr.txt new file mode 100644 index 0000000..63e32ed --- /dev/null +++ b/Tests/RunCMake/file/READ_SYMLINK-notsymlink-stderr.txt @@ -0,0 +1,6 @@ +^CMake Error at READ_SYMLINK-notsymlink\.cmake:[0-9]+ \(file\): + file READ_SYMLINK requested of path that is not a symlink: + + .*/Tests/RunCMake/file/READ_SYMLINK-notsymlink-build/rel\.sym +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/file/READ_SYMLINK-notsymlink.cmake b/Tests/RunCMake/file/READ_SYMLINK-notsymlink.cmake new file mode 100644 index 0000000..a9798b6 --- /dev/null +++ b/Tests/RunCMake/file/READ_SYMLINK-notsymlink.cmake @@ -0,0 +1,2 @@ +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/rel.sym" "") +file(READ_SYMLINK "${CMAKE_CURRENT_BINARY_DIR}/rel.sym" result) diff --git a/Tests/RunCMake/file/READ_SYMLINK.cmake b/Tests/RunCMake/file/READ_SYMLINK.cmake new file mode 100644 index 0000000..865a2e9 --- /dev/null +++ b/Tests/RunCMake/file/READ_SYMLINK.cmake @@ -0,0 +1,13 @@ +execute_process(COMMAND + ${CMAKE_COMMAND} -E create_symlink "test.txt" "${CMAKE_CURRENT_BINARY_DIR}/rel.sym") +file(READ_SYMLINK "${CMAKE_CURRENT_BINARY_DIR}/rel.sym" result) +if(NOT result STREQUAL "test.txt") + message(SEND_ERROR "Relative symlink is \"${result}\", should be \"test.txt\"") +endif() + +execute_process(COMMAND + ${CMAKE_COMMAND} -E create_symlink "${CMAKE_CURRENT_BINARY_DIR}/test.txt" "${CMAKE_CURRENT_BINARY_DIR}/abs.sym") +file(READ_SYMLINK "${CMAKE_CURRENT_BINARY_DIR}/abs.sym" result) +if(NOT result MATCHES "^.*/Tests/RunCMake/file/READ_SYMLINK-build/test\\.txt$") + message(SEND_ERROR "Absolute symlink is \"${result}\", should be \"*/Tests/RunCMake/file/READ_SYMLINK-build/test.txt\"") +endif() diff --git a/Tests/RunCMake/file/RunCMakeTest.cmake b/Tests/RunCMake/file/RunCMakeTest.cmake index b9d76bf..b872824 100644 --- a/Tests/RunCMake/file/RunCMakeTest.cmake +++ b/Tests/RunCMake/file/RunCMakeTest.cmake @@ -55,6 +55,9 @@ run_cmake_command(GLOB-error-CONFIGURE_DEPENDS-SCRIPT_MODE ${CMAKE_COMMAND} -P if(NOT WIN32 OR CYGWIN) run_cmake(GLOB_RECURSE-cyclic-recursion) run_cmake(INSTALL-SYMLINK) + run_cmake(READ_SYMLINK) + run_cmake(READ_SYMLINK-noexist) + run_cmake(READ_SYMLINK-notsymlink) endif() if(RunCMake_GENERATOR STREQUAL "Ninja") |