diff options
author | Brad King <brad.king@kitware.com> | 2020-07-16 14:18:51 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2020-07-16 14:19:12 (GMT) |
commit | c7b7547d8da6b9a4225d111440d0cf6c2f55914d (patch) | |
tree | e5ecbea753d879f1d7d8c7a2e9f58dffe3f8dc5f /Tests/RunCMake | |
parent | 4662c041eac50888d445a77ed091f395cafe61fe (diff) | |
parent | 2fad00940d7ed3c5928bda5b671bdcf08ce53bb8 (diff) | |
download | CMake-c7b7547d8da6b9a4225d111440d0cf6c2f55914d.zip CMake-c7b7547d8da6b9a4225d111440d0cf6c2f55914d.tar.gz CMake-c7b7547d8da6b9a4225d111440d0cf6c2f55914d.tar.bz2 |
Merge topic 'cmake-E-create_hardlink'
2fad00940d cmake: Add -E create_hardlink
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5015
Diffstat (limited to 'Tests/RunCMake')
10 files changed, 49 insertions, 0 deletions
diff --git a/Tests/RunCMake/CommandLine/E_create_hardlink-no-arg-result.txt b/Tests/RunCMake/CommandLine/E_create_hardlink-no-arg-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_create_hardlink-no-arg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CommandLine/E_create_hardlink-no-arg-stderr.txt b/Tests/RunCMake/CommandLine/E_create_hardlink-no-arg-stderr.txt new file mode 100644 index 0000000..50d9b03 --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_create_hardlink-no-arg-stderr.txt @@ -0,0 +1,3 @@ +^CMake Error: cmake version .* +Usage: .* -E <command> \[arguments\.\.\.\] +Available commands: diff --git a/Tests/RunCMake/CommandLine/E_create_hardlink-no-directory-result.txt b/Tests/RunCMake/CommandLine/E_create_hardlink-no-directory-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_create_hardlink-no-directory-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CommandLine/E_create_hardlink-no-directory-stderr.txt b/Tests/RunCMake/CommandLine/E_create_hardlink-no-directory-stderr.txt new file mode 100644 index 0000000..21e60ee --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_create_hardlink-no-directory-stderr.txt @@ -0,0 +1 @@ +^CMake Error: failed to create link .* no such file or directory diff --git a/Tests/RunCMake/CommandLine/E_create_hardlink-non-existent-source-result.txt b/Tests/RunCMake/CommandLine/E_create_hardlink-non-existent-source-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_create_hardlink-non-existent-source-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CommandLine/E_create_hardlink-non-existent-source-stderr.txt b/Tests/RunCMake/CommandLine/E_create_hardlink-non-existent-source-stderr.txt new file mode 100644 index 0000000..a334571 --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_create_hardlink-non-existent-source-stderr.txt @@ -0,0 +1 @@ +^failed to create hard link because source path .* does not exist diff --git a/Tests/RunCMake/CommandLine/E_create_hardlink-unresolved-symlink-prereq-check.cmake b/Tests/RunCMake/CommandLine/E_create_hardlink-unresolved-symlink-prereq-check.cmake new file mode 100644 index 0000000..5b97aec --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_create_hardlink-unresolved-symlink-prereq-check.cmake @@ -0,0 +1,3 @@ +if(${actual_stderr_var} MATCHES "operation not permitted") + unset(msg) +endif() diff --git a/Tests/RunCMake/CommandLine/E_create_hardlink-unresolved-symlink-result.txt b/Tests/RunCMake/CommandLine/E_create_hardlink-unresolved-symlink-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_create_hardlink-unresolved-symlink-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CommandLine/E_create_hardlink-unresolved-symlink-stderr.txt b/Tests/RunCMake/CommandLine/E_create_hardlink-unresolved-symlink-stderr.txt new file mode 100644 index 0000000..a334571 --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_create_hardlink-unresolved-symlink-stderr.txt @@ -0,0 +1 @@ +^failed to create hard link because source path .* does not exist diff --git a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake index 6d69945..b20e683 100644 --- a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake +++ b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake @@ -348,6 +348,42 @@ run_cmake_command(E_create_symlink-no-replace-dir ${CMAKE_COMMAND} -E create_symlink T . ) +#create hard link tests +run_cmake_command(E_create_hardlink-no-arg + ${CMAKE_COMMAND} -E create_hardlink + ) + +set(dir ${RunCMake_BINARY_DIR}/hardlink_tests) +file(REMOVE_RECURSE "${dir}") +file(MAKE_DIRECTORY ${dir}) + +run_cmake_command(E_create_hardlink-non-existent-source + ${CMAKE_COMMAND} -E create_hardlink ${dir}/I_dont_exist ${dir}/link + ) + +file(TOUCH ${dir}/1) + +run_cmake_command(E_create_hardlink-ok + ${CMAKE_COMMAND} -E create_hardlink ${dir}/1 ${dir}/1-link + ) + +run_cmake_command(E_create_hardlink-no-directory + ${CMAKE_COMMAND} -E create_hardlink ${dir}/1 ${dir}/a/1-link + ) + +#On Windows, if the user does not have sufficient privileges +#don't fail this test +set(RunCMake_DEFAULT_stderr "(operation not permitted)?") +run_cmake_command(E_create_hardlink-unresolved-symlink-prereq + ${CMAKE_COMMAND} -E create_symlink ${dir}/1 ${dir}/1-symlink + ) +file(REMOVE ${dir}/1) + +run_cmake_command(E_create_hardlink-unresolved-symlink + ${CMAKE_COMMAND} -E create_hardlink ${dir}/1-symlink ${dir}/1s-link + ) +unset(RunCMake_DEFAULT_stderr) + set(in ${RunCMake_SOURCE_DIR}/copy_input) set(out ${RunCMake_BINARY_DIR}/copy_output) file(REMOVE_RECURSE "${out}") |