feat(scheduler-sim-decision-trace): core trace gate and SCHED_TRACE hook macro

Task 1.8: the core gains trace_ctl/trace_rec (NULL unless the sim REPL
sets them) and SCHED_TRACE evaluates its call only while a record is
being built.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Rongsong Shen 2026-10-08 08:53:40 +00:00
parent 29b6734649
commit a801aff46f
Signed by untrusted user: rshen
GPG key ID: 80533536B0EB651C
6 changed files with 482 additions and 2 deletions

View file

@ -2568,3 +2568,29 @@ sched_snapshot_sparse_resvals_test = executable(
test('scheduler snapshot sparse resvals test',
sched_snapshot_sparse_resvals_test, suite: 'scheduler',
env: ['ASAN_OPTIONS=detect_leaks=0'])
# scheduler-sim-decision-trace task 1.8: the core trace gate and the
# SCHED_TRACE hook macro (design.md "TraceModel", Testing Strategy 3;
# Requirements 11.1-11.3). Real-scheduler_srcs link technique (every source
# its own translation unit), so --wrap=sched_trace_rec_new counts every
# record the allocation path creates.
sched_trace_hooks_gate_test_srcs = ['test_trace_hooks_gate.c']
foreach f : scheduler_srcs
if f != 'src/main.c'
sched_trace_hooks_gate_test_srcs += ['../' + f]
endif
endforeach
sched_trace_hooks_gate_test = executable(
'sched_trace_hooks_gate_test',
sched_trace_hooks_gate_test_srcs,
include_directories:[incdir],
dependencies: [scheduler_deps, unity_dep],
link_args: ['-Wl,--wrap=xcecli_start',
'-Wl,--wrap=xcecli_join',
'-Wl,--wrap=sched_trace_rec_new'],
install: false)
test('scheduler trace hooks gate test',
sched_trace_hooks_gate_test, suite: 'scheduler',
env: ['ASAN_OPTIONS=detect_leaks=0'])