myxce/src/scheduler/meson.build
Rongsong Shen 8931833132
feat(scheduler-sim-decision-trace): compile trace sources into REPL/sim tests and the sim isolation checks
Task 5.1: the 26 white-box tests that include repl.c or sim_loop.c now
include the REPL trace sources (and the core trace sources where no
hooked source brings them); sched_sim_isolation_lib carries all trace
sources and the sim isolation test scans the REPL trace files.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-08 14:56:31 +00:00

195 lines
9.4 KiB
Meson

scheduler_srcs = [
'src/main.c',
'src/cli_compat.c',
'src/handler.c',
'src/scheduler.c',
'src/sched_election.c',
'src/core.c',
'src/core_events.c',
'src/core_session.c',
'src/core_clock.c',
'src/driver.c',
'src/snapshot.c',
'src/snapshot_wire.c',
'src/snapshot_load.c',
'src/decision.c',
'src/recording.c',
'src/recording_events.c',
'src/recording_session.c',
'src/sim.c',
'src/sim_loop.c',
'src/sim_picker.c',
'src/sim_limit.c',
'src/sim_alloc.c',
'src/sim_verify.c',
'src/sim_record.c',
'src/repl.c',
'src/repl_fmt.c',
'src/repl_rollup.c',
'src/repl_break.c',
'src/repl_info.c',
'src/repl_params.c',
'src/repl_trace_render.c',
'src/repl_trace_render_outcome.c',
'src/repl_trace_store.c',
'src/repl_trace.c',
'src/repl_trace_emit.c',
'src/schedobj.c',
'src/plugin.c',
'src/resource.c',
'src/alloc_cache.c',
'src/host_iter.c',
'src/alloc_runner.c',
'src/sched_trace.c',
'src/sched_trace_scan.c',
'src/sched_trace_capture.c',
'src/sched_trace_outcome.c',
'src/plugins/fcfs.c',
'src/plugins/builtin_fcfs.c',
'src/plugins/seqjob_allocator.c',
'src/plugins/parjob_allocator.c',
'src/plugins/limit.c',
]
incdir = include_directories('src',
'include',
'../include',
'../lib')
# Task 12.1 (scheduler-core spec, Req 5 AC 22): the interactive REPL's
# line-editing input loop (src/repl.c) needs readline()/add_history().
# Uses libedit (BSD), not GNU readline (GPL) -- xce_scheduler is a shipped
# production daemon (unlike xce_test, a debug tool), so a GPL dependency
# would encumber the whole linked binary. libedit's editline/readline.h
# emulation header provides the same two calls under a permissive license;
# src/controller/meson.build (xce_test's own REPL) uses the identical dep
# for the same reason, kept consistent project-wide.
libedit_dep = dependency('libedit')
scheduler_deps = [
libxce_dep,
librtti_dep,
math_dep,
tinylog_dep,
thread_dep,
libedit_dep,
]
scheduler = executable('xce_scheduler',
scheduler_srcs,
include_directories: incdir,
dependencies: scheduler_deps,
link_args: wrap_link_args,
install: true)
# Task 4.1 (scheduler-core spec, Req 5.1/5.2): isolated compile target for
# core.c AND its core_events.c/core_session.c/core_clock.c siblings (design
# review follow-up: the isolation boundary is a core.c-family-wide property
# -- Req 5 AC 1/AC 2 -- but until this fix the nm(1) undefined-symbol proof
# below only ever mechanically covered core.c itself, leaving the other
# three "kept isolation-clean by review" only, i.e. manually, with nothing
# catching a regression), consumed by testsuite/test_core_isolation.c to
# prove at build time that none of the four reference zero-I/O-boundary
# symbols from the networking/API libraries (netio/xceapi/client/delay/
# idgen). core_clock.c is the one SANCTIONED exception to the separate
# wall-clock text-scan check (it owns the core family's one legitimate
# clock_gettime() call, Req 5 AC 3) -- that exemption is enforced in
# test_core_isolation.c itself, not here; this archive only proves the
# networking/API isolation boundary, which core_clock.c fully satisfies
# (clock_gettime()/gmtime_r()/tlog_reg_format_func() are not
# networking/API symbols). A static_library() here need not LINK against
# anything for this purpose -- compiling these four files to objects is
# enough; the archive's own undefined-symbol table (inspected via nm(1) in
# the test) reflects exactly what this code calls, independent of which
# libraries are nominally "dependencies" of this build target.
sched_core_isolation_lib = static_library(
'sched_core_isolation',
['src/core.c', 'src/core_events.c', 'src/core_session.c',
'src/core_clock.c'],
include_directories: incdir,
dependencies: scheduler_deps,
install: false)
# Task 11.3 (scheduler-core spec, Req 5 AC 17): isolated compile target for
# the simulation driver's own files, consumed by
# testsuite/test_sim_isolation.c to prove at build time that
# sim.c/sim_loop.c/sim_record.c/repl.c/repl_fmt.c/repl_break.c/repl_info.c/
# repl_params.c/sim_picker.c/sim_limit.c/sched_election.c reference zero
# controller-facing symbols (client/netio/xceapi/delay/idgen). All files are compiled
# together into ONE archive -- task 11.2 added sim_loop.c as a sibling
# file to task 11.1's sim.c, task 11.5 added sim_record.c as a third, task
# 12.1 added repl.c as a fourth, task 12.2 added repl_break.c/repl_info.c
# as a fifth/sixth (task 12.2's own 800-line-cap split of repl.c's
# breakpoint/state-inspection logic -- repl_internal.h's own "Why a split
# at all" section has the full rationale), task 12.3 added repl_params.c
# as a seventh (the same split, extended again for `snapshot`/`set`),
# bug-1567's fix added sim_picker.c as an eighth (sim_loop.c's own
# "zero line-budget headroom" -- same reason its siblings above exist --
# so the fix's picker-registration + post-load picker-rebuild-walk logic
# lives here instead of growing sim_loop.c past its cap), the
# scheduler-sim-repl-verbosity spec's task 7.2 remediation added repl_fmt.c
# as a ninth (repl.c's own 800-line-cap split of its shared, dependency-free
# formatting helpers -- repl_fmt.c's own header comment has the full
# rationale), and the scheduler-sim-diagnostics spec's task 6 (bug-1825
# fix, remediation round 2) added sim_limit.c as a tenth (sim_loop.c-cap
# sibling housing sim_bootstrap_limit_plugin(), mirroring sim_picker.c's
# own bootstrap-function role exactly) -- covering only a subset of them
# would repeat core.c's own siblings' (core_events.c/core_session.c/
# core_clock.c) never-mechanically-covered gap for the sim driver, which is
# exactly the omission a prior round of this same task left in place by
# adding sim_limit.c to scheduler_srcs above without also adding it here.
# scheduler-sim-live-allocation spec's task 4.1 adds sched_election.c as an
# eleventh: sim_loop.c's sched_sim_driver_run() now calls sched_job_picker()/
# sched_allocator() (sched_election.c) directly, no longer the file's own,
# now-removed sim_picker_thread_fn() -- the same "cover every file the
# driver's own compiled object actually calls" rationale sim_picker.c/
# sim_limit.c's own additions above already establish. Task 3.1 (which
# relocated sched_job_picker()/sched_allocator() out of scheduler.c into
# this new file) deliberately deferred this addition to task 4.1, since
# sim_loop.c did not yet call either function until this task wired the
# real spawn in.
# Same "compiling to an object is enough, no real linking needed" rationale
# as sched_core_isolation_lib above -- sched_election.c's own undefined
# references (sched_make_allocation()/sched_commit_decision(), scheduler.c)
# are themselves already core-safe (verified by task 3.1's own fixture) and
# remain undefined in this archive exactly like every other cross-file call
# already does; nm(1)'s FORBIDDEN_SYMBOLS check (test_sim_isolation.c) only
# flags controller-facing names, none of which sched_election.c references.
# Task 4.1 also adds sim_alloc.c as a twelfth (bug-1829 fix): sim_loop.c now
# also calls sim_bootstrap_seqjob_allocator()/sim_bootstrap_parjob_
# allocator() (sim_alloc.c), the same "cover every file the driver's own
# compiled object actually calls" rationale as sched_election.c immediately
# above. sim_alloc.c #includes scheduler.h (for the throwaway xce_scheduler_t
# wrapper its own file header comment explains) -- safe here for the exact
# same reason sched_election.c's own scheduler.h include is safe: this file
# is not part of test_sim_isolation.c's own enumerated text-scan list (that
# list only ever covered sim.h/sim.c/sim_loop.c/sim_picker.c/sim_record.c/
# repl.c/repl.h/repl_break.c/repl_info.c/repl_internal.h/repl_params.c, never
# extended to sim_limit.c or sched_election.c either), and its own compiled
# object references zero controller-facing symbols (register_seqjob_
# allocator()/register_parjob_allocator(), plugins/seqjob_allocator.c and
# plugins/parjob_allocator.c, touch only core-scoped resource/worker state).
# scheduler-sim-decision-trace task 5.1 adds the REPL trace sources
# (repl_trace.c, repl_trace_store.c, repl_trace_render.c,
# repl_trace_render_outcome.c, repl_trace_emit.c), which
# test_sim_isolation.c also text-scans, and the four core trace sources
# (sched_trace*.c). The core ones are here because sched_election.c (hooked
# by task 3.1) and repl_trace_store.c call them, so by the same "cover every
# file the driver calls" rule their undefined symbols belong in the nm(1)
# check; their text scan (forbidden headers/symbols plus no stdio) stays in
# test_core_isolation.c and is not repeated here.
sched_sim_isolation_lib = static_library(
'sched_sim_isolation',
['src/sim.c', 'src/sim_loop.c', 'src/sim_picker.c', 'src/sim_limit.c',
'src/sim_alloc.c', 'src/sim_record.c', 'src/repl.c', 'src/repl_fmt.c',
'src/repl_break.c', 'src/repl_info.c', 'src/repl_params.c',
'src/repl_rollup.c', 'src/repl_trace.c', 'src/repl_trace_store.c',
'src/repl_trace_render.c', 'src/repl_trace_render_outcome.c',
'src/repl_trace_emit.c', 'src/sched_election.c', 'src/sched_trace.c',
'src/sched_trace_scan.c', 'src/sched_trace_capture.c',
'src/sched_trace_outcome.c'],
include_directories: incdir,
dependencies: scheduler_deps,
install: false)
subdir('testsuite')