test(scheduler-allocation): prove seqjob rewrap preserves host selection

Add a dedicated equivalence suite (test_seqjob_rewrap_equivalence.c)
covering multi-host fixtures the trivial single-host test doesn't reach:
select-filter-only rejection, resource-only rejection, a combined
select-then-resource-then-success ordering, and per-host debit
correctness. The iteration-order test is grounded in the deleted
pre-rewrap sched_collect_workers() code path (verified via git show
against the parent commit) and the unmodified xlist.c primitive, not
merely in host_iter.c's own traversal, so it proves equivalence to the
old behavior rather than internal self-consistency.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XYdtrEWWZfKRRGED7raEYg
This commit is contained in:
Rongsong Shen 2026-09-04 19:35:38 +00:00
parent b18c5f780d
commit 9d64ba0d69
No known key found for this signature in database
GPG key ID: 5BCDAAE0123E9FE2
3 changed files with 621 additions and 1 deletions

View file

@ -1542,6 +1542,23 @@ sched_seqjob_allocator_test = executable(
dependencies: [scheduler_test_deps],
install: false)
# Task 3.2 (scheduler-allocation spec, Req 9.1): the dedicated pre/post-
# rewrap host-selection EQUIVALENCE proof for seqjob_allocator.c's
# my_alloc() -- fixture states task 3.1's own smoke test does not cover
# (multiple candidate hosts with only one resource-satisfying, a host
# failing the select filter specifically despite abundant resources,
# iteration-order sensitivity across two equally-valid hosts, and a
# select-fail-then-resource-fail-then-success sequence). Same white-box
# #include pattern as sched_seqjob_allocator_test above, plus <rtti.h>
# directly for this file's own iter_make()/iter_next() grounding of
# "iteration order".
sched_seqjob_rewrap_equivalence_test = executable(
'sched_seqjob_rewrap_equivalence_test',
['test_seqjob_rewrap_equivalence.c'],
include_directories:[incdir],
dependencies: [scheduler_test_deps],
install: false)
# Register as meson tests so `meson test --suite scheduler` runs them all.
# detect_leaks=0 matches the suite convention (fixtures are not torn down).
test('scheduler test', scheduler_test, suite: 'scheduler',
@ -1736,3 +1753,6 @@ test('scheduler alloc cache test',
test('scheduler seqjob allocator test',
sched_seqjob_allocator_test, suite: 'scheduler',
env: ['ASAN_OPTIONS=detect_leaks=0'])
test('scheduler seqjob rewrap equivalence test',
sched_seqjob_rewrap_equivalence_test, suite: 'scheduler',
env: ['ASAN_OPTIONS=detect_leaks=0'])