model_test_context.h¶
tests/model/model_test_context.h
@file model_test_context.h @brief Shared infrastructure for model tests (subsystem + engine).
Owners: @tvanfossen
testCaseStarting
void VramMonitorListener::testCaseStarting(Catch::TestCaseInfo const &) override
Snapshot VRAM before test.
tests/model/model_test_context.h:899
Source · 3 lines
void testCaseStarting(Catch::TestCaseInfo const& /*tc*/) override {
vram_before_ = query_vram_bytes();
}Activity · 1 steps
testRunEnded
void VramMonitorListener::testRunEnded(Catch::TestRunStats const &) override
Note where the logs went.
tests/model/model_test_context.h:931
Result: absent
Verifies
| requirement | linked | path to the implementer |
|---|---|---|
| REQ-INFER-002 | inferred | |
| REQ-INFER-020 | inferred |
Source · 3 lines
void testRunEnded(Catch::TestRunStats const& /*stats*/) override {
spdlog::info("Model tests complete — logs in {}", LOG_DIR.string());
}Activity · 1 steps
void ModelTestListener::testRunEnded(Catch::TestRunStats const &stats) override
Unload model after run.
tests/model/model_test_context.h:980
Result: absent
Verifies
| requirement | linked | path to the implementer |
|---|---|---|
| REQ-INFER-002 | inferred | testRunEnded → shutdown |
| REQ-INFER-020 | inferred | testRunEnded → shutdown |
Source · 10 lines
void testRunEnded(Catch::TestRunStats const& stats) override {
// v2.14.6: release the production iface context before the
// orchestrator it points at shuts down.
destroy_orchestrator_interface(g_ctx.iface_ctx);
g_ctx.iface_ctx = nullptr;
if (g_ctx.orchestrator) {
g_ctx.orchestrator->shutdown();
}
VramMonitorListener::testRunEnded(stats);
}Activity · 5 steps
testRunStarting
void VramMonitorListener::testRunStarting(Catch::TestRunInfo const &) override
Ensure the log directory exists before any case writes to it.
tests/model/model_test_context.h:889
Result: absent
Verifies
| requirement | linked | path to the implementer |
|---|---|---|
| REQ-API-004 | inferred | |
| REQ-API-013 | inferred | |
| REQ-CFG-001 | inferred | |
| REQ-CFG-002 | inferred | |
| REQ-CFG-003 | inferred | |
| REQ-CFG-005 | inferred | |
| REQ-CFG-006 | inferred | |
| REQ-CFG-007 | inferred | |
| REQ-CFG-008 | inferred | |
| REQ-DELEG-005 | inferred | |
| REQ-INFER-002 | inferred | |
| REQ-INFER-007 | inferred | |
| REQ-INFER-012 | inferred | |
| REQ-INFER-019 | inferred | |
| REQ-INFER-020 | inferred | |
| REQ-INFER-023 | inferred | |
| REQ-INFER-027 | inferred | |
| REQ-MCP-021 | inferred | |
| REQ-MCP-023 | inferred | |
| REQ-TYPE-005 | inferred |
Source · 3 lines
void testRunStarting(Catch::TestRunInfo const& /*info*/) override {
fs::create_directories(LOG_DIR);
}Activity · 1 steps
void ModelTestListener::testRunStarting(Catch::TestRunInfo const &info) override
Load model before test run.
tests/model/model_test_context.h:957
Called by none
Calls adjust_config, info, init_orchestrator, load_harness_inputs, testRunStarting, use_small_default_model
Result: absent
Verifies
| requirement | linked | path to the implementer |
|---|---|---|
| REQ-API-004 | inferred | |
| REQ-API-013 | inferred | |
| REQ-CFG-001 | inferred | testRunStarting → load_harness_inputs → load_test_config → load_config |
| REQ-CFG-002 | inferred | testRunStarting → load_harness_inputs → load_test_config → load_config → load_config_layers → parse_config_file → parse_top_sections → parse_models_config |
| REQ-CFG-003 | inferred | testRunStarting → use_small_default_model → resolve |
| REQ-CFG-005 | inferred | testRunStarting → load_harness_inputs → load_test_config → load_config → load_config_layers → parse_config_file → parse_top_sections → parse_models_config → parse_model_config |
| REQ-CFG-006 | inferred | testRunStarting → load_harness_inputs → load_test_config → load_config |
| REQ-CFG-007 | inferred | testRunStarting → load_harness_inputs → load_test_config → load_config |
| REQ-CFG-008 | inferred | testRunStarting → load_harness_inputs → load_test_config → load_config → load_config_layers → load_bundled_default → resolve_data_dir |
| REQ-DELEG-005 | inferred | testRunStarting → load_harness_inputs → load_test_config → load_config → load_config_layers → parse_config_file → parse_top_sections → parse_optional_sections → parse_delegation_config |
| REQ-INFER-002 | inferred | testRunStarting → init_orchestrator → initialize → activate_router → ensure_loaded → load_and_activate |
| REQ-INFER-007 | inferred | testRunStarting → init_orchestrator → load_grammars_from → load_bundled |
| REQ-INFER-012 | inferred | testRunStarting → init_orchestrator → initialize → create_tier_backends → create_adapter |
| REQ-INFER-019 | inferred | testRunStarting → init_orchestrator → initialize → ensure_vram_budget |
| REQ-INFER-020 | inferred | testRunStarting → init_orchestrator → initialize → build_routing_tables |
| REQ-INFER-023 | inferred | testRunStarting → init_orchestrator → initialize → activate_default_tier → get_model → activate_and_track → preload_adapters_for_model |
| REQ-INFER-027 | inferred | testRunStarting → load_harness_inputs → load_test_config → load_config → validate_config → validate |
| REQ-MCP-021 | inferred | testRunStarting → load_harness_inputs → load_test_config → load_config → load_config_layers → parse_config_file → parse_top_sections → parse_optional_sections → parse_optional_subsections → parse_mcp_config → parse_absolute_path_list |
| REQ-MCP-023 | inferred | testRunStarting → load_harness_inputs → load_test_config → load_config → load_config_layers → parse_config_file → parse_top_sections → parse_optional_sections → parse_optional_subsections → parse_mcp_config → parse_mcp_sections → parse_bash_config |
| REQ-TYPE-005 | inferred | testRunStarting → load_harness_inputs → load_test_config → load_config → load_config_layers → parse_config_file |
Source · 16 lines
void testRunStarting(Catch::TestRunInfo const& info) override {
VramMonitorListener::testRunStarting(info);
spdlog::info("Loading model for model tests...");
// gh#149: load_harness_inputs records WHICH setup step failed
// instead of collapsing both into one bool.
bool ok = load_harness_inputs(g_ctx, "the generic test model");
// gh#87: generic engine-logic tests use a small model (footprint /
// OOM safety). Family tests use init_orchestrator_for_v219_* and keep
// their large models — they do NOT go through this listener.
if (ok) { use_small_default_model(g_ctx); adjust_config(g_ctx); }
ok = ok && init_orchestrator(g_ctx);
if (!ok) {
spdlog::error("Model test init failed — tests will skip: {}",
g_ctx.skip_reason);
}
}