From 5f523333be02c734b8dc5bdcc6226730c840e9b8 Mon Sep 17 00:00:00 2001 From: Martin Duffy Date: Wed, 15 Jan 2025 16:15:27 -0500 Subject: SymlinkTrees: Test building in one directory when CWD is a symlink to it Add a test verifying that the project build tree specified with -B is not converted to symlinked path when configured from a symlink to the provided build tree. --- Tests/RunCMake/SymlinkTrees/RunCMakeTest.cmake | 14 ++++++++++++-- .../SymlinkTrees/common-use_real_build_from_-B-stdout.txt | 4 ++++ 2 files changed, 16 insertions(+), 2 deletions(-) create mode 100644 Tests/RunCMake/SymlinkTrees/common-use_real_build_from_-B-stdout.txt diff --git a/Tests/RunCMake/SymlinkTrees/RunCMakeTest.cmake b/Tests/RunCMake/SymlinkTrees/RunCMakeTest.cmake index 12f004b..9aebc62 100644 --- a/Tests/RunCMake/SymlinkTrees/RunCMakeTest.cmake +++ b/Tests/RunCMake/SymlinkTrees/RunCMakeTest.cmake @@ -116,7 +116,7 @@ run_symlink_test(none-src_in_bin "binary/source" "binary" "source" "..") # .../common_real/binary # .../common -> common_real file(REMOVE_RECURSE "${RunCMake_BINARY_DIR}/common_real") -file(REMOVE "${RunCMake_BINARY_DIR}/common") +file(REMOVE_RECURSE "${RunCMake_BINARY_DIR}/common") file(MAKE_DIRECTORY "${RunCMake_BINARY_DIR}/common_real/source") file(MAKE_DIRECTORY "${RunCMake_BINARY_DIR}/common_real/binary") file(CREATE_LINK "common_real" "${RunCMake_BINARY_DIR}/common" SYMBOLIC) @@ -136,11 +136,21 @@ run_symlink_test(common-bin_in_src "source" "source/binary" ".." "binary") # Create the following structure: # +# .../common/real/source/binary +# .../common/link -> common/real +file(REMOVE_RECURSE "${RunCMake_BINARY_DIR}/common") +file(MAKE_DIRECTORY "${RunCMake_BINARY_DIR}/common/real/source/binary") +file(CREATE_LINK "${RunCMake_BINARY_DIR}/common/real" "${RunCMake_BINARY_DIR}/common/link" SYMBOLIC) +# Test that configure with -Bcommon/real/source/binary from within common/link has real CMAKE_BINARY_DIR +run_symlink_test(common-use_real_build_from_-B "link/source" "real/source/binary" "../../../link/source" "../../real/source/binary") + +# Create the following structure: +# # .../common_real/binary # .../common_real/binary/source # .../common -> common_real file(REMOVE_RECURSE "${RunCMake_BINARY_DIR}/common_real") -file(REMOVE "${RunCMake_BINARY_DIR}/common") +file(REMOVE_RECURSE "${RunCMake_BINARY_DIR}/common") file(MAKE_DIRECTORY "${RunCMake_BINARY_DIR}/common_real/binary") file(MAKE_DIRECTORY "${RunCMake_BINARY_DIR}/common_real/binary/source") file(CREATE_LINK "common_real" "${RunCMake_BINARY_DIR}/common" SYMBOLIC) diff --git a/Tests/RunCMake/SymlinkTrees/common-use_real_build_from_-B-stdout.txt b/Tests/RunCMake/SymlinkTrees/common-use_real_build_from_-B-stdout.txt new file mode 100644 index 0000000..05c47b4 --- /dev/null +++ b/Tests/RunCMake/SymlinkTrees/common-use_real_build_from_-B-stdout.txt @@ -0,0 +1,4 @@ +-- source: '[^']*/Tests/RunCMake/SymlinkTrees/common/link/source' +-- binary: '[^']*/Tests/RunCMake/SymlinkTrees/common/real/source/binary' +-- real source: '[^']*/Tests/RunCMake/SymlinkTrees/common/real/source' +-- real binary: '[^']*/Tests/RunCMake/SymlinkTrees/common/real/source/binary' -- cgit v0.12