feat(scheduler-allocation): implement the unsatisfiable-resreq cache
Adds alloc_cache.c: xce_cache_key_t, cache_key_ops (the corrected three-way, 0-means-equal .cmp -- an inverted-boolean version was a real bug found during design review), and cache_lookup/insert/clear against a real kvtab_t (constructed matching xce_select.c's sel_node_table_init() precedent). Cache values are a boxed reason- category int, not a bare hit/miss sentinel, satisfying Req 7 AC5's requirement that a hit reproduce the original pend-reason category. unsatisfiable_cache lives on xce_scheduler_t per Req 7 AC1. Task 2.2 (scheduler-allocation spec). Requirements 7.1, 7.3, 7.4, 7.5. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XYdtrEWWZfKRRGED7raEYg
This commit is contained in:
parent
d9831b0bc8
commit
86c86352d1
8 changed files with 871 additions and 1 deletions
|
|
@ -1510,6 +1510,23 @@ sched_host_iter_test = executable(
|
|||
dependencies: [scheduler_test_deps],
|
||||
install: false)
|
||||
|
||||
# Unit test for the session-level unsatisfiable-resreq cache
|
||||
# (scheduler-allocation spec, task 2.2, Req 7.1, 7.3, 7.4, 7.5). White-box
|
||||
# TU (#includes ../src/alloc_cache.c directly, same convention as
|
||||
# sched_host_iter_test above) -- never touches xce_sched_core_init(), since
|
||||
# alloc_cache.c only depends on kv.h + scheduler.h/sched/types.h struct
|
||||
# definitions, not on core.c's collections. Covers: same-key-twice hit
|
||||
# (the cache_key_cmp_() three-way-vs-boolean polarity regression guard),
|
||||
# a miss on every individually-differing fingerprint/identity field,
|
||||
# reason-category round-trip across two distinct categories, and
|
||||
# clear-empties-all-entries.
|
||||
sched_alloc_cache_test = executable(
|
||||
'sched_alloc_cache_test',
|
||||
['test_alloc_cache.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',
|
||||
|
|
@ -1698,3 +1715,6 @@ test('scheduler alloc plan iter test',
|
|||
test('scheduler host iter test',
|
||||
sched_host_iter_test, suite: 'scheduler',
|
||||
env: ['ASAN_OPTIONS=detect_leaks=0'])
|
||||
test('scheduler alloc cache test',
|
||||
sched_alloc_cache_test, suite: 'scheduler',
|
||||
env: ['ASAN_OPTIONS=detect_leaks=0'])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue