diff options
author | Brad King <brad.king@kitware.com> | 2022-02-23 22:09:45 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2022-02-24 18:47:43 (GMT) |
commit | b0ac0fbe0eac590233cb94b3124239a491ee2a9b (patch) | |
tree | 69678492e9bde4f183b7b3999db56ee415d9549e /Tests/RunCMake | |
parent | 6c971b5e936281cb3d9565332a07c116b183bbc6 (diff) | |
download | CMake-b0ac0fbe0eac590233cb94b3124239a491ee2a9b.zip CMake-b0ac0fbe0eac590233cb94b3124239a491ee2a9b.tar.gz CMake-b0ac0fbe0eac590233cb94b3124239a491ee2a9b.tar.bz2 |
Tests: Extend RunCMake.SymlinkTrees with directory argument variants
Run each symlink layout case with various ways to pass the source
and binary directories.
Diffstat (limited to 'Tests/RunCMake')
-rw-r--r-- | Tests/RunCMake/SymlinkTrees/RunCMakeTest.cmake | 46 |
1 files changed, 44 insertions, 2 deletions
diff --git a/Tests/RunCMake/SymlinkTrees/RunCMakeTest.cmake b/Tests/RunCMake/SymlinkTrees/RunCMakeTest.cmake index 8c2ee04..02989ab 100644 --- a/Tests/RunCMake/SymlinkTrees/RunCMakeTest.cmake +++ b/Tests/RunCMake/SymlinkTrees/RunCMakeTest.cmake @@ -11,7 +11,7 @@ endfunction() # This function assumes that ``${RunCMake_BINARY_DIR}/${name}/source`` and # ``${RunCMake_BINARY_DIR}/${name}/binary`` are set up properly prior to # calling it. -function (run_symlink_test case src bin) +function (run_symlink_test case src bin src_from_bin bin_from_src) string(REGEX REPLACE "-.*" "" name "${case}") set(RunCMake_TEST_NO_CLEAN TRUE) set(RunCMake_TEST_SOURCE_DIR "${RunCMake_BINARY_DIR}/${name}/${src}") @@ -32,6 +32,48 @@ function (run_symlink_test case src bin) # Pass absolute path to the source tree, plain. set(RunCMake_TEST_VARIANT_DESCRIPTION " $abs/${name}/${src}") run_symlink_test_case("${case}" "${RunCMake_TEST_SOURCE_DIR}") + + # Pass absolute path to the source tree, with -S. + set(RunCMake_TEST_VARIANT_DESCRIPTION " -S $abs/${name}/${src}") + run_symlink_test_case("${case}" -S "${RunCMake_TEST_SOURCE_DIR}") + + # Pass relative path to the source tree, plain. + set(RunCMake_TEST_VARIANT_DESCRIPTION " ${src_from_bin}") + run_symlink_test_case("${case}" "${src_from_bin}") + + # Pass relative path to the source tree, with -S. + set(RunCMake_TEST_VARIANT_DESCRIPTION " -S ${src_from_bin}") + run_symlink_test_case("${case}" -S "${src_from_bin}") + + # Test running in source directory. + set(RunCMake_TEST_COMMAND_WORKING_DIRECTORY "${RunCMake_TEST_SOURCE_DIR}") + # Emulate a shell using this directory. + set(ENV{PWD} "${RunCMake_TEST_COMMAND_WORKING_DIRECTORY}") + + # Pass absolute path to the binary tree with -B. + set(RunCMake_TEST_VARIANT_DESCRIPTION " -B $abs/${name}/${bin}") + run_symlink_test_case("${case}" -B "${RunCMake_TEST_BINARY_DIR}") + + # Pass relative path to the binary tree with -B. + set(RunCMake_TEST_VARIANT_DESCRIPTION " -B ${bin_from_src}") + run_symlink_test_case("${case}" -B "${bin_from_src}") + + # Test running in another directory. + set(RunCMake_TEST_COMMAND_WORKING_DIRECTORY "${RunCMake_BINARY_DIR}/${name}") + # Emulate a shell using this directory. + set(ENV{PWD} "${RunCMake_TEST_COMMAND_WORKING_DIRECTORY}") + + # Pass absolute paths to the source and binary trees. + set(RunCMake_TEST_VARIANT_DESCRIPTION " -S $abs/${name}/${src} -B $abs/${name}/${bin}") + run_symlink_test_case("${case}" -S "${RunCMake_TEST_SOURCE_DIR}" -B "${RunCMake_TEST_BINARY_DIR}") + + # Pass relative paths to the source and binary trees. + set(RunCMake_TEST_VARIANT_DESCRIPTION " -S ${src} -B ${bin}") + run_symlink_test_case("${case}" -S "${src}" -B "${bin}") + + # Pass relative paths to the source and binary trees. + set(RunCMake_TEST_VARIANT_DESCRIPTION " -S ../${name}/${src} -B ../${name}/${bin}") + run_symlink_test_case("${case}" -S "../${name}/${src}" -B "../${name}/${bin}") endfunction () # Create the following structure: @@ -44,4 +86,4 @@ file(REMOVE "${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) -run_symlink_test(common-separate "source" "binary") +run_symlink_test(common-separate "source" "binary" "../source" "../binary") |