feat(scheduler-core): implement what-if branching and simulation output recording (task 11.5)
Add sim_record.c (scheduler_t-free .replay writer: ReplayHeader + loaded SnapshotEntry once, then per-event pass-through and per-session ReplaySession finalization) and wire --sim-alt-events event-source selection into sim_loop.c's drain loop, coexisting with task 11.2's stdout default and task 11.4's --sim-verify. Extract scheduler_t-free halves out of recording_session.c's begin/end so sim-side code can reuse the decision-encoding path without gaining an xce_scheduler_t* dependency, preserving Req 5 AC 17 isolation. Per Req 5 AC 16/19.
This commit is contained in:
parent
a6083d803e
commit
564408e967
14 changed files with 1750 additions and 91 deletions
|
|
@ -60,7 +60,13 @@
|
|||
* extern functions defined there; this white-box TU must include it too or
|
||||
* those calls are undefined references at link time, even though neither
|
||||
* test in this file exercises --sim-verify itself -- that is
|
||||
* test_sim_verify.c's own job) PLUS
|
||||
* test_sim_verify.c's own job) PLUS ../src/recording_session.c/
|
||||
* ../src/sim_record.c (task 11.5's sibling files -- same reasoning:
|
||||
* sched_sim_driver_run() now unconditionally references
|
||||
* sched_record_session_ctx_new()/_finalize()/sim_record_write_header_and_
|
||||
* snapshot()/sim_record_write_event() as extern functions, undefined
|
||||
* references at link time otherwise, even though this file never sets
|
||||
* --sim-output either) PLUS
|
||||
* ../src/snapshot.c/snapshot_wire.c/snapshot_load.c (task 8.1, needed by
|
||||
* both the fixture-building and sim.c's own snapshot load).
|
||||
*/
|
||||
|
|
@ -89,8 +95,10 @@
|
|||
#include "../src/plugin.c"
|
||||
#include "../src/plugins/builtin_fcfs.c"
|
||||
#include "../src/recording.c"
|
||||
#include "../src/recording_session.c"
|
||||
#include "../src/sim.c"
|
||||
#include "../src/sim_loop.c"
|
||||
#include "../src/sim_record.c"
|
||||
#include "../src/sim_verify.c"
|
||||
#include "../src/snapshot.c"
|
||||
#include "../src/snapshot_load.c"
|
||||
|
|
@ -444,13 +452,20 @@ test_process_replay_event_advances_virtual_clock_to_exact_event_ts_in_file_order
|
|||
struct capn c;
|
||||
capn_ptr root;
|
||||
xce_core_event_t ev;
|
||||
int record_rc = 0;
|
||||
int translated;
|
||||
|
||||
TEST_ASSERT_EQUAL_INT(0, capn_init_fp(&c, f, 0));
|
||||
TEST_ASSERT_TRUE(msg_root_has_shape(&c, &root, ReplayEvent_word_count,
|
||||
ReplayEvent_pointer_count));
|
||||
|
||||
translated = sim_process_replay_event_message(&sim, &c, root, &ev);
|
||||
/* record_rc: task 11.5's new --sim-output pass-through out-param
|
||||
* (sim_loop.c) -- always 0 here, sim.record_file is NULL for this
|
||||
* whole fixture (no --sim-output involved in this task's own
|
||||
* Observable). */
|
||||
translated
|
||||
= sim_process_replay_event_message(&sim, &c, root, &ev, &record_rc);
|
||||
TEST_ASSERT_EQUAL_INT(0, record_rc);
|
||||
|
||||
TEST_ASSERT_EQUAL_INT(1, translated);
|
||||
TEST_ASSERT_EQUAL_INT(XCE_CORE_EVENT_JOB_STATE_CHANGE, ev.type);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue