Use --><-- markers to denote the path
This commit is contained in:
parent
5249551f9f
commit
992c74f3e0
|
@ -11,21 +11,21 @@ add_test(WorkingDirectory3 WorkingDirectory)
|
||||||
|
|
||||||
set_tests_properties(WorkingDirectory1 PROPERTIES
|
set_tests_properties(WorkingDirectory1 PROPERTIES
|
||||||
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}"
|
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}"
|
||||||
PASS_REGULAR_EXPRESSION "Working directory: ${CMAKE_BINARY_DIR}"
|
PASS_REGULAR_EXPRESSION "Working directory: -->${CMAKE_BINARY_DIR}<--"
|
||||||
)
|
)
|
||||||
|
|
||||||
string(REGEX REPLACE "/[^/]*$" "" _parent_dir "${CMAKE_BINARY_DIR}")
|
string(REGEX REPLACE "/[^/]*$" "" _parent_dir "${CMAKE_BINARY_DIR}")
|
||||||
|
|
||||||
set_tests_properties(WorkingDirectory2 PROPERTIES
|
set_tests_properties(WorkingDirectory2 PROPERTIES
|
||||||
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/.."
|
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/.."
|
||||||
PASS_REGULAR_EXPRESSION "Working directory: ${_parent_dir}"
|
PASS_REGULAR_EXPRESSION "Working directory: -->${_parent_dir}<--"
|
||||||
)
|
)
|
||||||
|
|
||||||
string(REGEX REPLACE "/[^/]*$" "" _wd_exe "${CMAKE_BINARY_DIR}")
|
string(REGEX REPLACE "/[^/]*$" "" _wd_exe "${CMAKE_BINARY_DIR}")
|
||||||
get_filename_component(_default_cwd "${_wd_exe}" ABSOLUTE)
|
get_filename_component(_default_cwd "${_wd_exe}" ABSOLUTE)
|
||||||
|
|
||||||
set_tests_properties(WorkingDirectory3 PROPERTIES
|
set_tests_properties(WorkingDirectory3 PROPERTIES
|
||||||
PASS_REGULAR_EXPRESSION "Working directory: ${_default_cwd}"
|
PASS_REGULAR_EXPRESSION "Working directory: -->${_default_cwd}<--"
|
||||||
)
|
)
|
||||||
|
|
||||||
add_test(NAME WorkingDirectory4 WORKING_DIRECTORY ${CMAKE_BINARY_DIR} COMMAND WorkingDirectory)
|
add_test(NAME WorkingDirectory4 WORKING_DIRECTORY ${CMAKE_BINARY_DIR} COMMAND WorkingDirectory)
|
||||||
|
@ -33,18 +33,18 @@ add_test(NAME WorkingDirectory5 WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/.. COMMAND
|
||||||
add_test(WorkingDirectory6 WorkingDirectory WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/..)
|
add_test(WorkingDirectory6 WorkingDirectory WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/..)
|
||||||
|
|
||||||
set_tests_properties(WorkingDirectory4 PROPERTIES
|
set_tests_properties(WorkingDirectory4 PROPERTIES
|
||||||
PASS_REGULAR_EXPRESSION "Working directory: ${CMAKE_BINARY_DIR}"
|
PASS_REGULAR_EXPRESSION "Working directory: -->${CMAKE_BINARY_DIR}<--"
|
||||||
)
|
)
|
||||||
|
|
||||||
string(REGEX REPLACE "/[^/]*$" "" _parent_dir "${CMAKE_BINARY_DIR}")
|
string(REGEX REPLACE "/[^/]*$" "" _parent_dir "${CMAKE_BINARY_DIR}")
|
||||||
|
|
||||||
set_tests_properties(WorkingDirectory5 PROPERTIES
|
set_tests_properties(WorkingDirectory5 PROPERTIES
|
||||||
PASS_REGULAR_EXPRESSION "Working directory: ${_parent_dir}"
|
PASS_REGULAR_EXPRESSION "Working directory: -->${_parent_dir}<--"
|
||||||
)
|
)
|
||||||
|
|
||||||
string(REGEX REPLACE "/[^/]*$" "" _wd_exe "${CMAKE_BINARY_DIR}")
|
string(REGEX REPLACE "/[^/]*$" "" _wd_exe "${CMAKE_BINARY_DIR}")
|
||||||
get_filename_component(_default_cwd "${_wd_exe}" ABSOLUTE)
|
get_filename_component(_default_cwd "${_wd_exe}" ABSOLUTE)
|
||||||
|
|
||||||
set_tests_properties(WorkingDirectory6 PROPERTIES
|
set_tests_properties(WorkingDirectory6 PROPERTIES
|
||||||
PASS_REGULAR_EXPRESSION "Working directory: ${_default_cwd}"
|
PASS_REGULAR_EXPRESSION "Working directory: -->${_default_cwd}<--"
|
||||||
)
|
)
|
||||||
|
|
|
@ -59,7 +59,7 @@ int main(int argc, char *argv[])
|
||||||
char buf[2048];
|
char buf[2048];
|
||||||
const char *cwd = Getcwd(buf, sizeof(buf));
|
const char *cwd = Getcwd(buf, sizeof(buf));
|
||||||
|
|
||||||
fprintf(stdout, "Working directory: %s\n", cwd);
|
fprintf(stdout, "Working directory: -->%s<--", cwd);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue