feat(scheduler-sim-live-allocation): make plugin hook dispatch core-safe (task 1.2)

Re-types plugin_job_election()/plugin_prepare_allocation()/
plugin_commit_decision() from (void* arg, ...) to (xce_sched_core_t*
core, ...), iterating core->plugins directly instead of deriving it
from a normal-mode-only driver struct -- mirroring
plugin_begin_session()/plugin_end_session()'s already-completed
migration.

Adds a new, honestly-typed xce_sched_plugin_t.core field, set by both
plugin_register() (normal mode) and plugin_register_core() (simulation
mode, closing a gap left since bug-1825 where this path set nothing).
The existing plugin->sched field and its plugins/fcfs.c legacy
consumer are left untouched.

Necessarily updates the 4 existing normal-mode call sites (scheduler.c,
resource.c, schedobj.c) to pass &(...->core) -- a C signature migration
cannot keep the build green without touching every caller in the same
commit; each fix is a minimal argument wrap with no algorithm change,
matching design.md's own Implementation Notes for this component.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RLSNJhNoULvVcUhXEFafQC
This commit is contained in:
Rongsong Shen 2026-09-18 11:48:08 +00:00
parent 89297dc825
commit e8866641a6
No known key found for this signature in database
GPG key ID: 5BCDAAE0123E9FE2
18 changed files with 403 additions and 34 deletions

View file

@ -91,6 +91,19 @@ sched_picker_registration_test = executable('sched_picker_registration_test',
dependencies: [scheduler_test_deps],
install: false)
# White-box test for the driver-agnostic plugin-hook dispatch functions
# (plugin_job_election/plugin_prepare_allocation/plugin_commit_decision) and
# the new xce_sched_plugin_t.core field (scheduler-sim-live-allocation spec,
# task 1.2, "Plugin Hook Dispatchers"). It #includes ../src/plugin.c
# directly (same white-box pattern as sched_picker_registration_test) so it
# exercises the real dispatch loops and the real plugin_register()/
# plugin_register_core() entry points, not a re-implementation of either.
sched_plugin_hook_dispatch_test = executable('sched_plugin_hook_dispatch_test',
['test_plugin_hook_dispatch.c'],
include_directories:[incdir],
dependencies: [scheduler_test_deps],
install: false)
# White-box test for the picker configuration fields added to
# xce_scheduler_t/xce_sched_queue_t/xce_sched_project_t (scheduler-core
# spec, task 1.3). It #includes ../src/schedobj.c directly (same white-box
@ -1734,6 +1747,8 @@ test('scheduler picker iface test', sched_picker_iface_test, suite: 'scheduler',
env: ['ASAN_OPTIONS=detect_leaks=0'])
test('scheduler picker registration test', sched_picker_registration_test, suite: 'scheduler',
env: ['ASAN_OPTIONS=detect_leaks=0'])
test('scheduler plugin hook dispatch test', sched_plugin_hook_dispatch_test, suite: 'scheduler',
env: ['ASAN_OPTIONS=detect_leaks=0'])
test('scheduler picker config fields test', sched_picker_config_fields_test, suite: 'scheduler',
env: ['ASAN_OPTIONS=detect_leaks=0'])
test('scheduler picker fcfs test', sched_picker_fcfs_test, suite: 'scheduler',