From 6614543316e8a5483c8163b5d35f398f05e2f964 Mon Sep 17 00:00:00 2001 From: erw7 Date: Fri, 19 Jul 2019 20:51:18 +0900 Subject: [PATCH] test: Force $TEST_FILE to relative path [ci skip] #10535 - Always force TEST_PATH to a relative path. - Eliminate rel_test_path. (The code simplification is worth the extra subdirectory below Xtest_tmpdir/.) --- cmake/RunTests.cmake | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/cmake/RunTests.cmake b/cmake/RunTests.cmake index 5406a07fc8..16ac22ced4 100644 --- a/cmake/RunTests.cmake +++ b/cmake/RunTests.cmake @@ -16,10 +16,13 @@ endif() if(DEFINED ENV{TEST_FILE}) set(TEST_PATH "$ENV{TEST_FILE}") - set(rel_test_path "${TEST_PATH}") else() set(TEST_PATH "${TEST_DIR}/${TEST_TYPE}") - file(RELATIVE_PATH rel_test_path "${TEST_DIR}" "${TEST_PATH}") +endif() + +# Force $TEST_PATH to workdir-relative path ("test/…"). +if(IS_ABSOLUTE ${TEST_PATH}) + file(RELATIVE_PATH TEST_PATH "${WORKING_DIR}" "${TEST_PATH}") endif() if(BUSTED_OUTPUT_TYPE STREQUAL junit) @@ -38,7 +41,7 @@ if(DEFINED ENV{TEST_FILTER} AND NOT "$ENV{TEST_FILTER}" STREQUAL "") endif() # TMPDIR: use relative test path (for parallel test runs / isolation). -set(ENV{TMPDIR} "${BUILD_DIR}/Xtest_tmpdir/${rel_test_path}") +set(ENV{TMPDIR} "${BUILD_DIR}/Xtest_tmpdir/${TEST_PATH}") execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory $ENV{TMPDIR}) set(ENV{SYSTEM_NAME} ${CMAKE_HOST_SYSTEM_NAME}) # used by test/helpers.lua.