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>
This commit is contained in:
parent
4df29606f6
commit
8931833132
30 changed files with 310 additions and 6 deletions
|
|
@ -124,9 +124,20 @@
|
|||
#error \
|
||||
"XCE_SIM_REPL_PARAMS_C_PATH must be defined by meson.build to repl_params.c's absolute path"
|
||||
#endif
|
||||
/* Task 5.1 (scheduler-sim-decision-trace, Req 11.3): the REPL trace
|
||||
* sources and the renderer's private header. */
|
||||
#if !defined(XCE_SIM_REPL_TRACE_C_PATH) \
|
||||
|| !defined(XCE_SIM_REPL_TRACE_STORE_C_PATH) \
|
||||
|| !defined(XCE_SIM_REPL_TRACE_RENDER_C_PATH) \
|
||||
|| !defined(XCE_SIM_REPL_TRACE_RENDER_OUTCOME_C_PATH) \
|
||||
|| !defined(XCE_SIM_REPL_TRACE_RENDER_H_PATH) \
|
||||
|| !defined(XCE_SIM_REPL_TRACE_EMIT_C_PATH)
|
||||
#error \
|
||||
"XCE_SIM_REPL_TRACE_*_PATH must be defined by meson.build to the absolute paths of the repl_trace*.c sources and repl_trace_render.h"
|
||||
#endif
|
||||
#ifndef XCE_SIM_LIB_PATH
|
||||
#error \
|
||||
"XCE_SIM_LIB_PATH must be defined by meson.build to the absolute path of sim.c+sim_loop.c+sim_picker.c+sim_record.c+repl.c+repl_break.c+repl_info.c+repl_params.c's isolated static_library() archive"
|
||||
"XCE_SIM_LIB_PATH must be defined by meson.build to the absolute path of the sched_sim_isolation_lib static_library() archive (its sources are listed in src/scheduler/meson.build)"
|
||||
#endif
|
||||
|
||||
/* Forbidden headers (design.md "Allowed Dependencies", same list
|
||||
|
|
@ -657,6 +668,42 @@ static void test_sim_never_calls_forbidden_symbols(void)
|
|||
free(repl_fmt_c);
|
||||
}
|
||||
|
||||
/*
|
||||
* test_sim_trace_repl_sources_are_isolated - the REPL trace sources
|
||||
* (control, store, renderer, emitter) are part of the simulation driver:
|
||||
* each one must be readable, include no forbidden header and name no
|
||||
* controller-facing symbol. They may use stdio (the REPL prints), unlike
|
||||
* the core trace sources test_core_isolation.c scans.
|
||||
*/
|
||||
static void test_sim_trace_repl_sources_are_isolated(void)
|
||||
{
|
||||
static const char* const paths[] = {
|
||||
XCE_SIM_REPL_TRACE_C_PATH,
|
||||
XCE_SIM_REPL_TRACE_STORE_C_PATH,
|
||||
XCE_SIM_REPL_TRACE_RENDER_C_PATH,
|
||||
XCE_SIM_REPL_TRACE_RENDER_OUTCOME_C_PATH,
|
||||
XCE_SIM_REPL_TRACE_RENDER_H_PATH,
|
||||
XCE_SIM_REPL_TRACE_EMIT_C_PATH,
|
||||
};
|
||||
size_t i;
|
||||
|
||||
for (i = 0; i < sizeof(paths) / sizeof(paths[0]); i++) {
|
||||
char* raw = read_whole_file(paths[i]);
|
||||
char* stripped;
|
||||
|
||||
TEST_ASSERT_NOT_NULL_MESSAGE(raw, paths[i]);
|
||||
stripped = strip_c_comments(raw);
|
||||
TEST_ASSERT_NOT_NULL_MESSAGE(stripped, paths[i]);
|
||||
TEST_ASSERT_TRUE_MESSAGE(stripped[0] != '\0', paths[i]);
|
||||
|
||||
assert_no_forbidden_includes(stripped, paths[i]);
|
||||
assert_no_forbidden_symbols(stripped, paths[i]);
|
||||
|
||||
free(raw);
|
||||
free(stripped);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* test_sim_driver_struct_has_no_forbidden_fields - Req 5 AC 17's
|
||||
* "confirmed by the struct definition itself, not runtime checks alone"
|
||||
|
|
@ -730,9 +777,8 @@ static void test_sim_object_has_no_forbidden_undefined_symbols(void)
|
|||
/* posix format for an undefined symbol: "<name> U" (no
|
||||
* value/size columns). Skip anything that doesn't parse as
|
||||
* exactly that -- e.g. a blank line, or an archive member header
|
||||
* some nm versions print (this archive has eight member objects,
|
||||
* sim.c.o, sim_loop.c.o, sim_picker.c.o, sim_record.c.o, repl.c.o,
|
||||
* repl_break.c.o, repl_info.c.o, and repl_params.c.o). */
|
||||
* some nm versions print (this archive has one member object per
|
||||
* source in sched_sim_isolation_lib, src/scheduler/meson.build). */
|
||||
if (sscanf(line, "%511s %c", symbol, &type) != 2) {
|
||||
continue;
|
||||
}
|
||||
|
|
@ -779,6 +825,7 @@ int main(void)
|
|||
RUN_TEST(test_sim_source_paths_are_readable);
|
||||
RUN_TEST(test_sim_never_includes_forbidden_headers);
|
||||
RUN_TEST(test_sim_never_calls_forbidden_symbols);
|
||||
RUN_TEST(test_sim_trace_repl_sources_are_isolated);
|
||||
RUN_TEST(test_sim_driver_struct_has_no_forbidden_fields);
|
||||
RUN_TEST(test_sim_object_has_no_forbidden_undefined_symbols);
|
||||
return UNITY_END();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue