isa, scripts: two more registry crash paths become diagnostics (#215)

- A variant whose first duplicate base form is incomplete: the completeness
  check and the XML check now use the same base row (no KeyError).
- qa rdna2 inventory and rank report a malformed encoding_variant (missing
  'of', non-string operands) as an error with exit 2, not a traceback; the
  coverage reader checks the field types.
Each has a test that fails on the previous code.

Signed-off-by: elforeign <324243036+elforeign@users.noreply.github.com>
This commit is contained in:
elforeign committed 2026-11-24 08:34:00 -06:00
1 parent de536c033b
commit 263284ff4f
5 files changed
+82 -7

No files matched your search

+6 -2
View File
@@ -182,11 +182,15 @@ def read_declarations(registry, identified):
# An encoding variant declares its base form in another encoding family.
raw_variants = registry.get("encoding_variant", [])
if not isinstance(raw_variants, list) or not all(
isinstance(variant, dict) and {"family", "of", "opcode", "operands"} <= set(variant)
isinstance(variant, dict)
and {"family", "of", "opcode", "operands"} <= set(variant)
and all(isinstance(variant[key], str) for key in ("family", "of", "operands"))
and type(variant["opcode"]) is int
for variant in raw_variants
):
raise ValueError(
f"{REGISTRY}: every encoding_variant needs family, of, opcode and operands"
f"{REGISTRY}: every encoding_variant needs string family, of and operands"
" and an integer opcode"
)
variants = [
{"family": variant["family"], "name": variant["of"], "opcode": variant["opcode"],