test(scheduler-allocator-runner): characterize the seqjob allocator (task 2.1)

12 tests drive the real seqjob plugin through job_alloc_fn and record
today's results, reasons and debits, with switch-stable OOM injection
(sched_make_allocs stub, --wrap of make_host_alloc/make_job_alloc).
Assertions the runner changes on purpose sit in *_today tests.

The characterization showed bug-1893's real effect: vget() returns 0 on
success, so the shared-reason loop (rc <= 0 skip) never records a shared
NO_RESOURCE reason. Bug record and spec wording corrected; the runner
skips only on rc < 0.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Rongsong Shen 2026-09-30 08:11:26 +00:00
parent 31ad79d325
commit 91a8580948
Signed by untrusted user: rshen
GPG key ID: 80533536B0EB651C
8 changed files with 835 additions and 16 deletions

View file

@ -36,7 +36,7 @@ Driver: `issues/new_requirements.md` item 4.
test and sim-parity fixture. Intentional differences, all outside the
decision and main pend reason: pending seqjob jobs may gain per-host
`NO_RESOURCE` reasons (Constraints item 1); spurious shared reasons are
dropped (bug-1893, item 6); seqjob gets the `-EINVAL` guard and OOM
recorded for the first time (bug-1893, item 6); seqjob gets the `-EINVAL` guard and OOM
rollback (Req 5 AC 1/5).
- `new_requirements.md` item 4 closed.
@ -173,12 +173,14 @@ goal that plugins no longer export `my_alloc()`).
testsuite files reference the allocators).
5. Proposal-sketch defects to avoid: `sched_ctx_primary == NULL` typo;
`claims[plan->nbuckets]` VLA (heap-allocate or bound by `maxTasks`).
6. **Decided 2026-09-29 (requirements review): the shared pend-reason loop
iterates the unmet list (`ctx->unmeet.count`), fixing bug-1893.** Both
current `my_alloc()`s loop to `ctx->alloc_req.shared.count` over
`ctx->unmeet`, whose tail is zero-filled, and add reasons naming
resource index 0. Moving the loop into the runner is the natural point
to fix it; main reason and decisions are unaffected.
6. **Decided 2026-09-29 (requirements review), corrected 2026-09-30 (task
2.1): the shared pend-reason loop iterates the unmet list
(`ctx->unmeet.count`) and skips only on `vget() < 0`, fixing bug-1893.**
Both current `my_alloc()`s skip on `vget() <= 0`, but `vget` returns 0
on success, so today no shared `NO_RESOURCE` reason is ever recorded
(the loop also runs to `alloc_req.shared.count`). After the fix a job
pending on shared resources names each short one; main reason and
decisions are unaffected.
- Claim `host_req` snapshots are owned by the framework: fini on every exit
path (success, bucket failure, OOM).
- Verify with: `test_seqjob_*`, `test_parjob_*`, `test_seqjob_rewrap_equivalence`,