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:
parent
5ee1d6cb08
commit
e48e222bd1
4 changed files with 1406 additions and 2 deletions
|
|
@ -125,7 +125,10 @@ flowchart TD
|
||||||
- `src/scheduler/testsuite/test_repl_event_echo.c` (new, per the task 3.1 Correction above) — child-process output-capture tests for Requirement 1 (mode-aware event echo classification, ending an active collapsed range on structural events/breakpoint hits).
|
- `src/scheduler/testsuite/test_repl_event_echo.c` (new, per the task 3.1 Correction above) — child-process output-capture tests for Requirement 1 (mode-aware event echo classification, ending an active collapsed range on structural events/breakpoint hits).
|
||||||
- `src/scheduler/testsuite/test_repl_output_compression.c` (new) — focused unit tests for the jobid-range-compression helper (Requirement 4): a pure function, tested without the process harness.
|
- `src/scheduler/testsuite/test_repl_output_compression.c` (new) — focused unit tests for the jobid-range-compression helper (Requirement 4): a pure function, tested without the process harness.
|
||||||
- `src/scheduler/testsuite/test_repl_resource_formatting.c` (new) — focused unit tests for the byte/megabyte classification and adaptive human-scaling helpers (Requirement 6.1, 6.2, 6.5): pure functions, tested without the process harness, mirroring `test_repl_output_compression.c`'s pattern.
|
- `src/scheduler/testsuite/test_repl_resource_formatting.c` (new) — focused unit tests for the byte/megabyte classification and adaptive human-scaling helpers (Requirement 6.1, 6.2, 6.5): pure functions, tested without the process harness, mirroring `test_repl_output_compression.c`'s pattern.
|
||||||
- `src/scheduler/testsuite/test_repl_breakpoints_inspection.c` — extended with `info worker`/`info resource` table-layout and units-mode-display tests (Requirement 6.6, alongside its existing `info worker`/`info resource` tests) and `break`'s enriched unrecognized-event-type error test (Requirement 7.5, alongside the existing `test_break_unrecognized_event_type_rejected`).
|
- `src/scheduler/testsuite/test_repl_breakpoints_inspection.c` — extended with `break`'s enriched unrecognized-event-type error test (Requirement 7.5, alongside the existing `test_break_unrecognized_event_type_rejected`).
|
||||||
|
|
||||||
|
**Correction (post-review, task 8.1)**: `info worker`/`info resource` table-layout and units-mode-display tests (Requirement 6.4-6.6) do NOT extend `test_repl_breakpoints_inspection.c` as this section originally directed — landing them there first pushed it to 3215 lines (3.2x this exact file family's own ~1000-line split trigger, the same threshold that already justified splitting `test_repl_round_rollup.c`/`test_repl_event_echo.c` out of related files). They instead live in a new `src/scheduler/testsuite/test_repl_resource_table.c` (1374 lines), duplicating the same pre-existing fixture helpers (`make_job`, `capture_stdout_around`, `capture_dispatch`, etc.) this file family's established convention already uses, decided proactively per this spec's now-standard practice rather than after a second review round.
|
||||||
|
- `src/scheduler/testsuite/test_repl_resource_table.c` (new, per the Correction above) — `info worker`'s/`info resource`'s resource-listing table/grouping layout, `units_mode`-aware rendering, and `info worker`'s assigned-job-listing jobid-range-compression adoption (Requirements 6.4, 6.5, 6.6, 4.5).
|
||||||
- `src/scheduler/testsuite/test_repl_snapshot_params.c` — extended with `set units raw|human|both` parsing/validation tests (Requirement 6.2, 6.3), alongside its existing `set speed`/`set output`/`set verify` tests.
|
- `src/scheduler/testsuite/test_repl_snapshot_params.c` — extended with `set units raw|human|both` parsing/validation tests (Requirement 6.2, 6.3), alongside its existing `set speed`/`set output`/`set verify` tests.
|
||||||
|
|
||||||
## System Flows
|
## System Flows
|
||||||
|
|
|
||||||
|
|
@ -85,7 +85,7 @@
|
||||||
- _Boundary: Resource Value Formatter_
|
- _Boundary: Resource Value Formatter_
|
||||||
|
|
||||||
- [ ] 8. (P) `info worker`/`info resource` grouped table layout and units-mode-aware rendering — Depends: 1.2, 7.2
|
- [ ] 8. (P) `info worker`/`info resource` grouped table layout and units-mode-aware rendering — Depends: 1.2, 7.2
|
||||||
- [ ] 8.1 (P) Write failing tests for the resource-listing table layout and units-mode rendering
|
- [x] 8.1 (P) Write failing tests for the resource-listing table layout and units-mode rendering
|
||||||
- Cover: `info worker`'s and `info resource`'s resource listings render as an aligned table grouped by category (consumable/capacity, load metrics, static hardware attributes, where applicable to that listing) instead of one flat list; a whole-number unitless value renders with no trailing `.00`, a fractional one keeps its decimals; each `units_mode` (`raw`/`human`/`both`) selects the corresponding rendering for a byte/megabyte-valued resource; the underlying stored/wire value and replay determinism are unaffected; `info worker`'s assigned-job listing renders using the existing jobid-range-compression helper
|
- Cover: `info worker`'s and `info resource`'s resource listings render as an aligned table grouped by category (consumable/capacity, load metrics, static hardware attributes, where applicable to that listing) instead of one flat list; a whole-number unitless value renders with no trailing `.00`, a fractional one keeps its decimals; each `units_mode` (`raw`/`human`/`both`) selects the corresponding rendering for a byte/megabyte-valued resource; the underlying stored/wire value and replay determinism are unaffected; `info worker`'s assigned-job listing renders using the existing jobid-range-compression helper
|
||||||
- Observable: the new test cases fail against today's unconditional flat per-resource `fprintf` loop and un-compressed assigned-job listing
|
- Observable: the new test cases fail against today's unconditional flat per-resource `fprintf` loop and un-compressed assigned-job listing
|
||||||
- _Requirements: 6.4, 6.5, 6.6, 4.5_
|
- _Requirements: 6.4, 6.5, 6.6, 4.5_
|
||||||
|
|
|
||||||
|
|
@ -1043,6 +1043,30 @@ sched_repl_breakpoints_inspection_test = executable(
|
||||||
dependencies: [scheduler_test_deps, libedit_dep],
|
dependencies: [scheduler_test_deps, libedit_dep],
|
||||||
install: false)
|
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
|
# Contract test for the interactive simulation REPL's snapshot-capture and
|
||||||
# simulation-parameter command slice (scheduler-core spec, task 12.3, Req 5
|
# simulation-parameter command slice (scheduler-core spec, task 12.3, Req 5
|
||||||
# AC 22 "Snapshots"/"Simulation parameters"): `snapshot [FILE]` writes a
|
# 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',
|
test('scheduler repl breakpoints inspection test',
|
||||||
sched_repl_breakpoints_inspection_test, suite: 'scheduler',
|
sched_repl_breakpoints_inspection_test, suite: 'scheduler',
|
||||||
env: ['ASAN_OPTIONS=detect_leaks=0'])
|
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',
|
test('scheduler repl snapshot params test',
|
||||||
sched_repl_snapshot_params_test, suite: 'scheduler',
|
sched_repl_snapshot_params_test, suite: 'scheduler',
|
||||||
env: ['ASAN_OPTIONS=detect_leaks=0'])
|
env: ['ASAN_OPTIONS=detect_leaks=0'])
|
||||||
|
|
|
||||||
1374
src/scheduler/testsuite/test_repl_resource_table.c
Normal file
1374
src/scheduler/testsuite/test_repl_resource_table.c
Normal file
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue