diff options
author | Brad King <brad.king@kitware.com> | 2019-08-30 14:38:17 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2019-08-30 14:38:25 (GMT) |
commit | a38965db9a515c0f8af9035d6cca13cf684b406a (patch) | |
tree | 2e30c7128deb1e0265405a6c50fc951f9e577f5b /Tests/RunCMake | |
parent | f8917685f32677c4055176d96bbd5a747da03fdb (diff) | |
parent | e6c9a8bac3a2f3103ee79058e92dadd2d30c8ac5 (diff) | |
download | CMake-a38965db9a515c0f8af9035d6cca13cf684b406a.zip CMake-a38965db9a515c0f8af9035d6cca13cf684b406a.tar.gz CMake-a38965db9a515c0f8af9035d6cca13cf684b406a.tar.bz2 |
Merge topic 'remove_directory-symlink'
e6c9a8bac3 cmake: Teach -E remove_directory to remove directory symlinks
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !3738
Diffstat (limited to 'Tests/RunCMake')
5 files changed, 23 insertions, 0 deletions
diff --git a/Tests/RunCMake/CommandLine/E_remove_directory-symlink-dir-check.cmake b/Tests/RunCMake/CommandLine/E_remove_directory-symlink-dir-check.cmake new file mode 100644 index 0000000..f70312c --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_remove_directory-symlink-dir-check.cmake @@ -0,0 +1,6 @@ +if(EXISTS ${out}/link_dir) + set(RunCMake_TEST_FAILED "did not remove ${out}/link_dir") +endif() +if(NOT EXISTS ${out}/dir) + set(RunCMake_TEST_FAILED "should not have removed ${out}/dir") +endif() diff --git a/Tests/RunCMake/CommandLine/E_remove_directory-symlink-dir-stderr.txt b/Tests/RunCMake/CommandLine/E_remove_directory-symlink-dir-stderr.txt new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_remove_directory-symlink-dir-stderr.txt diff --git a/Tests/RunCMake/CommandLine/E_remove_directory-symlink-file-check.cmake b/Tests/RunCMake/CommandLine/E_remove_directory-symlink-file-check.cmake new file mode 100644 index 0000000..23d7c6d --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_remove_directory-symlink-file-check.cmake @@ -0,0 +1,6 @@ +if(NOT EXISTS ${outfile}) + set(RunCMake_TEST_FAILED "removed non-directory ${outfile}") +endif() +if(NOT EXISTS ${out}/link_file_for_test.txt) + set(RunCMake_TEST_FAILED "removed non-directory symlink ${out}/link_file_for_test.txt") +endif() diff --git a/Tests/RunCMake/CommandLine/E_remove_directory-symlink-file-stderr.txt b/Tests/RunCMake/CommandLine/E_remove_directory-symlink-file-stderr.txt new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_remove_directory-symlink-file-stderr.txt diff --git a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake index 71a3843..efd1cc2 100644 --- a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake +++ b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake @@ -348,6 +348,17 @@ run_cmake_command(E_make_directory-two-directories-and-file ${CMAKE_COMMAND} -E make_directory ${out}/d1 ${out}/d2 ${outfile}) run_cmake_command(E_remove_directory-two-directories-and-file ${CMAKE_COMMAND} -E remove_directory ${out}/d1 ${out}/d2 ${outfile}) + +if(UNIX) + file(MAKE_DIRECTORY ${out}/dir) + file(CREATE_LINK ${out}/dir ${out}/link_dir SYMBOLIC) + file(CREATE_LINK ${outfile} ${out}/link_file_for_test.txt SYMBOLIC) + run_cmake_command(E_remove_directory-symlink-dir + ${CMAKE_COMMAND} -E remove_directory ${out}/link_dir) + run_cmake_command(E_remove_directory-symlink-file + ${CMAKE_COMMAND} -E remove_directory ${out}/link_file_for_test.txt) +endif() + unset(out) unset(outfile) |