test(scheduler-snapshot-job-allocation): regression test for allocator crash
Task 4.1: new test proving a snapshot-restored PENDING job (valid resreq) reaches the real, live sched_allocator() thread's sched_make_allocation() entry point without crashing -- the exact bug-1569-class failure task 1.2 closed for the snapshot-load path. New file (not an extension of test_snapshot_save_load.c) since driving the real allocator needs scheduler.c's full dependency closure, too heavy for that file's deliberately lean core-only TU. Follows the already-established pattern from test_scheduler_connect.c / test_scheduler_backpressure.c / test_scheduler_dispatch_commit.c: link the real scheduler.c, wrap xcecli_start/xcecli_join, start a real sched_init(), feed jobs directly into core.jbuf to drive the live allocator thread. Wired into meson.build as a new executable/test. Verified with two fault-injection experiments (reverted after): disabling task 1.2's schedobj construction call makes this test fail cleanly via its own assertion; going further and removing that assertion reproduces a genuine ASAN-caught SEGV in the real allocator path -- concrete proof this test would have caught bug-1569's failure shape. Both polling loops (jbuf drain, decision wait) are bounded (2s timeout, 5ms poll) -- no hang risk; confirmed non-flaky across 10 consecutive runs. Requirements: 2.2, 2.4
This commit is contained in:
parent
f0fbebdeab
commit
de6ad514e0
3 changed files with 487 additions and 1 deletions
|
|
@ -1123,6 +1123,40 @@ sched_scheduler_dispatch_commit_test = executable(
|
|||
dependencies: [scheduler_deps, unity_dep],
|
||||
install: false)
|
||||
|
||||
# scheduler-snapshot-job-allocation spec, task 4.1 (Req 2 AC 2/AC 4): direct
|
||||
# regression test proving a PENDING job restored via the real
|
||||
# xce_sched_core_load_snapshot() (task 1.2's job->schedobj fix) reaches the
|
||||
# scheduler's REAL allocator entry point (sched_make_allocation(),
|
||||
# `static` to scheduler.c) without crashing -- the exact bug-1569-class
|
||||
# failure shape this feature closes. Same real-scheduler_srcs link
|
||||
# technique as sched_scheduler_connect_test/sched_scheduler_backpressure_test
|
||||
# above (see this test file's own header comment for why extending
|
||||
# test_snapshot_save_load.c's existing white-box #include of core.c/
|
||||
# core_events.c/.../snapshot_load.c with ALSO #include-ing scheduler.c was
|
||||
# ruled out: scheduler.c's dependency surface is exactly the "link-surface
|
||||
# reason" test_scheduler_connect.c's own header comment already documents
|
||||
# for not white-box #include-ing it anywhere in this directory). Only
|
||||
# `-Wl,--wrap=` needed is xcecli_start/xcecli_join (trivial always-succeed
|
||||
# doubles, identical to sched_scheduler_backpressure_test's own), so this
|
||||
# file's one real sched_init() call succeeds with no live controller and
|
||||
# starts the real picker/allocator threads.
|
||||
scheduler_snapshot_load_allocator_regression_test_srcs = [
|
||||
'test_snapshot_load_allocator_regression.c']
|
||||
foreach f : scheduler_srcs
|
||||
if f != 'src/main.c'
|
||||
scheduler_snapshot_load_allocator_regression_test_srcs += ['../' + f]
|
||||
endif
|
||||
endforeach
|
||||
|
||||
sched_snapshot_load_allocator_regression_test = executable(
|
||||
'sched_snapshot_load_allocator_regression_test',
|
||||
scheduler_snapshot_load_allocator_regression_test_srcs,
|
||||
include_directories:[incdir],
|
||||
dependencies: [scheduler_deps, unity_dep],
|
||||
link_args: ['-Wl,--wrap=xcecli_start',
|
||||
'-Wl,--wrap=xcecli_join'],
|
||||
install: false)
|
||||
|
||||
# White-box regression test for bug-1685 (double-free/heap-corruption
|
||||
# SIGABRT in limit_update_config() on a duplicate limit-name config
|
||||
# update). It #includes ../src/plugins/limit.c directly (same white-box
|
||||
|
|
@ -1305,6 +1339,9 @@ test('scheduler decision redelivery test',
|
|||
test('scheduler dispatch commit test',
|
||||
sched_scheduler_dispatch_commit_test, suite: 'scheduler',
|
||||
env: ['ASAN_OPTIONS=detect_leaks=0'])
|
||||
test('scheduler snapshot load allocator regression test',
|
||||
sched_snapshot_load_allocator_regression_test, suite: 'scheduler',
|
||||
env: ['ASAN_OPTIONS=detect_leaks=0'])
|
||||
test('scheduler limit plugin test', sched_limit_plugin_test, suite: 'scheduler',
|
||||
env: ['ASAN_OPTIONS=detect_leaks=0'])
|
||||
test('scheduler builtin fcfs cursor uaf test',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue