feat(scheduler-core): implement simulation-mode startup (task 11.1)
Add sim.h/sim.c implementing AC 13 steps 1-4: open+validate ReplayHeader, locate the most recent SnapshotEntry at/before --sim-start-ts, load it via xce_sched_core_load_snapshot(), and set the virtual clock anchors. Wire all seven simulation CLI flags into main.c's task-5.2 mode-selection branch. Event loop itself (step 5) deferred to task 11.2. Fixes two real bugs found during TDD: a SnapshotEntry_get_ts() use-after-free and a pend_updates NULL-deref in xce_sched_core_fini() for bare-core callers. 27/27 scheduler suite green, full project build clean.
This commit is contained in:
parent
16d756aca3
commit
5d587ecf32
7 changed files with 1366 additions and 21 deletions
|
|
@ -458,6 +458,27 @@ sched_admin_request_test = executable(
|
|||
dependencies: [scheduler_test_deps],
|
||||
install: false)
|
||||
|
||||
# Contract test for simulation-mode startup (scheduler-core spec, task 11.1,
|
||||
# Req 5 AC 13): opening and validating the replay file (first message must
|
||||
# be ReplayHeader, first data message must be SnapshotEntry), locating the
|
||||
# most recent SnapshotEntry at or before --sim-start-ts, loading it via the
|
||||
# real xce_sched_core_load_snapshot(), and setting the virtual clock's
|
||||
# anchors from the loaded snapshot's timestamp and requested speed. Same
|
||||
# white-box #include pattern as sched_snapshot_save_load_test (../src/core.c,
|
||||
# ../src/core_clock.c, ../src/snapshot.c, ../src/snapshot_wire.c,
|
||||
# ../src/snapshot_load.c) PLUS ../src/recording.c (used only to build real
|
||||
# `.replay` fixtures via sched_record_start()/sched_record_stop(), not under
|
||||
# test here) PLUS the new ../src/sim.c under test. No driver.c/plugin.c/
|
||||
# core_events.c/core_session.c/decision.c: this task stops at "ready-to-run"
|
||||
# (task 11.2 owns the event loop), so no real scheduling session is ever
|
||||
# driven.
|
||||
sched_sim_startup_test = executable(
|
||||
'sched_sim_startup_test',
|
||||
['test_sim_startup.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',
|
||||
|
|
@ -527,3 +548,6 @@ test('scheduler record lifecycle test',
|
|||
test('scheduler admin request test',
|
||||
sched_admin_request_test, suite: 'scheduler',
|
||||
env: ['ASAN_OPTIONS=detect_leaks=0'])
|
||||
test('scheduler sim startup test',
|
||||
sched_sim_startup_test, suite: 'scheduler',
|
||||
env: ['ASAN_OPTIONS=detect_leaks=0'])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue