mirror of
https://github.com/boykopovar/AnyPS5.git
synced 2026-10-29 12:15:39 +00:00
fix(relinker): keep test artifacts in the build tree
The tests build their working directories with tempfile.TemporaryDirectory() and std::filesystem::temp_directory_path(), so every executable they generate lands in the user's system temp directory. On Windows, Microsoft Defender quarantines those generated binaries as Trojan:Win32/Wacatac.H!ml, and the nine tests that run one fail with WinError 5 (access denied) on a clean checkout: autorun_exit_status, optional_plt, empty_tls, tls_function_coverage, executable_segments, windows_icon, guest_needed_modules, guest_module_directories and windows_import_modules. Point TMPDIR, TEMP and TMP at a build-local directory for every test registered here, so generated executables stay inside the build tree. Test artifacts are then removed with the build directory, and a contributor who needs an antivirus exclusion can scope it to the build tree instead of the system temp directory.
This commit is contained in:
1 parent
51cee90311
commit
39dd854c84
1 file changed
+6
@@ -735,6 +735,12 @@ if(BUILD_TESTING)
|
||||
)
|
||||
add_test(NAME reloc_table_bounds COMMAND reloc_table_bounds_tests $<TARGET_FILE:relinker>)
|
||||
endif()
|
||||
|
||||
set(relinkerTestTemp ${CMAKE_CURRENT_BINARY_DIR}/test-temp)
|
||||
file(MAKE_DIRECTORY ${relinkerTestTemp})
|
||||
get_property(relinkerTests DIRECTORY PROPERTY TESTS)
|
||||
set_tests_properties(${relinkerTests} PROPERTIES ENVIRONMENT_MODIFICATION
|
||||
"TMPDIR=set:${relinkerTestTemp};TEMP=set:${relinkerTestTemp};TMP=set:${relinkerTestTemp}")
|
||||
endif()
|
||||
|
||||
if(BUILD_TESTING AND Python3_Interpreter_FOUND)
|
||||
|
||||
Reference in new issue
Block a user