feat(scheduler-allocator-runner): seqjob allocates through the framework runner (task 4.2)

seqjob registers sched_allocator_run with seqjob_alloc_iface (no accepts
guard, plus its one-bucket plan iterator); its private my_alloc() is
gone. New fixtures pin the intended changes: a reason for every short
host, the bug-1893 shared reason, the host-stage OOM debit release, and
-EINVAL for missing inputs; seqjob's plan is asserted to be one bucket of
one slot. No other test expectation changed.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Rongsong Shen 2026-09-30 09:53:14 +00:00
parent 239bcf95cd
commit 65679285ba
Signed by untrusted user: rshen
GPG key ID: 80533536B0EB651C
7 changed files with 674 additions and 244 deletions

View file

@ -49,6 +49,7 @@
#include "../src/resource.c"
#include "../src/schedobj.c"
#include "../src/host_iter.c"
#include "../src/alloc_runner.c"
#include "../src/plugins/seqjob_allocator.c"
/* ---------------------------------------------------------------------- */
@ -299,9 +300,10 @@ test_my_alloc_allocates_single_matching_host_through_shared_iterators(void)
* plugin->core (honestly typed, task 1.2) for every core-safe call,
* alongside the still-needed plugin->sched (sched_make_allocs(),
* scheduler.c, unchanged). */
plugin.core = &(sched.core);
plugin.core = &(sched.core);
plugin.allocator_iface = &seqjob_alloc_iface;
rc = my_alloc(&plugin, &ctx);
rc = sched_allocator_run(&plugin, &ctx);
TEST_ASSERT_EQUAL_INT(1, rc);
TEST_ASSERT_NOT_NULL(ctx.alloc);
@ -423,10 +425,11 @@ static void test_my_alloc_reports_enomem_when_allocs_cannot_be_built(void)
memset(&plugin, 0, sizeof(plugin));
plugin.sched = &sched;
plugin.core = &(sched.core);
plugin.core = &(sched.core);
plugin.allocator_iface = &seqjob_alloc_iface;
g_make_allocs_fail = 1;
rc = my_alloc(&plugin, &ctx);
rc = sched_allocator_run(&plugin, &ctx);
TEST_ASSERT_EQUAL_INT(-ENOMEM, rc);
TEST_ASSERT_NULL(ctx.alloc);