test(agc): replace the nothrow allocation forms in the test hooks #21336
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/21336"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by chitters2004 on 2026-11-16T05:21:37Z.
What
Five AGC test files replace the global
operator newandoperator deleteso they can count allocations or make one fail:tests/AllocationFailure.cpp(linked intoagc_buffer_pool_tests,agc_reference_storage_tests,agc_snapshot_copy_failure_tests,agc_pipeline_cache_allocation_tests,agc_command_batch_failure_testsandagc_pipeline_queue_failure_tests),tests/DescriptorCacheFailure.cpp,tests/DepthSurfaceReuse.cpp(inagc_driver_graphics_tests, glibc only),tests/ShaderMemory.cppandtests/execution/DrawAllocations.cpp. They routenewtomallocand everydeletetofree. All butDrawAllocations.cppleaveoperator new(std::size_t, const std::nothrow_t&)in place, andShaderMemory.cppreplaces that one but not the matching nothrowdelete.std::stable_sorttakes its temporary buffer through the nothrownewand gives it back through the sizeddelete. Without a sanitizer the library's nothrownewcalls the replacednew, so both sides end inmallocandfree. Under AddressSanitizer the nothrownewis the sanitizer's own and allocates from its heap, so the replaceddeletehands that block tofreeand the run aborts withalloc-dealloc-mismatch (operator new vs free). #16753's retention test is the first to reach this under ASan, through thestd::stable_sortinPlanVertexCopies.Each set now also replaces the nothrow forms. The counting sets in
DepthSurfaceReuse.cppandShaderMemory.cpproute the nothrownewthrough their countingnew, so the census counts it. The failure-injection sets inAllocationFailure.cppandDescriptorCacheFailure.cppcallmallocdirectly, so their countdowns still fail the same allocations. No set replaces an aligneddelete, so the aligned forms stay paired with the sanitizer's.agc_reference_storage_testsand the depth surface reuse tests now start with astd::stable_sortover 1,024 elements, enough to take the temporary buffer.Tested
Linux, GCC 13. Negative control, without the fix:
tests/ReferenceStorage.cppwith the new sort check,Graphics/src/ReferenceStorage.cppandtests/AllocationFailure.cpp, built frommainwith-fsanitize=address, abort in the new check withAddressSanitizer: alloc-dealloc-mismatch (operator new vs free). The stack goes throughstd::__stable_sort. With the fix the same build printsreference storage tests passedunder ASan and without a sanitizer. Fork CI on this head (run 43803755473): the Linux lavapipe gate and Windows pass. Under ASan, 24 of 25 pass, among themagc_reference_storagewith its new sort check and theagc_buffer_pooltests, with noalloc-dealloc-mismatch. The one failure isagc_graphics_profile_draw, which stops at its check that guest heap memory lies below 1 << 40, as it does onmainunder ASan (listed by #21121). That stop comes before the depth surface reuse tests, so their new sort check runs only in the non-ASan jobs. The test changes need no GPU: the depth surface reuse tests run on a mock device.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)🤖 Generated with Claude Code
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-16T05:43:20Z.
Review: APPROVED
Reviewed — looks good
Nothing blocks this change; the reviewed code and supplied CI report support merging.
What I ran
Reviewed head
c8906fceb8c6e54e29be9595b066698d65a1bf38using the preparedreviewmaterials and the pinned repository reader. No commands or tests were run.Results
Findings
Blocking
None.
Non-blocking
None.
Not verified
Tests were not run in this review. The author reports Linux GCC 13 negative-control and fixed ASan runs, plus fork CI results; these were not independently verified. No changed files were excluded: all five files listed as reviewed in the manifest were read.
review/files.jsonwas not available as a review document.To get this to a good state
Nothing is required.