feat(scheduler-sim-discrete-clock): remove the simulator speed argument and shadow copy (task 3.1)

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Rongsong Shen 2026-09-29 05:19:34 +00:00
parent eb5f339541
commit aa2bb6d090
Signed by untrusted user: rshen
GPG key ID: 80533536B0EB651C
32 changed files with 72 additions and 129 deletions

View file

@ -295,6 +295,12 @@ struct xce_sched_core_s {
* after xce_sched_core_init()); the simulation driver does so via
* sim.c's sim_set_virtual_clock(). Only bare-core test fixtures that
* never call either keep the neutral (0,0,1,1) default.
*
* speed_num/speed_den are not a user-selectable speed: they hold 1/1 in
* normal mode (the clock tracks wall-clock time) and 0/1 in simulation
* mode (scheduler-sim-discrete-clock: the simulator clock is frozen and
* moves only when the replay loop sets virtual_clock_base to a recorded
* timestamp).
*/
_Atomic uint64_t virtual_clock_base;
_Atomic uint64_t real_clock_base;

View file

@ -41,13 +41,6 @@
* FILE *record_file; -- optional --sim-output stream
* (task 11.5 writes to it; this
* task only opens it)
* uint64_t sim_speed_num/sim_speed_den -- the SAME two numbers this task
* also stamps onto
* `core.speed_num`/`core.speed_den`
* (kept here too per design.md's
* literal struct, e.g. for the
* REPL/diagnostics to read without
* reaching into `core`)
* bool verify; -- --sim-verify (task 11.4 acts on
* it; this task only stores it)
* bool interactive; -- --interactive/-i (task 12 acts on
@ -57,14 +50,12 @@
* struct sketch (scheduler-core spec, task 11.5, Req 5 AC 19) -- added, not
* merely implied, because writing a `--sim-output` file's initial
* SnapshotEntry needs the EXACT timestamp Step 2's snapshot scan
* (sim_locate_and_load_snapshot(), sim.c) chose, and re-deriving it via
* xce_core_now(&sim->core) from inside sim_loop.c's event loop is NOT
* equivalent for any --sim-speed other than frozen (0): the virtual clock
* keeps advancing with real wall-clock time between
* sched_sim_driver_start() returning and sim_loop.c's first opportunity to
* write the output header/snapshot, so a re-derived value would drift from
* "the same SnapshotEntry that was loaded" (AC 19's own wording -- same ts,
* not merely a same-shaped one taken moments later).
* (sim_locate_and_load_snapshot(), sim.c) chose. The simulator clock moves
* only at recorded timestamps (the replay loop stamps each event's own
* timestamp onto it), so by the time sim_loop.c writes the output
* header/snapshot xce_core_now(&sim->core) may already have moved to a later
* recorded value; storing the chosen timestamp keeps the output's initial
* entry "the same SnapshotEntry that was loaded" (AC 19's own wording).
*
* `repl_state` below is a SECOND field beyond design.md's literal sketch
* (scheduler-core spec, task 12.1, Req 5 AC 22) -- the interactive REPL's
@ -87,8 +78,6 @@ typedef struct {
FILE* replay_file;
FILE* alt_events_file;
FILE* record_file;
uint64_t sim_speed_num;
uint64_t sim_speed_den;
bool verify;
bool interactive;
uint64_t snapshot_ts;
@ -134,8 +123,10 @@ typedef struct {
* 13's "The scheduler shall support simulation mode activated by --sim FILE
* and --sim-start-ts TIMESTAMP", plus this task's own "Add the simulation-
* mode CLI flags (replay file path, start timestamp, speed, verify,
* alt-events file, output file, interactive)" bullet -- all seven listed
* there are fields below). Populated by main.c's argp parsing, passed by
* alt-events file, output file, interactive)" bullet -- every flag listed
* there except speed is a field below; --sim-speed is a deprecated no-op
* whose value main.c only logs, since the simulator clock moves only at
* recorded timestamps). Populated by main.c's argp parsing, passed by
* const pointer into sched_sim_driver_start()/sched_sim_driver_run().
*
* Deliberately a plain, self-contained struct -- only primitive/string
@ -152,9 +143,6 @@ typedef struct {
const char* replay_path; /* --sim FILE (required) */
uint64_t sim_start_ts; /* --sim-start-ts TIMESTAMP (optional;
* default SCHED_SIM_START_TS_LATEST) */
uint64_t sim_speed; /* --sim-speed N: 0=as-fast-as-possible,
* 1=real-time, N>1=N x real-time
* (optional; default 1) */
bool verify; /* --sim-verify (task 11.4) */
const char*
alt_events_path; /* --sim-alt-events FILE (optional, task 11.5) */
@ -218,9 +206,10 @@ typedef struct {
* not from core.c -- core.c's "zero wall-clock calls" isolation boundary,
* test_core_isolation.c, is scoped to core.c specifically, not to driver-
* level code that legitimately seeds the core's clock anchors), and
* `sim->core.speed_num`/`speed_den` to `args->sim_speed`/1. From this point,
* `xce_core_now(&sim->core)` returns virtual time computed from the
* snapshot's own logical timestamp -- this function's own Observable.
* `sim->core.speed_num`/`speed_den` to 0/1 (frozen: the simulator clock
* moves only when the replay loop stamps a recorded timestamp onto it, never
* with wall-clock time). From this point, `xce_core_now(&sim->core)` returns
* the snapshot's own logical timestamp -- this function's own Observable.
*
* Known scope boundary: this function does NOT register any picker plugin
* into `sim->core.plugins` (builtin_fcfs and friends are only registrable

View file

@ -70,9 +70,12 @@ struct arguments {
* here, same as sim_file/record_dir above -- numeric/bool
* interpretation happens in main() after argp_parse() returns (see
* sched_sim_args_t's own field comments, sim.h, for each flag's
* meaning/default). */
* meaning/default). --sim-speed is the exception: it has no
* sched_sim_args_t field (the simulator clock moves only at recorded
* timestamps); its raw value is kept only for the deprecation warning. */
char* sim_start_ts; /* --sim-start-ts TIMESTAMP */
char* sim_speed; /* --sim-speed N */
char* sim_speed; /* --sim-speed N (deprecated no-op; value only
* logged by sched_cli_warn_deprecated_options) */
int sim_verify; /* --sim-verify */
char* sim_alt_events; /* --sim-alt-events FILE */
char* sim_output; /* --sim-output FILE */

View file

@ -313,10 +313,7 @@ static int sim_locate_and_load_snapshot(xce_sched_sim_driver_t* sim,
* xce_core_now() returns exactly snapshot_ts, and afterwards exactly the
* last value sim_advance_virtual_clock() (sim_loop.c) set, however much
* real time passes. This is the only place simulation mode sets the speed;
* the --sim-speed value (sched_sim_args_t.sim_speed) is no longer read.
* The sim_speed_num/sim_speed_den shadow copy is still written (always
* 0/1) for `info config` and test_sim_startup.c; the shadow copy and
* sched_sim_args_t.sim_speed are removed in task 3.1.
* the simulator has no speed argument (--sim-speed is a deprecated no-op).
*/
static void sim_set_virtual_clock(xce_sched_sim_driver_t* sim,
uint64_t snapshot_ts)
@ -334,9 +331,6 @@ static void sim_set_virtual_clock(xce_sched_sim_driver_t* sim,
memory_order_release);
atomic_store_explicit(&(sim->core.speed_num), 0, memory_order_release);
atomic_store_explicit(&(sim->core.speed_den), 1, memory_order_release);
sim->sim_speed_num = 0;
sim->sim_speed_den = 1;
}
/*

View file

@ -316,7 +316,8 @@ sched_core_session_test = executable(
# Contract test for clock virtualization and session timing (scheduler-core
# spec, task 4.5, Req 5 AC 3 / AC 12): xce_core_now()'s two-anchor + speed
# formula for all four documented modes, xce_core_tlog_format()'s tlog
# formula (normal 1/1, simulation frozen 0/1, plus formula tests with other
# ratios), xce_core_tlog_format()'s tlog
# integration (frozen virtual time shown instead of info->time's real
# wall-clock read), and session_start/session_duration_ns tracking across a
# real xce_core_go()/xce_core_end_session() cycle. Same white-box #include
@ -563,7 +564,7 @@ sched_admin_request_test = executable(
# 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
# anchors from the loaded snapshot's timestamp, frozen (speed 0/1). 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
@ -1175,9 +1176,9 @@ sched_repl_limit_table_test = executable(
# sections in a fixed order, aligns every command's description to one
# consistent column position throughout, lists `info config` together with
# its `info` siblings in the state-inspection section, lists `set units`
# alongside `set speed`/`set output`/`set verify` in the snapshot-and-
# parameters section, and enumerates the complete BP_KIND_TABLE event-type
# set on the `break` line. Same white-box #include pattern as
# alongside `set output`/`set verify` in the snapshot-and-parameters
# section (`set speed` was removed, scheduler-sim-discrete-clock), and
# enumerates the complete BP_KIND_TABLE event-type set on the `break` line. Same white-box #include pattern as
# sched_repl_resource_table_test above (core.c, core_clock.c, core_events.c,
# core_session.c, decision.c, plugin.c, plugins/builtin_fcfs.c, recording.c,
# recording_session.c, sim.c, sim_loop.c, sim_record.c, sim_verify.c,
@ -1208,8 +1209,9 @@ sched_repl_help_test = executable(
# standalone .replay file a FRESH sched_sim_driver_start() can load, landing
# on the exact position the snapshot was taken at (the task's own central
# Observable, proved end to end via a forked child + a second, real
# sched_sim_driver_start() call in the parent); `set speed`/`set output`/
# `set verify` mutate the parameters `info config` reports. Same white-box
# sched_sim_driver_start() call in the parent); `set output`/`set verify`
# mutate the parameters `info config` reports, and the removed `set speed`
# prints a removal message and changes nothing. Same white-box
# #include pattern as sched_repl_breakpoints_inspection_test above (core.c,
# core_clock.c, core_events.c, core_session.c, decision.c, plugin.c,
# plugins/builtin_fcfs.c, recording.c, recording_session.c, sim.c,

View file

@ -4,16 +4,20 @@
*
* Observable under test:
* - xce_core_now() implements the two-anchor + speed formula (Req 5 AC 3)
* exactly, for all four documented operating modes (normal, discrete
* simulation, real-time simulation, fast/slow simulation), given fixed
* anchor values -- no sleep-based real-elapsed-time assertions. Where a
* mode's own definition makes the output track real wall-clock time
* (normal, real-time, fast/slow), the test brackets the result between
* two back-to-back CLOCK_MONOTONIC reads taken immediately before/after
* exactly, given fixed anchor values -- no sleep-based
* real-elapsed-time assertions. The product uses two settings of the
* speed atoms: 1/1 in normal mode and 0/1 (frozen) in simulation mode
* (scheduler-sim-discrete-clock: the simulator has no speed modes).
* Three further tests exercise the formula itself with an arbitrary
* virtual anchor and with ratios 1/1, N/1 and 1/N; they test the
* arithmetic, not any product mode. Where the ratio is non-zero the
* output tracks real wall-clock time, so the test brackets the result
* between two back-to-back CLOCK_MONOTONIC reads taken immediately
* before/after
* the call -- deterministic (time is monotonic, so the bracket always
* holds) and fast (nanoseconds of real work between the two reads), NOT
* the sleep-then-check-approximate-elapsed pattern this task forbids.
* Discrete-simulation (frozen, speed=0/1) collapses the bracket to an
* Simulation mode (frozen, speed=0/1) collapses the bracket to an
* exact equality since elapsed*0/den is always 0 regardless of when the
* test runs.
* - xce_core_tlog_format() (core_clock.c's registered tlog_format_func)
@ -161,12 +165,11 @@ static void test_xce_core_now_discrete_simulation_frozen_at_event_ts(void)
}
static void
test_xce_core_now_realtime_simulation_tracks_wall_clock_from_anchor(void)
test_xce_core_now_unit_ratio_tracks_wall_clock_from_virtual_anchor(void)
{
/* Simulation real-time (AC 3's table): virtual_clock_base=snapshot ts,
* real_clock_base=wall at load, speed=1/1 -- tracks wall clock from the
* virtual anchor: result is between [snapshot_ts, snapshot_ts +
* (after-before)]. */
/* Formula test: an arbitrary virtual_clock_base, real_clock_base=wall
* now, speed=1/1 -- the result advances with the wall clock from the
* virtual anchor: it lies in [anchor, anchor + (after-before)]. */
xce_sched_core_t core;
const uint64_t SNAPSHOT_TS = 500000000000ULL;
uint64_t before, result, after;
@ -182,10 +185,10 @@ test_xce_core_now_realtime_simulation_tracks_wall_clock_from_anchor(void)
TEST_ASSERT_TRUE(result <= SNAPSHOT_TS + (after - before));
}
static void test_xce_core_now_fast_simulation_scales_up_by_speed(void)
static void test_xce_core_now_ratio_above_one_scales_elapsed_up(void)
{
/* Simulation fast (AC 3's table): speed=N/1 -- runs N times faster than
* wall clock. Bracket scaled by N. */
/* Formula test: speed=N/1 -- elapsed wall time is multiplied by N.
* Bracket scaled by N. */
xce_sched_core_t core;
const uint64_t SNAPSHOT_TS = 1000ULL;
const uint64_t N = 1000ULL;
@ -202,11 +205,10 @@ static void test_xce_core_now_fast_simulation_scales_up_by_speed(void)
TEST_ASSERT_TRUE(result <= SNAPSHOT_TS + (after - before) * N);
}
static void test_xce_core_now_slow_simulation_scales_down_by_speed(void)
static void test_xce_core_now_ratio_below_one_scales_elapsed_down(void)
{
/* Simulation slow (AC 3's table): speed=1/N -- runs N times slower than
* wall clock. Bracket scaled down by N (+1 for integer-division
* rounding slack). */
/* Formula test: speed=1/N -- elapsed wall time is divided by N.
* Bracket scaled down by N (+1 for integer-division rounding slack). */
xce_sched_core_t core;
const uint64_t SNAPSHOT_TS = 1000ULL;
const uint64_t N = 1000ULL;
@ -494,9 +496,9 @@ int main(void)
RUN_TEST(test_xce_core_now_normal_mode_matches_wall_clock);
RUN_TEST(test_xce_core_now_discrete_simulation_frozen_at_event_ts);
RUN_TEST(
test_xce_core_now_realtime_simulation_tracks_wall_clock_from_anchor);
RUN_TEST(test_xce_core_now_fast_simulation_scales_up_by_speed);
RUN_TEST(test_xce_core_now_slow_simulation_scales_down_by_speed);
test_xce_core_now_unit_ratio_tracks_wall_clock_from_virtual_anchor);
RUN_TEST(test_xce_core_now_ratio_above_one_scales_elapsed_up);
RUN_TEST(test_xce_core_now_ratio_below_one_scales_elapsed_down);
RUN_TEST(test_xce_sched_core_init_seeds_normal_mode_defaults);
RUN_TEST(test_xce_core_set_wallclock_anchor_seeds_real_epoch_time);
RUN_TEST(test_xce_core_set_wallclock_anchor_null_core_is_a_safe_noop);

View file

@ -2017,7 +2017,6 @@ static void run_group_d_child(const char* replay_path,
memset(&args, 0, sizeof(args));
args.replay_path = replay_path;
args.sim_start_ts = SCHED_SIM_START_TS_LATEST;
args.sim_speed = 0;
args.interactive = true;
(void)sched_sim_driver_run(&sim, &args);

View file

@ -860,9 +860,6 @@ test_repl_step_continue_to_completion_matches_batch_decision_sequence(void)
memset(&args_batch, 0, sizeof(args_batch));
args_batch.replay_path = fixture_path;
args_batch.sim_start_ts = SCHED_SIM_START_TS_LATEST;
args_batch.sim_speed = 0; /* frozen -- deterministic, no wall-clock
* skew, matching every other equivalence
* fixture in this directory */
args_batch.output_path = batch_out_path;
args_batch.interactive = false;
@ -892,7 +889,6 @@ test_repl_step_continue_to_completion_matches_batch_decision_sequence(void)
memset(&args_repl, 0, sizeof(args_repl));
args_repl.replay_path = fixture_path;
args_repl.sim_start_ts = SCHED_SIM_START_TS_LATEST;
args_repl.sim_speed = 0;
args_repl.output_path = repl_out_path;
args_repl.interactive = true;

View file

@ -659,7 +659,6 @@ static void child_run_repl_and_exit(const char* replay_path,
memset(&args, 0, sizeof(args));
args.replay_path = replay_path;
args.sim_start_ts = SCHED_SIM_START_TS_LATEST;
args.sim_speed = 0;
args.interactive = true;
(void)sched_sim_driver_run(&sim, &args);

View file

@ -741,7 +741,6 @@ static void child_prepause_then_quit(const char* replay_path,
memset(&args, 0, sizeof(args));
args.replay_path = replay_path;
args.sim_start_ts = SCHED_SIM_START_TS_LATEST;
args.sim_speed = 0;
args.interactive = true;
(void)sched_sim_driver_run(&sim, &args);
@ -867,7 +866,6 @@ static void child_continue_then_inspect(const char* replay_path,
memset(&args, 0, sizeof(args));
args.replay_path = replay_path;
args.sim_start_ts = SCHED_SIM_START_TS_LATEST;
args.sim_speed = 0;
args.interactive = true;
(void)sched_sim_driver_run(&sim, &args);
@ -962,7 +960,6 @@ static void child_continue_twice_after_complete(const char* replay_path,
memset(&args, 0, sizeof(args));
args.replay_path = replay_path;
args.sim_start_ts = SCHED_SIM_START_TS_LATEST;
args.sim_speed = 0;
args.interactive = true;
(void)sched_sim_driver_run(&sim, &args);
@ -1067,7 +1064,6 @@ static void child_step_then_quit(const char* replay_path,
memset(&args, 0, sizeof(args));
args.replay_path = replay_path;
args.sim_start_ts = SCHED_SIM_START_TS_LATEST;
args.sim_speed = 0;
args.interactive = true;
(void)sched_sim_driver_run(&sim, &args);

View file

@ -2759,7 +2759,6 @@ static void det_run_scripted_repl_session(const char* fixture_path,
memset(&args, 0, sizeof(args));
args.replay_path = (char*)fixture_path;
args.sim_start_ts = SCHED_SIM_START_TS_LATEST;
args.sim_speed = 0;
args.output_path = out_path;
args.interactive = true;

View file

@ -638,7 +638,6 @@ static char* run_repl_via_pty(const char* replay_path, const char* script)
memset(&args, 0, sizeof(args));
args.replay_path = replay_path;
args.sim_start_ts = SCHED_SIM_START_TS_LATEST;
args.sim_speed = 0;
args.interactive = true;
(void)sched_sim_driver_run(&sim, &args);

View file

@ -776,7 +776,6 @@ static void child_run_repl_and_exit(const char* replay_path,
memset(&args, 0, sizeof(args));
args.replay_path = replay_path;
args.sim_start_ts = SCHED_SIM_START_TS_LATEST;
args.sim_speed = 0;
args.interactive = true;
(void)sched_sim_driver_run(&sim, &args);

View file

@ -676,7 +676,6 @@ static void child_step_snapshot_quit(const char* replay_path,
memset(&args, 0, sizeof(args));
args.replay_path = replay_path;
args.sim_start_ts = SCHED_SIM_START_TS_LATEST;
args.sim_speed = 0; /* frozen virtual clock -- deterministic ts */
args.interactive = true;
(void)sched_sim_driver_run(&sim, &args);
@ -812,7 +811,6 @@ static void child_step_snapshot_noarg_quit(const char* replay_path,
memset(&args, 0, sizeof(args));
args.replay_path = replay_path;
args.sim_start_ts = SCHED_SIM_START_TS_LATEST;
args.sim_speed = 0;
args.interactive = true;
(void)sched_sim_driver_run(&sim, &args);
@ -1312,8 +1310,6 @@ static void test_info_config_reports_current_parameters(void)
g_cfg_sim.repl_state = repl_state_ensure(&g_cfg_sim);
TEST_ASSERT_NOT_NULL(g_cfg_sim.repl_state);
g_cfg_sim.sim_speed_num = 3;
g_cfg_sim.sim_speed_den = 1;
g_cfg_sim.verify = true;
g_cfg_sim.repl_state->event_index = 7;
g_cfg_sim.repl_state->session_count = 2;

View file

@ -27,8 +27,8 @@
* this file exercises the same real sched_sim_driver_run() end-to-end,
* forked-child, real-stdout-capture technique. Discrete-simulation
* determinism note (research.md's own key finding, load-bearing for every
* test below): `child_run_repl_and_exit()` sets args.sim_speed = 0, which
* sim_set_virtual_clock() (sim.c) stores as core.speed_num == 0; with
* test below): simulation mode always runs the core clock frozen --
* sim_set_virtual_clock() (sim.c) stores core.speed_num == 0; with
* speed_num == 0, xce_core_now()'s (core_clock.c) `elapsed * num / den` term
* is always exactly zero, so xce_core_now() returns EXACTLY the raw
* nanosecond `ts` value most recently passed to sim_advance_virtual_clock()
@ -634,9 +634,10 @@ static char* read_whole_file(const char* path)
/* child_run_repl_and_exit / run_repl_fixture_and_capture - the same fork/
* freopen/waitpid/capture shape test_repl_event_echo.c's own pair
* establishes: run a scripted command sequence to completion against a real
* sched_sim_driver_run(), capturing real stdout. args.sim_speed = 0 below is
* this file's own load-bearing determinism note (see header comment) -- it
* is what makes xce_core_now() return EXACTLY each event's own `ts`. */
* sched_sim_driver_run(), capturing real stdout. The simulator's frozen
* clock is this file's own load-bearing determinism note (see header
* comment) -- it is what makes xce_core_now() return EXACTLY each event's
* own `ts`. */
static void child_run_repl_and_exit(const char* replay_path,
const char* script_path,
const char* capture_path)
@ -655,7 +656,6 @@ static void child_run_repl_and_exit(const char* replay_path,
memset(&args, 0, sizeof(args));
args.replay_path = replay_path;
args.sim_start_ts = SCHED_SIM_START_TS_LATEST;
args.sim_speed = 0;
args.interactive = true;
(void)sched_sim_driver_run(&sim, &args);

View file

@ -603,7 +603,6 @@ static char* run_sim_and_capture_stdout(const char* base_path,
memset(&args, 0, sizeof(args));
args.replay_path = base_path;
args.sim_start_ts = SCHED_SIM_START_TS_LATEST;
args.sim_speed = 0; /* frozen -- deterministic, no wall-clock wait */
args.alt_events_path = alt_path;
*out_rc = sched_sim_driver_run(&sim, &args);

View file

@ -1461,7 +1461,6 @@ test_contention_parity_matches_real_normal_mode_recording_round_by_round(
memset(&sim_args, 0, sizeof(sim_args));
sim_args.replay_path = sim_r_path;
sim_args.sim_start_ts = SCHED_SIM_START_TS_LATEST;
sim_args.sim_speed = 0; /* frozen -- deterministic, no wall-clock skew */
memset(&sim, 0, sizeof(sim));
g_capturing = 1;
@ -1812,7 +1811,6 @@ static void run_multiround_contention_fixture(xce_sched_sim_driver_t* sim_out,
memset(&sim_args, 0, sizeof(sim_args));
sim_args.replay_path = r_path;
sim_args.sim_start_ts = SCHED_SIM_START_TS_LATEST;
sim_args.sim_speed = 0; /* frozen -- deterministic, no wall-clock skew */
memset(sim_out, 0, sizeof(*sim_out));
rc = sched_sim_driver_run(sim_out, &sim_args);

View file

@ -13,11 +13,10 @@
* Testing Strategy: Unit (SimClock) and Integration (replay loop)): in
* simulation mode the logical clock moves only at the start snapshot, at
* each recorded event and at each recorded session, is set exactly (never
* clamped, even backwards), and never drifts with real time. Every clock
* test passes a non-zero speed through the still-present
* sched_sim_args_t.sim_speed (DISCRETE_CLOCK_RED_SPEED) to prove the
* simulator no longer reads it; task 3.1 removes that field and these
* assignments while keeping the pinned-clock assertions.
* clamped, even backwards), and never drifts with real time. (Task 2.1
* proved RED by passing a non-zero speed through the simulator's speed
* argument; task 3.1 removed that argument, and these tests keep asserting
* the pinned clock.)
*
* White-box #include of the same simulator TU set test_sim_record_output.c
* uses, with its link-satisfying stubs and stand-in picker; the stand-in
@ -465,10 +464,6 @@ static void test_no_warning_when_option_absent(void)
/* chosen value first, so the recorded start snapshot's ts is exact. */
/* ---------------------------------------------------------------------- */
/* Task 2.1 RED: a non-zero speed through the still-present simulator
* argument. The simulator must ignore it; removed with the field in 3.1. */
#define DISCRETE_CLOCK_RED_SPEED 7
#define SNAP_TS 1000000000000ULL /* start snapshot, 1000 s */
#define JOB_A 4101ULL
#define JOB_B 4102ULL
@ -622,7 +617,6 @@ static void sim_args_init(sched_sim_args_t* args, const char* replay_path)
memset(args, 0, sizeof(*args));
args->replay_path = replay_path;
args->sim_start_ts = SCHED_SIM_START_TS_LATEST;
args->sim_speed = DISCRETE_CLOCK_RED_SPEED;
}
/* Runs a batch replay with `sim` as the observed core. */

View file

@ -580,7 +580,6 @@ test_sim_replay_shows_real_global_and_host_scoped_limit_usage(void)
memset(&args, 0, sizeof(args));
args.replay_path = path;
args.sim_start_ts = SCHED_SIM_START_TS_LATEST;
args.sim_speed = 0;
rc = sched_sim_driver_run(&g_sim, &args);
TEST_ASSERT_EQUAL_INT_MESSAGE(

View file

@ -1368,7 +1368,6 @@ static void child_replay(const char* replay_path, const char* script_path,
memset(&args, 0, sizeof(args));
args.replay_path = replay_path;
args.sim_start_ts = SCHED_SIM_START_TS_LATEST;
args.sim_speed = 0; /* frozen -- deterministic */
args.interactive = true;
(void)sched_sim_driver_run(&sim, &args);

View file

@ -1016,7 +1016,6 @@ test_normal_mode_recording_and_simulation_replay_produce_identical_decisions(
memset(&sim_args, 0, sizeof(sim_args));
sim_args.replay_path = r_path;
sim_args.sim_start_ts = SCHED_SIM_START_TS_LATEST;
sim_args.sim_speed = 0; /* frozen -- deterministic, no wall-clock skew */
sim_args.output_path = s_path;
rc = sched_sim_driver_run(&sim, &sim_args);

View file

@ -808,7 +808,6 @@ test_run_processes_multiple_sessions_in_order_and_no_longer_returns_enosys(void)
memset(&args, 0, sizeof(args));
args.replay_path = path;
args.sim_start_ts = SCHED_SIM_START_TS_LATEST;
args.sim_speed = 0; /* frozen -- deterministic final-clock assertion */
rc = sched_sim_driver_run(&sim, &args);
@ -865,7 +864,6 @@ test_run_deactivates_tlog_virtual_clock_logging_on_completion(void)
memset(&args, 0, sizeof(args));
args.replay_path = path;
args.sim_start_ts = SCHED_SIM_START_TS_LATEST;
args.sim_speed = 0;
xce_core_set_active_for_logging((xce_sched_core_t*)0x1); /* bogus sentinel */
@ -983,7 +981,6 @@ static char* run_sim_and_capture_stdout(const char* path, int* out_rc)
memset(&args, 0, sizeof(args));
args.replay_path = path;
args.sim_start_ts = SCHED_SIM_START_TS_LATEST;
args.sim_speed = 0; /* frozen -- deterministic, no wall-clock wait */
*out_rc = sched_sim_driver_run(&sim, &args);

View file

@ -444,7 +444,6 @@ static char* run_sim_and_capture_stdout(xce_sched_sim_driver_t* sim,
memset(&args, 0, sizeof(args));
args.replay_path = path;
args.sim_start_ts = SCHED_SIM_START_TS_LATEST;
args.sim_speed = 0;
args.verify = verify;
*out_rc = sched_sim_driver_run(sim, &args);
@ -580,7 +579,6 @@ test_sim_driver_run_dispatches_a_job_with_available_resources(void)
memset(&args, 0, sizeof(args));
args.replay_path = path;
args.sim_start_ts = SCHED_SIM_START_TS_LATEST;
args.sim_speed = 0;
rc = sched_sim_driver_run(&g_sim, &args);
TEST_ASSERT_EQUAL_INT_MESSAGE(

View file

@ -663,7 +663,6 @@ static void child_run_repl_and_exit(const char* replay_path,
memset(&args, 0, sizeof(args));
args.replay_path = replay_path;
args.sim_start_ts = SCHED_SIM_START_TS_LATEST;
args.sim_speed = 0;
args.interactive = true;
(void)sched_sim_driver_run(&sim, &args);
@ -739,7 +738,6 @@ static char* run_sim_and_capture_stdout(const char* replay_path, int* out_rc)
memset(&args, 0, sizeof(args));
args.replay_path = replay_path;
args.sim_start_ts = SCHED_SIM_START_TS_LATEST;
args.sim_speed = 0; /* frozen -- deterministic, no wall-clock wait */
/* args.interactive left false -- this is the headless/batch path. */
*out_rc = sched_sim_driver_run(&sim, &args);

View file

@ -593,7 +593,6 @@ static void test_output_file_is_decodable_with_full_stream_symmetry(void)
memset(&args, 0, sizeof(args));
args.replay_path = base_path;
args.sim_start_ts = SCHED_SIM_START_TS_LATEST;
args.sim_speed = 0; /* frozen -- deterministic snapshot_ts */
args.output_path = out_path;
rc = sched_sim_driver_run(&sim, &args);
@ -786,7 +785,6 @@ static void test_output_file_reflects_alt_events_not_base_when_both_set(void)
memset(&args, 0, sizeof(args));
args.replay_path = base_path;
args.sim_start_ts = SCHED_SIM_START_TS_LATEST;
args.sim_speed = 0;
args.alt_events_path = alt_path;
args.output_path = out_path;

View file

@ -1062,7 +1062,6 @@ static void test_contention_fixture_is_replayable_via_simulation_driver(void)
memset(&sim_args, 0, sizeof(sim_args));
sim_args.replay_path = r_path;
sim_args.sim_start_ts = SCHED_SIM_START_TS_LATEST;
sim_args.sim_speed = 0; /* frozen -- deterministic, no wall-clock skew */
memset(&sim, 0, sizeof(sim));
rc = sched_sim_driver_run(&sim, &sim_args);

View file

@ -866,7 +866,6 @@ test_reconciled_job_charges_resinuse_before_live_capacity_check(void)
memset(&sim_args, 0, sizeof(sim_args));
sim_args.replay_path = r_path;
sim_args.sim_start_ts = SCHED_SIM_START_TS_LATEST;
sim_args.sim_speed = 0; /* frozen -- deterministic, no wall-clock skew */
memset(&sim, 0, sizeof(sim));
rc = sched_sim_driver_run(&sim, &sim_args);

View file

@ -901,7 +901,6 @@ test_sim_replay_calls_account_jobs_once_per_round_within_session_window(
memset(&sim_args, 0, sizeof(sim_args));
sim_args.replay_path = r_path;
sim_args.sim_start_ts = SCHED_SIM_START_TS_LATEST;
sim_args.sim_speed = 0; /* frozen -- deterministic, no wall-clock skew */
memset(&sim, 0, sizeof(sim));
rc = sched_sim_driver_run(&sim, &sim_args);
@ -1010,7 +1009,6 @@ static void test_sim_replay_batch_mode_uses_the_same_round_boundary(void)
memset(&sim_args, 0, sizeof(sim_args));
sim_args.replay_path = r_path;
sim_args.sim_start_ts = SCHED_SIM_START_TS_LATEST;
sim_args.sim_speed = 0;
memset(&sim, 0, sizeof(sim));
TEST_ASSERT_EQUAL_INT(0, sim.interactive); /* batch: default-zero, never set */

View file

@ -704,7 +704,6 @@ static char* run_sim_and_capture_stdout(const char* path,
memset(&args, 0, sizeof(args));
args.replay_path = path;
args.sim_start_ts = SCHED_SIM_START_TS_LATEST;
args.sim_speed = 0; /* frozen -- deterministic, no wall-clock wait */
args.verify = verify;
*out_rc = sched_sim_driver_run(out_sim, &args);

View file

@ -419,10 +419,6 @@ test_valid_fixture_reaches_ready_state_with_frozen_virtual_clock(void)
memset(&args, 0, sizeof(args));
args.replay_path = path;
args.sim_start_ts = SCHED_SIM_START_TS_LATEST;
args.sim_speed = 0; /* fast/frozen -- xce_core_now() stays pinned to
* virtual_clock_base regardless of real elapsed
* time, giving this test a deterministic,
* non-flaky assertion. */
rc = sched_sim_driver_start(&sim, &args);
TEST_ASSERT_EQUAL_INT(0, rc);
@ -439,8 +435,6 @@ test_valid_fixture_reaches_ready_state_with_frozen_virtual_clock(void)
memory_order_acquire));
TEST_ASSERT_EQUAL_UINT64(1ULL, atomic_load_explicit(&(sim.core.speed_den),
memory_order_acquire));
TEST_ASSERT_EQUAL_UINT64(0ULL, sim.sim_speed_num);
TEST_ASSERT_EQUAL_UINT64(1ULL, sim.sim_speed_den);
/* "Ready-to-run" -- no session is active, load_snapshot()'s own
* precondition would otherwise have been violated. */
@ -481,7 +475,6 @@ static void test_valid_fixture_activates_virtual_clock_for_tlog_logging(void)
memset(&args, 0, sizeof(args));
args.replay_path = path;
args.sim_start_ts = SCHED_SIM_START_TS_LATEST;
args.sim_speed = 0;
rc = sched_sim_driver_start(&sim, &args);
TEST_ASSERT_EQUAL_INT(0, rc);
@ -518,7 +511,6 @@ static void test_missing_initial_snapshot_entry_fails_cleanly(void)
memset(&args, 0, sizeof(args));
args.replay_path = header_only_path;
args.sim_start_ts = SCHED_SIM_START_TS_LATEST;
args.sim_speed = 1;
rc = sched_sim_driver_start(&sim, &args);
TEST_ASSERT_TRUE(rc < 0);
@ -546,7 +538,6 @@ static void test_first_message_not_replayheader_fails_cleanly(void)
memset(&args, 0, sizeof(args));
args.replay_path = path;
args.sim_start_ts = SCHED_SIM_START_TS_LATEST;
args.sim_speed = 1;
rc = sched_sim_driver_start(&sim, &args);
TEST_ASSERT_TRUE(rc < 0);
@ -568,7 +559,6 @@ static void test_missing_replay_file_fails_cleanly(void)
memset(&args, 0, sizeof(args));
args.replay_path = "/nonexistent/path/does_not_exist.replay";
args.sim_start_ts = SCHED_SIM_START_TS_LATEST;
args.sim_speed = 1;
rc = sched_sim_driver_start(&sim, &args);
TEST_ASSERT_TRUE(rc < 0);

View file

@ -1517,7 +1517,6 @@ static char* run_sim_and_capture_stdout(const char* path, bool verify,
memset(&args, 0, sizeof(args));
args.replay_path = path;
args.sim_start_ts = SCHED_SIM_START_TS_LATEST;
args.sim_speed = 0; /* frozen -- deterministic, no wall-clock wait */
args.verify = verify;
*out_rc = sched_sim_driver_run(&sim, &args);