test(scheduler-sim-decision-parity): prove capacity-aware parity under contention (task 4.1)
Adds an integration test comparing round-by-round resInUse and scheduling outcomes between a real driven normal-mode recording and a simulation-mode replay of the identical contention scenario (worker capacity 10.0, jobs wanting 8.0/5.0/2.0, plus a 4th job proving cross-round persistence). Confirmed (by direct read of sim_picker_thread_fn(), independently re-verified in review) that sim's live picker is structurally PEND-only -- it has no capacity-check/dispatch path for a freshly-evaluated job. This means task 1.2's single-round fixture cannot be literally replayed-and- diffed for full parity: that comparison would be tautological for freshly-arriving jobs (sim always PENDs them regardless of accounting correctness) and can't prove multi-round persistence anyway. Built instead as a real recording plus a hand-crafted sim fixture modeling the identical facts, including an already-resolved-before-replay job to exercise reconciliation -- the same documented-carve-out approach test_sim_equivalence.c already established for PEND-only proofs, applied here to reconciled jobs too. No production code touched (task 3 already completed the feature). RED phase proven by temporarily reverting task 3's reconciliation call site: new test failed with "Expected 10 Was 0", restored and green. 48/49 scheduler tests pass; the 1 failure is pre-existing bug-1560 (unrelated). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
parent
1264409478
commit
b31907324c
3 changed files with 1399 additions and 1 deletions
|
|
@ -810,6 +810,29 @@ sched_sim_round_boundary_reconciliation_test = executable(
|
|||
dependencies: [scheduler_test_deps],
|
||||
install: false)
|
||||
|
||||
# Record-then-replay-and-diff parity proof for task 4.1 (Req 1.4, 2.1, 2.2):
|
||||
# extends task 1.2's resource-contention scenario (worker capacity 10.0,
|
||||
# jobs wanting 8.0/5.0/2.0) to an actual round-by-round comparison between a
|
||||
# REAL, driven normal-mode recording (this file's own Part A: real
|
||||
# builtin_fcfs picker + a capacity-aware allocator, same technique as
|
||||
# sched_sim_resource_contention_test, extended across TWO real rounds) and
|
||||
# a hand-crafted simulation-mode `.replay` fixture (Part B: same
|
||||
# JOB_STATE_CHANGE-precedes-matching-DISPATCH-decision reconciliation
|
||||
# trigger sched_sim_round_boundary_reconciliation_test establishes,
|
||||
# extended to BOTH jobs A and C together). Links a REAL (not no-op)
|
||||
# sched_account_jobs() reimplementation, augmented with a round-boundary
|
||||
# resInUse snapshot side effect, giving genuine per-round observability
|
||||
# into simulation mode's own accounting -- not just the final state. See
|
||||
# this file's own header comment for the full two-fixture design and why a
|
||||
# straight replay of task 1.2's own recorded file (unmodified) cannot prove
|
||||
# this by itself.
|
||||
sched_sim_contention_parity_test = executable(
|
||||
'sched_sim_contention_parity_test',
|
||||
['test_sim_contention_parity.c'],
|
||||
include_directories:[incdir],
|
||||
dependencies: [scheduler_test_deps],
|
||||
install: false)
|
||||
|
||||
# Contract test for the interactive simulation REPL's execution-control slice
|
||||
# (scheduler-core spec, task 12.1, Req 5 AC 22): starting simulation with
|
||||
# --interactive pauses before any event is processed, and a `step N` command
|
||||
|
|
@ -1146,6 +1169,9 @@ test('scheduler sim resource contention test',
|
|||
test('scheduler sim round boundary reconciliation test',
|
||||
sched_sim_round_boundary_reconciliation_test, suite: 'scheduler',
|
||||
env: ['ASAN_OPTIONS=detect_leaks=0'])
|
||||
test('scheduler sim contention parity test',
|
||||
sched_sim_contention_parity_test, suite: 'scheduler',
|
||||
env: ['ASAN_OPTIONS=detect_leaks=0'])
|
||||
test('scheduler repl execution control test',
|
||||
sched_repl_execution_control_test, suite: 'scheduler',
|
||||
env: ['ASAN_OPTIONS=detect_leaks=0'])
|
||||
|
|
|
|||
1371
src/scheduler/testsuite/test_sim_contention_parity.c
Normal file
1371
src/scheduler/testsuite/test_sim_contention_parity.c
Normal file
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue