test(scheduler-sim-decision-trace): error-path trace scenarios with the real allocator

Task 6.2: injects plan-claims growth, snapshot, finalize, host-scan,
per-host uncommitted lookup, allocation-function and unknown-jobid
faults and asserts each traced outcome. Also fixes two deferred OOM
paths: a failed limit row keeps the host's verdict bits, and an array
listing that cannot be built is reported instead of silently truncated.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Rongsong Shen 2026-10-08 16:28:17 +00:00
parent aa401627a8
commit 7ac988a7f5
Signed by untrusted user: rshen
GPG key ID: 80533536B0EB651C
7 changed files with 896 additions and 20 deletions

View file

@ -2617,12 +2617,12 @@ test('scheduler decision trace test',
# "TraceCapture") over a fixture core and job -- selection facts,
# cluster-wide limits and attempt failure reasons. Links the record model
# and the capture sources (split in task 2.4); libxce supplies the
# pend-reason helpers.
# pend-reason helpers. sched_trace_capture.c is #included by the test, so
# its malloc() can be renamed for the limit-row out-of-memory case (6.2).
sched_trace_capture_test = executable(
'sched_trace_capture_test',
['test_trace_capture.c', '../src/sched_trace.c',
'../src/sched_trace_scan.c', '../src/sched_trace_capture.c',
'../src/sched_trace_outcome.c'],
'../src/sched_trace_scan.c', '../src/sched_trace_outcome.c'],
include_directories:[incdir],
dependencies: [scheduler_test_deps],
install: false)
@ -2794,13 +2794,14 @@ test('scheduler trace render test',
# three no-trace replies and arrays mixing stored and discarded elements.
# Links the record model, the renderer, the shared REPL formatting module
# and the store; the job table is a fixture kvmgr with sched_get_job() and
# repl_job_state_name() defined by the test.
# repl_job_state_name() defined by the test. The store is #included by the
# test, so its realloc() can be renamed for the listing out-of-memory case
# (6.2).
sched_trace_store_test = executable(
'sched_trace_store_test',
['test_trace_store.c', '../src/sched_trace.c',
'../src/sched_trace_scan.c', '../src/repl_trace_render.c',
'../src/repl_trace_render_outcome.c', '../src/repl_fmt.c',
'../src/repl_trace_store.c'],
'../src/repl_trace_render_outcome.c', '../src/repl_fmt.c'],
include_directories:[incdir],
dependencies: [scheduler_test_deps],
install: false)
@ -2935,3 +2936,40 @@ sched_sim_trace_driver_test = executable(
test('scheduler sim trace driver test',
sched_sim_trace_driver_test, suite: 'scheduler',
env: ['ASAN_OPTIONS=detect_leaks=0'])
# scheduler-sim-decision-trace task 6.2 (Requirements 2.4, 3.2, 4.4, 4.5,
# 5.7): error-path traces with the real allocator. The hooked sources are
# #included by the test so source-level renames apply (realloc in
# alloc_runner.c; iter_next and the per-host uncommitted lookup in
# host_iter.c); every other scheduler source is its own translation unit,
# and xvec_dup (claim snapshot) and make_host_alloc/make_job_alloc
# (finalize) are link-wrapped to fail on demand.
sched_trace_error_paths_included = ['src/main.c', 'src/sched_election.c',
'src/scheduler.c', 'src/alloc_runner.c',
'src/host_iter.c', 'src/resource.c',
'src/sched_trace.c',
'src/sched_trace_scan.c',
'src/sched_trace_capture.c',
'src/sched_trace_outcome.c']
sched_trace_error_paths_test_srcs = ['test_trace_error_paths.c']
foreach f : scheduler_srcs
if not sched_trace_error_paths_included.contains(f)
sched_trace_error_paths_test_srcs += ['../' + f]
endif
endforeach
sched_trace_error_paths_test = executable(
'sched_trace_error_paths_test',
sched_trace_error_paths_test_srcs,
include_directories:[incdir],
dependencies: [scheduler_deps, unity_dep],
link_args: ['-Wl,--wrap=xcecli_start',
'-Wl,--wrap=xcecli_join',
'-Wl,--wrap=xvec_dup',
'-Wl,--wrap=make_host_alloc',
'-Wl,--wrap=make_job_alloc'],
install: false)
test('scheduler trace error paths test',
sched_trace_error_paths_test, suite: 'scheduler',
env: ['ASAN_OPTIONS=detect_leaks=0'])