diff options
| author | thiefyzheng <thiefyzheng@users.noreply.github.com> | 2026-11-25 05:33:21 +0000 |
|---|---|---|
| committer | WeiZheng Huang <thiefyzheng@users.noreply.github.com> | 2026-11-28 19:01:06 +0000 |
| commit | b17397f0dd77280e107de489fc0f2a92471ace60 (patch) | |
| tree | ab3a56da6b81a758c308493f3871df746eb30f58 /runtime/test/large_module_gate_test.cpp | |
| parent | 54d27d98836ad90f62969f12179b92cbb0153859 (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/large_module_gate_test.cpp')
| -rw-r--r-- | runtime/test/large_module_gate_test.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/runtime/test/large_module_gate_test.cpp b/runtime/test/large_module_gate_test.cpp index ce39ec88f..26fabd548 100644 --- a/runtime/test/large_module_gate_test.cpp +++ b/runtime/test/large_module_gate_test.cpp | |||
| @@ -1,4 +1,5 @@ | |||
| 1 | // vk_pipeline_check's memory budget for large modules (large_module_gate.h), without a Vulkan device. | 1 | // vk_pipeline_check's memory budget for large modules (large_module_gate.h), without a Vulkan device. |
| 2 | #include "test_temp_dir.h" | ||
| 2 | #include "large_module_gate.h" | 3 | #include "large_module_gate.h" |
| 3 | 4 | ||
| 4 | #include <atomic> | 5 | #include <atomic> |
| @@ -270,7 +271,7 @@ static int cgroup_limits_are_read_up_the_tree() { | |||
| 270 | // Before: only MemAvailable was read, so under systemd-run -p MemoryMax=... (or in a container) the budget was | 271 | // Before: only MemAvailable was read, so under systemd-run -p MemoryMax=... (or in a container) the budget was |
| 271 | // the whole machine's and the checker could be killed by its own cgroup. | 272 | // the whole machine's and the checker could be killed by its own cgroup. |
| 272 | namespace fs = std::filesystem; | 273 | namespace fs = std::filesystem; |
| 273 | const fs::path root = fs::temp_directory_path() / ("lmg_test_" + std::to_string(::getpid())); | 274 | const fs::path root = testfiles::temp_dir() / ("lmg_test_" + std::to_string(::getpid())); |
| 274 | fs::remove_all(root); | 275 | fs::remove_all(root); |
| 275 | write_file(root / "self", "0::/user.slice/app.scope\n"); | 276 | write_file(root / "self", "0::/user.slice/app.scope\n"); |
| 276 | write_file(root / "cg/user.slice/memory.max", "10000\n"); | 277 | write_file(root / "cg/user.slice/memory.max", "10000\n"); |