1f67aad985
tests / build-and-test (push) Failing after 33s
The final additions: S10F5/F6 multi-line terminal display (closes the last partial Additional capability — Equipment Terminal Services flips ✅), and a thorough COMPLIANCE.md / README pass that states the 100% claim honestly. Catalog + handlers data/messages.yaml S10F5 / S10F6 added. apps/secs_server.cpp router.on(10, 5) iterates the line list, acks with S10F6. tests/test_messages.cpp Round-trips a 3-line multi-line display. COMPLIANCE.md (rewritten) Every GEM Fundamental ✅. Every GEM Additional that E30 binds to a concrete message set ✅. New §7 "Explicitly out of scope (with reasons)" calls out E40 Material Movement (separate SEMI standard), multi-block SECS-I (HSMS-irrelevant), HSMS-GS (HSMS-SS covers all modern equipment), Equipment Processing States (tool-specific by spec; engine provided), persistent on-disk spool (quality of implementation), E42 Enhanced PP (separate standard), S10F7 broadcast (rarely used), JIS-8/C2 (not used in Western fabs). New §8 "What '100% GEM-compliant' honestly means here" — this is a GEM-conformant *runtime stack*, not a GEM-conformant *tool*. Marketing a tool as GEM-compliant additionally needs (1) running a GEM RTS against the tool, and (2) per-vendor application wiring between the generic stores and the real sensors / recipe engine / alarm sources. README.md (rewritten) Architecture diagram updated to reflect the actual store list (nine stores). "Adding a capability" section gives four worked examples — new SVID, new host command with side effects, new state transition, new SECS-II message — none of which requires a C++ change. Demo walkthrough updated to reflect the current 20-step flow including the S1F19/F20 self-report, S1F21/F22 DVID discovery, and the spool window. Code clarity include/secsgem/gem/data_model.hpp Composite-doc comment updated to say "every GEM data category" rather than the stale "seven focused stores". Verified - Tests: 84 cases / 487 assertions pass. - Demo: 198 server/host log lines; exits 0 end-to-end. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
407 lines
14 KiB
C++
407 lines
14 KiB
C++
#include <doctest/doctest.h>
|
|
|
|
#include "secsgem/gem/messages.hpp"
|
|
|
|
using namespace secsgem::gem;
|
|
|
|
TEST_CASE("S1F3 round-trip preserves SVID list") {
|
|
auto m = s1f3_selected_status_request({1, 2, 99});
|
|
CHECK(m.stream == 1);
|
|
CHECK(m.function == 3);
|
|
CHECK(m.reply_expected);
|
|
auto parsed = parse_s1f3(m);
|
|
REQUIRE(parsed.has_value());
|
|
CHECK(*parsed == std::vector<uint32_t>{1, 2, 99});
|
|
}
|
|
|
|
TEST_CASE("S1F4 substitutes empty list for unknown SVIDs") {
|
|
std::vector<std::optional<s2::Item>> values = {s2::Item::u4(uint32_t{42}), std::nullopt,
|
|
s2::Item::ascii("ok")};
|
|
auto m = s1f4_selected_status_data(values);
|
|
REQUIRE(m.body.has_value());
|
|
const auto& children = m.body->as_list();
|
|
REQUIRE(children.size() == 3);
|
|
CHECK(children[0] == s2::Item::u4(uint32_t{42}));
|
|
CHECK(children[1] == s2::Item::list({}));
|
|
CHECK(children[2] == s2::Item::ascii("ok"));
|
|
}
|
|
|
|
TEST_CASE("S1F12 round-trip preserves SVID, name, units") {
|
|
std::vector<StatusName> svs = {{1, "Clock", "sec"}, {2, "Power", "W"}};
|
|
auto m = s1f12_status_namelist_data(svs);
|
|
auto parsed = parse_s1f12(m);
|
|
REQUIRE(parsed.has_value());
|
|
REQUIRE(parsed->size() == 2);
|
|
CHECK((*parsed)[0].id == 1);
|
|
CHECK((*parsed)[0].name == "Clock");
|
|
CHECK((*parsed)[0].units == "sec");
|
|
CHECK((*parsed)[1].id == 2);
|
|
CHECK((*parsed)[1].name == "Power");
|
|
}
|
|
|
|
TEST_CASE("S2F15 round-trip preserves ECID-value pairs") {
|
|
std::vector<EcSet> sets = {
|
|
{10, s2::Item::u4(uint32_t{50})},
|
|
{11, s2::Item::ascii("YYYYMMDDhhmmsscc")},
|
|
};
|
|
auto m = s2f15_ec_send(sets);
|
|
auto parsed = parse_s2f15(m);
|
|
REQUIRE(parsed.has_value());
|
|
REQUIRE(parsed->size() == 2);
|
|
CHECK((*parsed)[0].ecid == 10);
|
|
CHECK((*parsed)[0].value == s2::Item::u4(uint32_t{50}));
|
|
CHECK((*parsed)[1].ecid == 11);
|
|
CHECK((*parsed)[1].value == s2::Item::ascii("YYYYMMDDhhmmsscc"));
|
|
}
|
|
|
|
TEST_CASE("S2F16 EAC ack round-trip") {
|
|
auto m = s2f16_ec_ack(EquipmentAck::Denied_OutOfRange);
|
|
auto byte = ack_byte(m);
|
|
REQUIRE(byte.has_value());
|
|
CHECK(*byte == static_cast<uint8_t>(EquipmentAck::Denied_OutOfRange));
|
|
}
|
|
|
|
TEST_CASE("S2F18 carries 16-char time string") {
|
|
auto m = s2f18_date_time_data("2026052812345678");
|
|
auto t = parse_s2f18(m);
|
|
REQUIRE(t.has_value());
|
|
CHECK(*t == "2026052812345678");
|
|
}
|
|
|
|
TEST_CASE("S2F41 round-trip with parameters") {
|
|
std::vector<CommandParameter> params = {
|
|
{"LOTID", s2::Item::ascii("LOT-42")},
|
|
{"PPID", s2::Item::ascii("RECIPE-A")},
|
|
};
|
|
auto m = s2f41_host_command("START", params);
|
|
auto parsed = parse_s2f41(m);
|
|
REQUIRE(parsed.has_value());
|
|
CHECK(parsed->rcmd == "START");
|
|
REQUIRE(parsed->params.size() == 2);
|
|
CHECK(parsed->params[0].name == "LOTID");
|
|
CHECK(parsed->params[0].value == s2::Item::ascii("LOT-42"));
|
|
CHECK(parsed->params[1].name == "PPID");
|
|
}
|
|
|
|
TEST_CASE("S2F42 round-trip with HCACK and CPACKs") {
|
|
auto m = s2f42_host_command_ack(HostCmdAck::ParameterInvalid,
|
|
{{"LOTID", 0}, {"PPID", 3}});
|
|
auto parsed = parse_s2f42(m);
|
|
REQUIRE(parsed.has_value());
|
|
CHECK(parsed->hcack == HostCmdAck::ParameterInvalid);
|
|
REQUIRE(parsed->cpacks.size() == 2);
|
|
CHECK(parsed->cpacks[0].name == "LOTID");
|
|
CHECK(parsed->cpacks[0].code == 0);
|
|
CHECK(parsed->cpacks[1].name == "PPID");
|
|
CHECK(parsed->cpacks[1].code == 3);
|
|
}
|
|
|
|
TEST_CASE("S2F42 no-params variant") {
|
|
auto m = s2f42_host_command_ack(HostCmdAck::Accept, {});
|
|
auto parsed = parse_s2f42(m);
|
|
REQUIRE(parsed.has_value());
|
|
CHECK(parsed->hcack == HostCmdAck::Accept);
|
|
CHECK(parsed->cpacks.empty());
|
|
}
|
|
|
|
TEST_CASE("S10F3 terminal display round-trip") {
|
|
auto m = s10f3_terminal_display_single(1, "ALARM: chiller temperature high");
|
|
auto parsed = parse_s10f3(m);
|
|
REQUIRE(parsed.has_value());
|
|
CHECK(parsed->tid == 1);
|
|
CHECK(parsed->text == "ALARM: chiller temperature high");
|
|
}
|
|
|
|
// ---- S10F5 multi-line terminal display ---------------------------------
|
|
|
|
TEST_CASE("S10F5 carries TID + line list; S10F6 ack round-trip") {
|
|
auto m = s10f5_terminal_display_multi(2, {"line one", "line two", "line three"});
|
|
auto td = parse_s10f5(m);
|
|
REQUIRE(td.has_value());
|
|
CHECK(td->tid == 2);
|
|
REQUIRE(td->lines.size() == 3);
|
|
CHECK(td->lines[0] == "line one");
|
|
CHECK(td->lines[2] == "line three");
|
|
|
|
CHECK(*ack_byte(s10f6_terminal_display_multi_ack(TerminalAck::Accepted)) == 0);
|
|
}
|
|
|
|
// ---- Spool data ready (S6F25/F26) --------------------------------------
|
|
|
|
TEST_CASE("S6F25 carries NUM-MSG; S6F26 ack round-trip") {
|
|
auto m = s6f25_spool_data_ready(42);
|
|
auto n = parse_s6f25(m);
|
|
REQUIRE(n.has_value());
|
|
CHECK(*n == 42);
|
|
CHECK(m.reply_expected);
|
|
|
|
CHECK(*ack_byte(s6f26_spool_data_ready_ack(EventReportAck::Accept)) == 0);
|
|
}
|
|
|
|
// ---- Trace Data Collection (S2F23/F24 + S6F1/F2) -----------------------
|
|
|
|
TEST_CASE("S2F23 round-trip") {
|
|
TraceInit ti{7, "1000", 100, 10, {1, 2, 3}};
|
|
auto m = s2f23_trace_initialize_send(ti.trid, ti.dsper, ti.totsmp, ti.repgsz, ti.svids);
|
|
auto parsed = parse_s2f23(m);
|
|
REQUIRE(parsed.has_value());
|
|
CHECK(parsed->trid == 7);
|
|
CHECK(parsed->dsper == "1000");
|
|
CHECK(parsed->totsmp == 100);
|
|
CHECK(parsed->repgsz == 10);
|
|
CHECK(parsed->svids == std::vector<uint32_t>{1, 2, 3});
|
|
}
|
|
|
|
TEST_CASE("S6F1 round-trip carries TRID + SMPLN + STIME + values") {
|
|
std::vector<s2::Item> values = {s2::Item::u4(uint32_t{42}), s2::Item::ascii("hot")};
|
|
auto m = s6f1_trace_data_send(7, 3, "20260606123000", values);
|
|
auto parsed = parse_s6f1(m);
|
|
REQUIRE(parsed.has_value());
|
|
CHECK(parsed->trid == 7);
|
|
CHECK(parsed->smpln == 3);
|
|
CHECK(parsed->stime == "20260606123000");
|
|
REQUIRE(parsed->values.size() == 2);
|
|
CHECK(parsed->values[0] == s2::Item::u4(uint32_t{42}));
|
|
}
|
|
|
|
// ---- Limits Monitoring (S2F45-F48) -------------------------------------
|
|
|
|
TEST_CASE("S2F45 round-trips define-limits request") {
|
|
std::vector<VidLimitsEntry> entries = {
|
|
{100, {{0, s2::Item::u4(uint32_t{1000}), s2::Item::u4(uint32_t{0})}}},
|
|
{101, {{0, s2::Item::f4(2.0f), s2::Item::f4(0.5f)},
|
|
{1, s2::Item::f4(3.0f), s2::Item::f4(0.1f)}}},
|
|
};
|
|
auto m = s2f45_define_variable_limits(7, entries);
|
|
auto parsed = parse_s2f45(m);
|
|
REQUIRE(parsed.has_value());
|
|
CHECK(parsed->dataid == 7);
|
|
REQUIRE(parsed->entries.size() == 2);
|
|
CHECK(parsed->entries[0].vid == 100);
|
|
REQUIRE(parsed->entries[0].limits.size() == 1);
|
|
CHECK(parsed->entries[0].limits[0].upper == s2::Item::u4(uint32_t{1000}));
|
|
CHECK(parsed->entries[1].vid == 101);
|
|
REQUIRE(parsed->entries[1].limits.size() == 2);
|
|
}
|
|
|
|
TEST_CASE("S2F46 / S2F48 round-trips") {
|
|
CHECK(*ack_byte(s2f46_define_variable_limits_ack(LimitMonitorAck::VidNotExist)) == 4);
|
|
|
|
std::vector<VidLimitsEntry> rows = {
|
|
{100, {{0, s2::Item::u4(uint32_t{1000}), s2::Item::u4(uint32_t{0})}}}};
|
|
auto m = s2f48_variable_limit_attribute_data(rows);
|
|
REQUIRE(m.body.has_value());
|
|
REQUIRE(m.body->is_list());
|
|
}
|
|
|
|
// ---- S9 error-stream round-trips ----------------------------------------
|
|
|
|
TEST_CASE("S9 MHEAD-carrying messages round-trip") {
|
|
// A representative 10-byte HSMS header (data message, S2F33 W, sys=42).
|
|
const std::string mhead(
|
|
"\x12\x34" // session id
|
|
"\x82" // byte2: W=1, stream=2
|
|
"\x21" // byte3: function=33
|
|
"\x00" // ptype
|
|
"\x00" // stype=Data
|
|
"\x00\x00\x00\x2A", // system bytes = 42
|
|
10);
|
|
|
|
auto check = [&](const s2::Message& m, std::optional<std::string> (*p)(const s2::Message&)) {
|
|
CHECK(m.stream == 9);
|
|
CHECK_FALSE(m.reply_expected);
|
|
auto out = p(m);
|
|
REQUIRE(out.has_value());
|
|
CHECK(*out == mhead);
|
|
};
|
|
|
|
check(s9f1_unrecognized_device_id(mhead), parse_s9f1);
|
|
check(s9f3_unrecognized_stream_type(mhead), parse_s9f3);
|
|
check(s9f5_unrecognized_function_type(mhead), parse_s9f5);
|
|
check(s9f7_illegal_data(mhead), parse_s9f7);
|
|
check(s9f9_transaction_timer_timeout(mhead), parse_s9f9);
|
|
check(s9f11_data_too_long(mhead), parse_s9f11);
|
|
}
|
|
|
|
TEST_CASE("S9F13 conversation timeout carries MEXP + EDID") {
|
|
auto m = s9f13_conversation_timeout("S2F33W", "EQUIP-01");
|
|
CHECK(m.stream == 9);
|
|
CHECK(m.function == 13);
|
|
auto parsed = parse_s9f13(m);
|
|
REQUIRE(parsed.has_value());
|
|
CHECK(parsed->mexp == "S2F33W");
|
|
CHECK(parsed->edid == "EQUIP-01");
|
|
}
|
|
|
|
// ---- S5F7 / S5F8 List Enabled Alarms -----------------------------------
|
|
|
|
TEST_CASE("S5F7 header-only; S5F8 round-trips alarm listing") {
|
|
auto req = s5f7_list_enabled_alarms_request();
|
|
CHECK(req.stream == 5);
|
|
CHECK(req.function == 7);
|
|
CHECK(req.reply_expected);
|
|
CHECK_FALSE(req.body.has_value());
|
|
|
|
std::vector<AlarmListing> rows = {{0x84, 1, "Chiller Temp High"},
|
|
{0x01, 2, "Door Open"}};
|
|
auto m = s5f8_list_enabled_alarms_data(rows);
|
|
auto parsed = parse_s5f8(m);
|
|
REQUIRE(parsed.has_value());
|
|
REQUIRE(parsed->size() == 2);
|
|
CHECK((*parsed)[0].alcd == 0x84);
|
|
CHECK((*parsed)[0].alid == 1);
|
|
CHECK((*parsed)[1].alcd == 0x01);
|
|
CHECK((*parsed)[1].altx == "Door Open");
|
|
}
|
|
|
|
// ---- S1F19 / S1F20 Get GEM Compliance ----------------------------------
|
|
|
|
TEST_CASE("S1F19 is header-only and S1F20 round-trips capability list") {
|
|
auto req = s1f19_get_gem_compliance_request();
|
|
CHECK(req.stream == 1);
|
|
CHECK(req.function == 19);
|
|
CHECK(req.reply_expected);
|
|
CHECK_FALSE(req.body.has_value());
|
|
|
|
std::vector<CapabilityEntry> caps = {
|
|
{1, "Establish Communications"},
|
|
{5, "Status Data Collection"},
|
|
{14, "Spooling"},
|
|
};
|
|
auto m = s1f20_get_gem_compliance_data("0.1.0", "EQUIPMENT", caps);
|
|
auto parsed = parse_s1f20(m);
|
|
REQUIRE(parsed.has_value());
|
|
CHECK(parsed->softrev == "0.1.0");
|
|
CHECK(parsed->equipment_type == "EQUIPMENT");
|
|
REQUIRE(parsed->capabilities.size() == 3);
|
|
CHECK(parsed->capabilities[0].ccode == 1);
|
|
CHECK(parsed->capabilities[0].cdesc == "Establish Communications");
|
|
CHECK(parsed->capabilities[2].ccode == 14);
|
|
CHECK(parsed->capabilities[2].cdesc == "Spooling");
|
|
}
|
|
|
|
// ---- S1F21 / S1F22 DVID Namelist ---------------------------------------
|
|
|
|
TEST_CASE("S1F22 round-trip preserves DVIDs (shape matches S1F12)") {
|
|
std::vector<StatusName> dvs = {{100, "WaferCounter", "wafer"},
|
|
{101, "ChamberPressure", "Torr"}};
|
|
auto m = s1f22_data_variable_namelist_data(dvs);
|
|
auto parsed = parse_s1f22(m);
|
|
REQUIRE(parsed.has_value());
|
|
REQUIRE(parsed->size() == 2);
|
|
CHECK((*parsed)[0].id == 100);
|
|
CHECK((*parsed)[0].name == "WaferCounter");
|
|
CHECK((*parsed)[0].units == "wafer");
|
|
CHECK((*parsed)[1].id == 101);
|
|
}
|
|
|
|
// ---- Extended GEM message round-trips ------------------------------------
|
|
|
|
TEST_CASE("S2F33 define-report round-trip") {
|
|
auto m = s2f33_define_report(7, {{1000, {1, 2, 3}}, {1001, {4}}});
|
|
auto parsed = parse_s2f33(m);
|
|
REQUIRE(parsed.has_value());
|
|
CHECK(parsed->dataid == 7);
|
|
REQUIRE(parsed->reports.size() == 2);
|
|
CHECK(parsed->reports[0].rptid == 1000);
|
|
CHECK(parsed->reports[0].vids == std::vector<uint32_t>{1, 2, 3});
|
|
CHECK(parsed->reports[1].rptid == 1001);
|
|
CHECK(parsed->reports[1].vids == std::vector<uint32_t>{4});
|
|
}
|
|
|
|
TEST_CASE("S2F35 link-event round-trip") {
|
|
auto m = s2f35_link_event_report(0, {{100, {1000, 1001}}, {200, {1001}}});
|
|
auto parsed = parse_s2f35(m);
|
|
REQUIRE(parsed.has_value());
|
|
CHECK(parsed->dataid == 0);
|
|
REQUIRE(parsed->links.size() == 2);
|
|
CHECK(parsed->links[0].ceid == 100);
|
|
CHECK(parsed->links[0].rptids == std::vector<uint32_t>{1000, 1001});
|
|
}
|
|
|
|
TEST_CASE("S2F37 enable-event round-trip") {
|
|
auto enable = s2f37_enable_event(true, {100, 200});
|
|
auto disable = s2f37_enable_event(false, {});
|
|
auto pe = parse_s2f37(enable);
|
|
auto pd = parse_s2f37(disable);
|
|
REQUIRE(pe.has_value());
|
|
REQUIRE(pd.has_value());
|
|
CHECK(pe->enable);
|
|
CHECK(pe->ceids == std::vector<uint32_t>{100, 200});
|
|
CHECK_FALSE(pd->enable);
|
|
CHECK(pd->ceids.empty());
|
|
}
|
|
|
|
TEST_CASE("S5F1 alarm-report round-trip") {
|
|
auto m = s5f1_alarm_report(0x84, 7, "Chiller temp high");
|
|
auto parsed = parse_s5f1(m);
|
|
REQUIRE(parsed.has_value());
|
|
CHECK(parsed->alid == 7);
|
|
CHECK(parsed->altx == "Chiller temp high");
|
|
CHECK(parsed->alcd == 0x84);
|
|
CHECK((parsed->alcd & 0x80) != 0); // set bit
|
|
CHECK((parsed->alcd & 0x7F) == 4); // category
|
|
}
|
|
|
|
TEST_CASE("S5F3 enable/disable alarm send round-trip") {
|
|
auto on = s5f3_enable_alarm(kAlarmEnableByte, 42);
|
|
auto off = s5f3_enable_alarm(kAlarmDisableByte, 42);
|
|
auto pon = parse_s5f3(on);
|
|
auto poff = parse_s5f3(off);
|
|
REQUIRE(pon.has_value());
|
|
REQUIRE(poff.has_value());
|
|
CHECK((pon->aled & 0x80) != 0);
|
|
CHECK((poff->aled & 0x80) == 0);
|
|
CHECK(pon->alid == 42);
|
|
}
|
|
|
|
TEST_CASE("S5F6 alarm list builder marks active alarms with bit 7") {
|
|
std::vector<Alarm> alarms = {{1, "Door", 1}, {2, "Heater", 4}};
|
|
auto m = s5f6_list_alarms_data(alarms, [](uint32_t id) { return id == 2; });
|
|
REQUIRE(m.body.has_value());
|
|
REQUIRE(m.body->is_list());
|
|
REQUIRE(m.body->as_list().size() == 2);
|
|
const auto& row0 = m.body->as_list()[0].as_list();
|
|
const auto& row1 = m.body->as_list()[1].as_list();
|
|
CHECK(row0[0].as_bytes()[0] == 0x01); // door inactive: cat 1, bit 7 clear
|
|
CHECK(row1[0].as_bytes()[0] == 0x84); // heater active: cat 4, bit 7 set
|
|
}
|
|
|
|
TEST_CASE("S6F11 event-report round-trip preserves DATAID, CEID, reports") {
|
|
std::vector<ReportData> reports = {
|
|
{1000, {s2::Item::ascii("OnlineRemote")}},
|
|
{1001, {s2::Item::u4(uint32_t{42}), s2::Item::ascii("hello")}},
|
|
};
|
|
auto m = s6f11_event_report(7, 100, reports);
|
|
auto parsed = parse_s6f11(m);
|
|
REQUIRE(parsed.has_value());
|
|
CHECK(parsed->dataid == 7);
|
|
CHECK(parsed->ceid == 100);
|
|
REQUIRE(parsed->reports.size() == 2);
|
|
CHECK(parsed->reports[0].rptid == 1000);
|
|
CHECK(parsed->reports[0].values[0] == s2::Item::ascii("OnlineRemote"));
|
|
CHECK(parsed->reports[1].rptid == 1001);
|
|
CHECK(parsed->reports[1].values[0] == s2::Item::u4(uint32_t{42}));
|
|
}
|
|
|
|
TEST_CASE("S7F3 process-program send round-trip") {
|
|
auto m = s7f3_process_program_send("RECIPE-A", "step1\nstep2\n");
|
|
auto parsed = parse_s7f3(m);
|
|
REQUIRE(parsed.has_value());
|
|
CHECK(parsed->ppid == "RECIPE-A");
|
|
CHECK(parsed->ppbody == "step1\nstep2\n");
|
|
}
|
|
|
|
TEST_CASE("S7F19 / S7F20 EPPD list") {
|
|
auto req = s7f19_current_eppd_request();
|
|
CHECK(req.stream == 7);
|
|
CHECK(req.function == 19);
|
|
CHECK(req.reply_expected);
|
|
CHECK_FALSE(req.body.has_value());
|
|
|
|
auto data = s7f20_current_eppd_data({"RECIPE-A", "RECIPE-B"});
|
|
auto parsed = parse_s7f20(data);
|
|
REQUIRE(parsed.has_value());
|
|
CHECK(*parsed == std::vector<std::string>{"RECIPE-A", "RECIPE-B"});
|
|
}
|