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.
This commit is contained in:
Martin Duffy
2025-01-15 16:15:27 -05:00
parent 0410dfbe76
commit 5f523333be
2 changed files with 16 additions and 2 deletions

View File

@@ -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)
@@ -134,13 +134,23 @@ file(MAKE_DIRECTORY "${RunCMake_BINARY_DIR}/common_real/source/binary")
file(CREATE_LINK "common_real" "${RunCMake_BINARY_DIR}/common" SYMBOLIC)
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)

View File

@@ -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'