feat(scheduler-allocator-runner): runner guards and shared-resource precheck (task 3.1)

New alloc_runner.c: sched_allocator_run() validates its inputs (-EINVAL
without touching the pend reason), applies the plugin's optional accepts
guard, creates the pend-reason record, then checks shared resources: one
host-less NO_RESOURCE reason per unmet entry (skip only on vget < 0,
fixing bug-1893) and the met amounts counted once as uncommitted. Plan
search follows in task 3.2. Runner tests use a fake allocator contract;
the pend-reason factory audit now scans the runner.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Rongsong Shen 2026-09-30 08:58:07 +00:00
parent b4470b2b94
commit d9ef983014
Signed by untrusted user: rshen
GPG key ID: 80533536B0EB651C
6 changed files with 726 additions and 1 deletions

View file

@ -1743,6 +1743,19 @@ sched_alloc_equivalence_parjob_test = executable(
'-Wl,--wrap=make_job_alloc'],
install: false)
# scheduler-allocator-runner task 3.1 (Req 1.3, 1.4, 2.1-2.4, 5.1): the
# framework allocation routine (alloc_runner.c) through sched_allocator_run()
# with an in-test fake allocator contract. Same white-box stack as the
# equivalence targets above; make_pendreason is wrapped for the reason-record
# out-of-memory test (the make_*_alloc wraps are not needed).
sched_alloc_runner_test = executable(
'sched_alloc_runner_test',
['test_alloc_runner.c'],
include_directories:[incdir],
dependencies: [scheduler_test_deps],
link_args: ['-Wl,--wrap=make_pendreason'],
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
@ -2015,6 +2028,9 @@ test('scheduler alloc equivalence seqjob test',
# Leak detection stays on (as for the seqjob characterization above).
test('scheduler alloc equivalence parjob test',
sched_alloc_equivalence_parjob_test, suite: 'scheduler')
# Leak detection stays on: every fixture tears down its ctx and core.
test('scheduler alloc runner test',
sched_alloc_runner_test, suite: 'scheduler')
test('scheduler seqjob rewrap equivalence test',
sched_seqjob_rewrap_equivalence_test, suite: 'scheduler',
env: ['ASAN_OPTIONS=detect_leaks=0'])