mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-11 08:20:18 -06:00
Tests/RunCMake: Set $ENV{PWD} before each test
This will more accurately emulate how a shell would run CMake.
Also, don't set $ENV{PWD} in Tests/RunCMake/SymlinkTrees, since RunCMake is
now already doing this.
This commit is contained in:
@@ -145,7 +145,19 @@ function(run_cmake test)
|
||||
${maybe_timeout}
|
||||
${maybe_input_file}
|
||||
)]])
|
||||
if(DEFINED ENV{PWD})
|
||||
set(old_pwd "$ENV{PWD}")
|
||||
else()
|
||||
set(old_pwd)
|
||||
endif()
|
||||
# Emulate a shell using this directory.
|
||||
set(ENV{PWD} "${RunCMake_TEST_COMMAND_WORKING_DIRECTORY}")
|
||||
cmake_language(EVAL CODE "${_code}")
|
||||
if(DEFINED old_pwd)
|
||||
set(ENV{PWD} "${old_pwd}")
|
||||
else()
|
||||
set(ENV{PWD})
|
||||
endif()
|
||||
set(msg "")
|
||||
if(NOT "${actual_result}" MATCHES "${expect_result}")
|
||||
string(APPEND msg "Result is [${actual_result}], not [${expect_result}].\n")
|
||||
|
||||
@@ -29,8 +29,6 @@ function (run_symlink_test case src bin src_from_bin bin_from_src)
|
||||
|
||||
# Test running in binary directory.
|
||||
set(RunCMake_TEST_COMMAND_WORKING_DIRECTORY "${RunCMake_TEST_BINARY_DIR}")
|
||||
# Emulate a shell using this directory.
|
||||
set(ENV{PWD} "${RunCMake_TEST_COMMAND_WORKING_DIRECTORY}")
|
||||
|
||||
# Pass absolute path to the source tree, plain.
|
||||
set(RunCMake_TEST_VARIANT_DESCRIPTION " $abs/${name}/${src}")
|
||||
@@ -50,8 +48,6 @@ function (run_symlink_test case src bin src_from_bin bin_from_src)
|
||||
|
||||
# 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}")
|
||||
@@ -63,8 +59,6 @@ function (run_symlink_test case src bin src_from_bin 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}")
|
||||
|
||||
Reference in New Issue
Block a user