tests: cover x2w_xmem::SlabSlots allocation, unwind, tombstones, and reclaim #3779
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!3779
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-3777"
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-01 19:25 UTC · original
Ammmae0x:tests/xmem-slab-slots-unit→main· +1519 −0 · 5 files · 4 commits · merged 2026-12-02 15:57 UTCRefs #1149.
Standalone portable C++17 unit, exception-safety, and 1:1 header-mutation tests for
x2w_xmem::SlabSlotsinsrc/xmem_slab_slots.h, with zero edits to existing files (5 new files only,tests/xmem_slab_slots_check.cppandCMakeLists.txtuntouched, disjoint prefixxmem_slab_slots_unit).What landed — commit
d55a43ac, 5 new files only:tests/xmem_slab_slots_unit_check.cpp— 9 cases:fresh_rollover(slots_per_slab == 4096,slab_bytes, 4096 -> new slab rollover),make_false(make returns false rollback, empty and second slab),throw_discard(throwingHandlecopy triggersdiscard(slab)leavingslab_count/slots_in_use/slabsintact, first and second slab),unwind_fresh(last-slot undo vs mismatched index/offset/zero/older-slab no-op),release_validation(bad slab index, tombstone, misaligned offset,offset >= slab_bytes, unallocated fresh slot, duplicate release),lowest_free/take_lowest_free(multi-slab ordering and counters, empty case),reclaim_tombstone(non-trailing slab becomesHandle{}tombstone preserving later indices),reclaim_trailing(trailing pop, consecutive tombstones,fresh_used_reset to 0 or 4096),reclaim_free_entries(reclaim freesfree_entries,slots_freeinvariant throughout).tests/cmake/xmem_slab_slots_unit.cmake— per-case CTests plusxmem_slab_slots_unit_all, and 6WILL_FAIL TRUEBEFORE PRIVATEheader mutations:throw_discard,unwind_match,dup_release,tombstone_index,trailing_pop_reset,reclaim_free_erase.tests/xmem_slab_slots_unit_meta_check.py— audits the contract and mirrors the 6 mutations 1:1 against real C++ copies (g++ if present else cl,finally-cleaned temp dir).tests/checks/python-linux/xmem_slab_slots_unit.txtdocs/experiments/xmem-slab-slots-unit.mdCaught in development: the first
throw_discardmutant replaceddiscard(slab);with(void)slab;, which left thediscardparameter unused and failed to compile under-Werror=unused-parameter; the mutant now uses(void)discard;.Fix on
73e070b3— MSVC Debugxmem_slab_slots_unit_reclaim_free_erase_muttimed out (59s): with thefree_erase dropped, stale slab-0 entries survive reclaim, and continuing intotake_lowest_freeplus a full reclaim letslowest_free()index the emptiedslabs_vector.reclaim_free_entriesnow stops (return false, after theexpect_*failures) when the lowest free slot after reclaim is still slab 0 instead of slab 1 (handle 101), guardsclosed[1]onclosed.size() >= 2, and runs the second reclaim (the one that pops the tombstone) on a freshSlots. The mutant now fails fast on Linux instead of hanging.Verification (Linux, this host)
PASS: xmem_slab_slots_unit: 9 cases, 6/6 mutations killed (g++)100% tests passed, 0 tests failed out of 16(9 per-case + all + 6 mutation controls);xmem_slab_slots_unit_reclaim_free_erase_mutpasses in 0.00s, and the mutant run directly fails fast (rc=1, 2FAIL:lines) instead of timing outform_coverage_check.pypasses,docs_links_check.pypasses (226 files, 878 links),bidi_controls_check.pypasses (2880 files),git diff --checkcleanpython-linuxsuite (tools/run_checks_parallel.py, from the CI workflow):all 316 checks passedWindows Verification (
73e070b380899ffc8ca55087a8b7f3b06a16b4d2)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/xmem_slab_slots_unit_meta_check.pypassed with GCC, exercising all nine cases and catching all six 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 six expected failures. The unwind, duplicate release, tombstone and trailing reset controls exercise distinct allocator invariants.