test(scheduler-sim-live-allocation): prove contention parity across drivers (task 5.1)

Adds two new fixtures spawning the real sched_job_picker/sched_allocator
thread pair directly against bare normal-mode and sim-mode core state
under genuine resource contention (2.0 capacity, 3 jobs x 1.0 demand),
asserting identical admission decisions and identical accounting state
(job->accounts, w->resInUse), with and without a matching host-scoped
limit. The pre-existing test_sim_contention_parity.c could not be reused
since its white-box stubs hard-code the old always-PEND behavior and
never exercise live election/allocation.

Confirms build_limit_vres_requests()/get_vres_value() (plugins/limit.c)
are #if 0'd dead code with zero live callers -- no limit in this codebase
currently gates/denies admission in either mode, only tracks/displays
usage -- so this proves usage-tracking parity, documented explicitly as
an honest scope boundary rather than a silent narrowing.

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-19 08:24:35 +00:00
parent f6a2862110
commit ab88848f91
No known key found for this signature in database
GPG key ID: 5BCDAAE0123E9FE2
4 changed files with 1230 additions and 1 deletions

View file

@ -2135,3 +2135,59 @@ sched_sim_alloc_limit_fanout_test = executable(
test('scheduler sim alloc limit fanout test',
sched_sim_alloc_limit_fanout_test, suite: 'scheduler',
env: ['ASAN_OPTIONS=detect_leaks=0'])
# scheduler-sim-live-allocation spec, task 5.1 (Req 3.1, 3.2): drives the
# real, unmodified sched_job_picker()/sched_allocator() pair against a
# multi-job, capacity-insufficient contention fixture on BOTH a normal-mode-
# shaped core (xce_scheduler_t) and a simulation-mode-shaped core
# (xce_sched_sim_driver_t) side by side, confirming identical admission
# outcomes and identical final resource-accounting state. Same real-
# scheduler_srcs link technique as sched_election_sim_fixture_test/
# sched_sim_live_allocation_test/sched_sim_alloc_limit_fanout_test above.
sched_sim_contention_resource_driver_parity_test_srcs = [
'test_sim_contention_resource_driver_parity.c'
]
foreach f : scheduler_srcs
if f != 'src/main.c'
sched_sim_contention_resource_driver_parity_test_srcs += ['../' + f]
endif
endforeach
sched_sim_contention_resource_driver_parity_test = executable(
'sched_sim_contention_resource_driver_parity_test',
sched_sim_contention_resource_driver_parity_test_srcs,
include_directories:[incdir],
dependencies: [scheduler_test_deps],
install: false)
test('scheduler sim contention resource driver parity test',
sched_sim_contention_resource_driver_parity_test, suite: 'scheduler',
env: ['ASAN_OPTIONS=detect_leaks=0'])
# scheduler-sim-live-allocation spec, task 5.1 (Req 3.1, 3.2): sibling of
# sched_sim_contention_resource_driver_parity_test above, adding a host-
# scoped limit that actively matches every contending job on both drivers
# (Requirement 3.2's "capacity constrained by a matching limit" /
# scheduler-driver-equivalence.md's testing discipline), confirming both
# the admission outcome AND the limit-usage-instance accounting state match
# between drivers. Same real-scheduler_srcs link technique as the test
# immediately above.
sched_sim_contention_limit_driver_parity_test_srcs = [
'test_sim_contention_limit_driver_parity.c'
]
foreach f : scheduler_srcs
if f != 'src/main.c'
sched_sim_contention_limit_driver_parity_test_srcs += ['../' + f]
endif
endforeach
sched_sim_contention_limit_driver_parity_test = executable(
'sched_sim_contention_limit_driver_parity_test',
sched_sim_contention_limit_driver_parity_test_srcs,
include_directories:[incdir],
dependencies: [scheduler_test_deps],
install: false)
test('scheduler sim contention limit driver parity test',
sched_sim_contention_limit_driver_parity_test, suite: 'scheduler',
env: ['ASAN_OPTIONS=detect_leaks=0'])