813e011409
tests / build-and-test (push) Failing after 32s
Adds the GEM "Documentation" Fundamental capability: the equipment now
self-reports which GEM capabilities it supports, and the host can
discover the DVID namelist with the same shape used for SVIDs.
Catalog (data/messages.yaml -> generated messages.hpp)
S1F19 W header-only Get GEM Compliance Request
S1F20 <L,3 <A SOFTREV>
<A EQPTYP>
<L,a <L,2 <U1 CCODE> <A CDESC>>>>
Get GEM Compliance Data
S1F21 W <L,n <U4 VID>> DVID Namelist Request (n=0 = all)
S1F22 <L,n <L,3 <U4 VID>
<A VNAME>
<A UNITS>>> DVID Namelist Data
Codegen emits CapabilityEntry and GemCompliance structs. S1F22 reuses
S1F12's StatusName struct (same wire shape; dedup avoids redefinition).
Equipment data dictionary (data/equipment.yaml)
device: Adds `equipment_type: "EQUIPMENT"`
for the S1F20 EQPTYP field.
capabilities: New section. List of
- {code, name} (CCODE, CDESC) pairs honestly
reflecting what the codebase
implements: 1, 2, 3, 5, 6, 7, 8,
9, 11, 12, 14 (partial), 15.
dvids: New section, same schema as
svids:. Demo populates two:
- WaferCounter (U4, units wafer)
- ChamberPressure (F4, units Torr)
Loader (src/config/loader.cpp + include/secsgem/config/loader.hpp)
EquipmentDescriptor gains equipment_type and capabilities (vector of
(uint8_t, string) pairs). load_equipment now reads `capabilities:`
into the descriptor and `dvids:` into model.dvids.
Server (apps/secs_server.cpp)
router.on(1, 19) returns S1F20 with desc.software_rev,
desc.equipment_type, and desc.capabilities converted to
vector<CapabilityEntry>.
router.on(1, 21) returns S1F22 built from model.dvids.all().
Client (apps/secs_client.cpp)
Two new demo steps after Request Online and before SVID discovery:
S1F19 -> S1F20: logs SOFTREV, EQPTYP, and every (CCODE, CDESC)
the equipment claims.
S1F21 -> S1F22: logs each DVID with units.
Tests
tests/test_messages.cpp Round-trip S1F19/F20 with a 3-entry
capability list; round-trip S1F22 with two
DVIDs.
tests/test_loader.cpp Asserts equipment_type, the capabilities
list contains CCODE 14 (Spooling), and the
two DVIDs land in model.dvids.
COMPLIANCE.md
"Documentation" Fundamental moves from ⬜ to ✅.
S1F19/F20 + S1F21/F22 rows in the coverage matrix flip to ✅.
The "what would it take" list drops the documentation-messages bullet.
Verified
- Tests: 77 cases / 444 assertions pass.
- Demo: client logs the full capability list received from the
equipment, including CCODE 14 "Spooling (partial; S2F43/F44 +
S6F23/F24)" — the equipment honestly reports its partial
implementation rather than overclaiming.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
101 lines
3.3 KiB
C++
101 lines
3.3 KiB
C++
#include <doctest/doctest.h>
|
|
|
|
#include <fstream>
|
|
#include <string>
|
|
|
|
#include "secsgem/config/loader.hpp"
|
|
#include "secsgem/secs2/item.hpp"
|
|
|
|
using namespace secsgem;
|
|
namespace gem = secsgem::gem;
|
|
namespace s2 = secsgem::secs2;
|
|
|
|
#ifndef SECSGEM_DATA_DIR
|
|
#error "SECSGEM_DATA_DIR not defined; see CMakeLists.txt"
|
|
#endif
|
|
|
|
TEST_CASE("control_state.yaml parses into the same shape as default_table()") {
|
|
auto cfg = config::load_control_state(SECSGEM_DATA_DIR "/control_state.yaml");
|
|
auto baseline = gem::ControlTransitionTable::default_table();
|
|
|
|
CHECK(cfg.initial == gem::ControlState::HostOffline);
|
|
// Same row count; same (from, on) pairs map to the same destination.
|
|
CHECK(cfg.table.size() == baseline.size());
|
|
|
|
for (const auto& r : baseline.rows()) {
|
|
const auto* loaded = cfg.table.find(r.from, r.on);
|
|
REQUIRE(loaded != nullptr);
|
|
CHECK(loaded->to == r.to);
|
|
CHECK(loaded->then == r.then);
|
|
CHECK(loaded->ack_code == r.ack_code);
|
|
}
|
|
}
|
|
|
|
TEST_CASE("equipment.yaml populates SVIDs, ECIDs, CEIDs, alarms, recipes, commands") {
|
|
gem::EquipmentDataModel m;
|
|
auto desc = config::load_equipment(SECSGEM_DATA_DIR "/equipment.yaml", m);
|
|
|
|
CHECK(desc.model_name == "SECSGEM-SIM");
|
|
CHECK(desc.software_rev == "0.1.0");
|
|
REQUIRE(desc.emit_on_control_change.has_value());
|
|
CHECK(*desc.emit_on_control_change == 100);
|
|
|
|
CHECK(m.svids.all().size() == 3);
|
|
CHECK(m.svids.get(1)->name == "ControlState");
|
|
CHECK(m.svids.get(3)->value == s2::Item::boolean(true));
|
|
|
|
CHECK(m.ecids.all().size() == 2);
|
|
CHECK(m.ecids.get(10)->value == s2::Item::u4(uint32_t{1}));
|
|
|
|
CHECK(m.events.all_events().size() == 3);
|
|
CHECK(m.events.has_event(100));
|
|
CHECK(m.events.has_event(300));
|
|
|
|
CHECK(m.alarms.all().size() == 2);
|
|
CHECK(m.alarms.get(1)->text == "Chiller Temp High");
|
|
CHECK(m.alarms.get(1)->severity_category == 4);
|
|
|
|
CHECK(m.recipes.list().size() == 2);
|
|
CHECK(m.recipes.get("RECIPE-A").value().find("CHAMBER ARGON") != std::string::npos);
|
|
|
|
CHECK(m.commands.has("START"));
|
|
auto start = m.commands.dispatch("START", {});
|
|
CHECK(start.ack == gem::HostCmdAck::Accept);
|
|
CHECK(start.emit_ceid.value_or(0) == 300);
|
|
auto fault = m.commands.dispatch("FAULT", {});
|
|
CHECK(fault.set_alarm.value_or(0) == 1);
|
|
|
|
// Spool config loaded from YAML.
|
|
CHECK(m.spool.is_stream_spoolable(5));
|
|
CHECK(m.spool.is_stream_spoolable(6));
|
|
CHECK_FALSE(m.spool.is_stream_spoolable(1));
|
|
CHECK(m.spool.max_size() == 100);
|
|
|
|
// force_spool flag plumbed from YAML through CommandSpec.
|
|
auto on = m.commands.dispatch("SPOOL_ON", {});
|
|
auto off = m.commands.dispatch("SPOOL_OFF", {});
|
|
REQUIRE(on.force_spool.has_value());
|
|
CHECK(*on.force_spool == true);
|
|
REQUIRE(off.force_spool.has_value());
|
|
CHECK(*off.force_spool == false);
|
|
|
|
// Capabilities + equipment_type loaded for S1F20.
|
|
CHECK(desc.equipment_type == "EQUIPMENT");
|
|
REQUIRE(desc.capabilities.size() >= 5);
|
|
bool saw_spooling = false;
|
|
for (const auto& [code, name] : desc.capabilities) {
|
|
if (code == 14) saw_spooling = true;
|
|
}
|
|
CHECK(saw_spooling);
|
|
|
|
// DVIDs loaded for S1F22.
|
|
CHECK(m.dvids.all().size() == 2);
|
|
CHECK(m.dvids.get(100)->name == "WaferCounter");
|
|
CHECK(m.dvids.get(101)->units == "Torr");
|
|
}
|
|
|
|
TEST_CASE("loader surfaces YAML errors with file path") {
|
|
CHECK_THROWS_AS(config::load_equipment("/tmp/does-not-exist.yaml", *new gem::EquipmentDataModel),
|
|
config::ConfigError);
|
|
}
|