[pr-tests] descriptor slots: a test of the plain scan, the allocator that runs outside tests #417

Manually merged
TrustNo1 merged 1 commit from iboom72/tests/plain-slots-test into main 2026-12-05 04:50:48 +00:00 AGit
Contributor

What it changes

  • The problem on main: read from the code only. plain() (crates/darner-gpu/src/descriptor/slots.rs:38) returns false under cfg!(test).

So every unit test in slots.rs runs the opt-in bitmap allocator (DARNER_SLOTS_BITMAP=1), and none reaches plain_alloc or plain_release, which are what runs by default.

The new test puts the plain scan against the file's own reference allocator: the same slots, free count, cursor and occupancy over 4,000 random steps at six sizes (1, 2, 63, 64, 65, 300), with releases of free slots and of ranges past the end. Test only.

One difference it found and does not change: a release that frees nothing resets too_long in the plain scan, while the bitmap path and the reference keep it (noop_releases_preserve_too_long_watermark). That only costs the next long request its search; the slots given are the same. The test does not compare too_long for that reason.

How it was tested

  • Tested revision: 9caee9d6
  • Commands and results:
    • cargo clippy -p darner-gpu --all-targets --locked -- -D warnings: clean.
    • cargo test -p darner-gpu --lib --locked descriptor::slots: 5 passed, 0 failed, 1 ignored; the new test plain_scan_matches_the_reference is among them (21.9 s for the five).
  • Changes a default: no
  • A/B result: not applicable (test only).
  • Gates run on that revision (the three in AGENTS.md; there is no CI): none of the three in full. Run instead: clippy for darner-gpu with all targets, and the unit tests named above. Not run: clippy over the whole workspace, clippy with --all-features, cargo test --workspace.
  • Gameplay, when relevant: not relevant (test only).
  • Hardware dependence: none.
  • Coverage gaps: release_batch on the plain path is not exercised.

Checklist

  • I ran this change in the game, or say below why it can't be (docs, tests only).
    • A test only.
  • This PR contains one change based on main.
  • The diff follows docs/asset-policy.md.
  • I recorded this PR's dependencies below.
    • Depends on: none

Checked for overlap

  • I searched the open pull requests for the same issue and for the files this touches.
  • Related PRs: none found (no open PR changes descriptor/slots.rs).
  • Replaces or overlaps: none found. The forge's search over open and closed issues and PRs finds nothing for plain_alloc or DARNER_SLOTS_BITMAP.

🤖 Generated with Claude Code

## What it changes - The problem on main: read from the code only. `plain()` (`crates/darner-gpu/src/descriptor/slots.rs:38`) returns `false` under `cfg!(test)`. So every unit test in `slots.rs` runs the opt-in bitmap allocator (`DARNER_SLOTS_BITMAP=1`), and none reaches `plain_alloc` or `plain_release`, which are what runs by default. The new test puts the plain scan against the file's own reference allocator: the same slots, free count, cursor and occupancy over 4,000 random steps at six sizes (1, 2, 63, 64, 65, 300), with releases of free slots and of ranges past the end. **Test only.** One difference it found and does not change: a release that frees nothing resets `too_long` in the plain scan, while the bitmap path and the reference keep it (`noop_releases_preserve_too_long_watermark`). That only costs the next long request its search; the slots given are the same. The test does not compare `too_long` for that reason. ## How it was tested - Tested revision: `9caee9d6` - Commands and results: - `cargo clippy -p darner-gpu --all-targets --locked -- -D warnings`: clean. - `cargo test -p darner-gpu --lib --locked descriptor::slots`: 5 passed, 0 failed, 1 ignored; the new test `plain_scan_matches_the_reference` is among them (21.9 s for the five). - Changes a default: no - A/B result: not applicable (test only). - Gates run on that revision (the three in AGENTS.md; there is no CI): none of the three in full. Run instead: clippy for `darner-gpu` with all targets, and the unit tests named above. Not run: clippy over the whole workspace, clippy with `--all-features`, `cargo test --workspace`. - Gameplay, when relevant: not relevant (test only). - Hardware dependence: none. - Coverage gaps: `release_batch` on the plain path is not exercised. ## Checklist - [x] I ran this change in the game, or say below why it can't be (docs, tests only). - A test only. - [x] This PR contains one change based on `main`. - [x] The diff follows `docs/asset-policy.md`. - [x] I recorded this PR's dependencies below. - Depends on: none ## Checked for overlap - [x] I searched the open pull requests for the same issue and for the files this touches. - Related PRs: none found (no open PR changes `descriptor/slots.rs`). - Replaces or overlaps: none found. The forge's search over open and closed issues and PRs finds nothing for `plain_alloc` or `DARNER_SLOTS_BITMAP`. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
`plain()` is off under `cfg!(test)`, so every test in slots.rs ran the
opt-in bitmap allocator (`DARNER_SLOTS_BITMAP=1`) and none reached
`plain_alloc` or `plain_release`, which are the default. The new test
runs the plain scan against the file's reference allocator: the same
slots, free count, cursor and occupancy over 4,000 random steps at six
sizes. Test only.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
TrustNo1 manually merged commit 1492cb6f93 into main 2026-12-05 04:50:48 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
TrustNo1/Darner!417
No description provided.