upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/runtime/test/device_proxy_test.cpp
diff options
context:
space:
mode:
authorthiefyzheng <thiefyzheng@users.noreply.github.com>2026-11-25 05:33:21 +0000
committerWeiZheng Huang <thiefyzheng@users.noreply.github.com>2026-11-28 19:01:06 +0000
commitb17397f0dd77280e107de489fc0f2a92471ace60 (patch)
treeab3a56da6b81a758c308493f3871df746eb30f58 /runtime/test/device_proxy_test.cpp
parent54d27d98836ad90f62969f12179b92cbb0153859 (diff)
tests: derive every test's scratch folder from test_temp_dir::temp_dir, not GetTempPath (TEST-TEMPDIR-STRIPPED-ENV)
With TMP, TEMP and USERPROFILE all unset, GetTempPathW returns C:\Windows\, and the throwing create_directories/copy_file/ofstream on C:\Windows\leonida_* aborts with 0xc0000409 before the test body runs. runtime/test/test_temp_dir.h grows one entry, testfiles::temp_dir(): LEONIDA_TEST_DIR when set, the current directory when the temp environment is stripped (Windows), else the standard temp resolution. Fifty-two test files and the tiny_game fixture that called GetTempPathA/W or temp_directory_path directly now use it; d3d12_queue_handover_test.cpp also checks the _sopen_s result in capture_stderr instead of silently returning empty stderr. One runtime source function needed the same fallback because tests exercise it: tls_host_clone_dir in runtime/src/pe_loader.cpp (the loader_tls tests). Rebased onto current main after its D3D-448 additions to d3d12_mesh_test.cpp (3-way; the mesh test keeps both). Verification on a Windows VM: stripped environment - the previously crashing d3d12 tests exit 77 (no usable Vulkan device) instead of aborting, file_system_test runs all 505 checks and loader_test all 95 with zero failures; normal environment - identical outcomes; LEONIDA_TEST_DIR honored under a fully stripped environment (the scratch folder observed mid-run inside it, cleaned up after the pass). The finding is whoalin1's (coordination issue #14, 02:37:44Z). AI-assisted.
Diffstat (limited to 'runtime/test/device_proxy_test.cpp')
-rw-r--r--runtime/test/device_proxy_test.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/runtime/test/device_proxy_test.cpp b/runtime/test/device_proxy_test.cpp
index 5fae4621c..ddbd51494 100644
--- a/runtime/test/device_proxy_test.cpp
+++ b/runtime/test/device_proxy_test.cpp
@@ -11,6 +11,7 @@
11// slot 8/36 CreateCommandQueue/CreateFence (return queue and fence proxies that run GPU work) 11// slot 8/36 CreateCommandQueue/CreateFence (return queue and fence proxies that run GPU work)
12// Slot 9 on the device is CreateCommandAllocator on the PC vtable and must still forward, which proves the handle 12// Slot 9 on the device is CreateCommandAllocator on the PC vtable and must still forward, which proves the handle
13// getters were not wedged into the device slots. Console output also shows the proxy's first-call slot log. 13// getters were not wedged into the device slots. Console output also shows the proxy's first-call slot log.
14#include "test_temp_dir.h"
14#include <vector> 15#include <vector>
15#include <windows.h> 16#include <windows.h>
16#include <d3d12.h> 17#include <d3d12.h>
@@ -1296,7 +1297,7 @@ int main(int argc, char** argv) {
1296 // Synthetic test for ShaderLibrary loading `fspx_gfx/index.json` alongside `fspx/index.json` and `bvh/index.json` 1297 // Synthetic test for ShaderLibrary loading `fspx_gfx/index.json` alongside `fspx/index.json` and `bvh/index.json`
1297 // while keeping `fspx_size()`, `fspx_gfx_size()`, and `bvh_size()` independent. 1298 // while keeping `fspx_size()`, `fspx_gfx_size()`, and `bvh_size()` independent.
1298 wchar_t temp_root[MAX_PATH]{}; 1299 wchar_t temp_root[MAX_PATH]{};
1299 if (GetTempPathW(MAX_PATH, temp_root)) { 1300 if (wcscpy_s(temp_root, testfiles::temp_dir().c_str()) == 0) {
1300 const std::filesystem::path tmp_dir = 1301 const std::filesystem::path tmp_dir =
1301 std::filesystem::path(temp_root) / ("leonida_fspx_gfx_test_" + std::to_string(GetCurrentProcessId())); 1302 std::filesystem::path(temp_root) / ("leonida_fspx_gfx_test_" + std::to_string(GetCurrentProcessId()));
1302 std::error_code ec; 1303 std::error_code ec;