feat(scheduler-sim-repl-verbosity): task 8.1 - RED-phase resource table tests

Adds 10 tests in a new test_repl_resource_table.c covering info
worker's/info resource's resource-listing table/grouping layout,
units_mode-aware rendering (raw/human/both, including swp's MB->bytes
conversion and a no-mutation check on the underlying stored value),
whole-number-vs-fractional formatting, and info worker's assigned-job
listing adopting the real repl_fmt_jobid_range() (Requirements
6.4-6.6, 4.5). All 10 fail as expected against today's flat,
unconditional per-resource fprintf loop and uncompressed listing.

Found and fixed a genuine ASAN stack-use-after-return in the test's
own fixture code (not production): WORKERS_PUSH's handler moves a raw
pointer into a job's resvals rather than deep-copying, so the fixture
must heap-allocate rather than stack-allocate the structures it feeds
through that path - independently reproduced by review.

New file rather than extending test_repl_breakpoints_inspection.c:
landing this content there first pushed it to 3215 lines, 3.2x this
file family's own ~1000-line split trigger already used to justify
splitting test_repl_round_rollup.c/test_repl_event_echo.c for
structurally identical reasons.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YAWMhfRJFnmmnG8h97yUDd
This commit is contained in:
Rongsong Shen 2026-09-02 18:47:14 +00:00
parent 5ee1d6cb08
commit e48e222bd1
No known key found for this signature in database
GPG key ID: 5BCDAAE0123E9FE2
4 changed files with 1406 additions and 2 deletions

View file

@ -1043,6 +1043,30 @@ sched_repl_breakpoints_inspection_test = executable(
dependencies: [scheduler_test_deps, libedit_dep],
install: false)
# Contract test for the interactive simulation REPL's Resource Value
# Formatter table/grouping layout, units-mode rendering, and the Jobid
# Range Compressor's adoption in `info worker`'s assigned-job listing
# (scheduler-sim-repl-verbosity spec, task 8.1, Requirements 6.4, 6.5, 6.6,
# 4.5). 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,
# sim_loop.c, sim_record.c, sim_verify.c,
# snapshot.c/snapshot_wire.c/snapshot_load.c, repl.c, repl_fmt.c,
# repl_rollup.c, repl_break.c, repl_info.c, repl_params.c). Split into its
# own file rather than appended to test_repl_breakpoints_inspection.c --
# landing these ten tests there per design.md's own File Structure Plan
# pushed that file from 2095 to 3215 lines, well past the ~1000-line split
# trigger this exact file family already established (the same reasoning
# that already split test_repl_round_rollup.c/test_repl_event_echo.c out;
# see this file's own header comment for the full rationale).
sched_repl_resource_table_test = executable(
'sched_repl_resource_table_test',
['test_repl_resource_table.c'],
include_directories:[incdir],
dependencies: [scheduler_test_deps, libedit_dep],
install: false)
# Contract test for the interactive simulation REPL's snapshot-capture and
# simulation-parameter command slice (scheduler-core spec, task 12.3, Req 5
# AC 22 "Snapshots"/"Simulation parameters"): `snapshot [FILE]` writes a
@ -1515,6 +1539,9 @@ test('scheduler sim print decision gate test',
test('scheduler repl breakpoints inspection test',
sched_repl_breakpoints_inspection_test, suite: 'scheduler',
env: ['ASAN_OPTIONS=detect_leaks=0'])
test('scheduler repl resource table test',
sched_repl_resource_table_test, suite: 'scheduler',
env: ['ASAN_OPTIONS=detect_leaks=0'])
test('scheduler repl snapshot params test',
sched_repl_snapshot_params_test, suite: 'scheduler',
env: ['ASAN_OPTIONS=detect_leaks=0'])

File diff suppressed because it is too large Load diff