tests: cover descriptor heap handle matching and boundary fallback #3860
No reviewers
Labels
No labels
accessibility
awaiting author
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
priority: P0
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/R0Y00--Xbox2Windows!3860
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-3858"
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?
@Ammmae0x on GitHub · 2026-12-02 14:09 UTC · original
Ammmae0x:tests/descriptor-heap-match-unit→main· +1094 −0 · 5 files · 2 commits · merged 2026-12-02 15:45 UTCRefs #1149
Portable C++17 unit and header-mutation tests for
x2w_startup::match_descriptor_heap(src/startup_stubs/descriptor_heap_match.h), matchingtests/cmake/logical_view_table_unit.cmake. The source is unchanged; only 5 new files are added (+1094/-0), and the existingtests/startup_descriptor_heap_match_check.cppcoverage is untouched. The new check uses the disjointdescriptor_heap_match_unitprefix so test names do not collide.What landed
tests/descriptor_heap_match_unit_check.cpp— 10 cases, header-only againstsrc, no device, no loader, no title data. A functor span callback (not a lambda) withstatic constexprshared constants; a heap whose span callback returnsfalsewrites a span that would match and returnsfalse, so a lookup that ignored the return value is caught.tests/cmake/descriptor_heap_match_unit.cmake— one CTest test per case plusdescriptor_heap_match_unit_all, and 5WILL_FAIL TRUEcontrols (BEFORE PRIVATEmutated header copies, 1:1 with the meta check).tests/descriptor_heap_match_unit_meta_check.py— audits the contract, compiles and runs the real C++ check and every mutation natively withg++ -std=c++17 -Wall -Wextra -Wpedantic -Werror(orclwith/W4).tests/checks/python-linux/descriptor_heap_match_unit.txt— lists exactly the meta check.docs/experiments/descriptor-heap-match-unit.md— cases, controls, and verification.Cases
empty_count: empty list matches nothing and never invokesspan;heap_count == 0matches nothing despite a matching heap;heap_counttruncates the search.span_false: a heap with no span matches nothing at its start or off its boundary; a span-less newest/oldest heap defers without adding a boundary match.zero_increment: increment 0 never matches (and never divides); increment 1 matches every handle on a boundary.handle_below_start: a handle below a start matches nothing; a handle below the newest heap still matches an older heap whose span holds it.count_boundary:offset / increment == count - 1matches,== count(andcount + 1) does not; count 1 matches only its start; count 0 matches nothing.exact_newest_boundary: tagged handles at0x3/0x4/0x5(increment0x20) name their own heap; a heap at0x23shares heap 0's slot 1 boundary, so the newest heap is taken withboundary_matches == 2; reused tag/address take the newest heap.off_boundary_newest: a handle off every boundary takes the newest containing heap withoff_boundary == true, index rounded down.boundary_beats_fallback: an older exact boundary beats a newer off-boundary fallback; the same heaps off every boundary take the newest fallback.large_uint64: a heap at0xfffffffffffffF00(increment0x40, count 3), a0x10000000increment at a large start, and a heap starting atUINT64_MAX.found_none: the default match isnone(SIZE_MAX) withfound() == false; a heap 0 hit reportsfound() == true.Mutation controls (5/5 killed)
span_guard_mut: the span guard is weakened so afalsereturn never skips the heap;span_falsethen returns heap 0 index 0 instead of no match.count_guard_mut:>= countbecomes> count;count_boundarythen returns heap 0 indexcount.boundary_mod_mut:offset % increment == 0becomestrue;off_boundary_newestthen reports an exact hit instead of the fallback.search_order_mut: the search runs oldest first;exact_newest_boundarythen returns heap 0 for the handle at0x23.fallback_override_mut: the fallback is applied even when a boundary matched;boundary_beats_fallbackthen returns the fallback heap withoff_boundary == true.There is no control for the
increment == 0guard: dropping it divides by zero, which CTest reports as a crash rather than an expected failure (verified in the scratch CTest run: the control failed with a numerical exception despiteWILL_FAIL TRUE), so it has no cleanWILL_FAILcontrol.zero_incrementstill exercises that guard directly. A first span-guard mutant that dropped thespancall entirely did not compile under-Werror=unused-parameter(the parameter became unused), so it was rewritten to weaken the guard while still callingspan.Verification (Linux, this host,
g++ -std=c++17, baseorigin/main5770f14e)Full configure needs DXC, unavailable on Linux, so the fragment was configured standalone via symlinked
src/testsunderout/descriptor-heap-match-unit-scratch(16 tests: 10 cases + all + 5 controls).Full Linux CI list from
.github/workflows/windows.yml(tools/run_checks_parallel.py --from-dir tests/checks/python-linux ...):all 329 checks passed.git diff --checkclean;git merge-tree --write-tree origin/main HEADexits 0.Windows Verification (
0cb68d8fdca0c8152c063794572a79ac7fd9f85e)AI-assisted.
@R0Y00 on GitHub · 2026-12-02 14:15 UTC · original · approved these changes
I checked the five-file test-only diff and a clean trial merge. On the exact head,
python3 -B tests/descriptor_heap_match_unit_meta_check.pypassed with GCC, exercising all ten cases and catching all five mutations. I also built the unmodified CMake fragment in a standalone harness with MSVC 19.51.ctest --test-dir build --output-on-failurepassed 16/16 including the five expected failures. The false span callback, boundary precedence and fallback tests exercise distinct parts of the search contract.