diff options
| author | blasty <blasty@local> | 2026-07-26 00:04:38 +0200 |
|---|---|---|
| committer | blasty <blasty@local> | 2026-07-26 00:04:38 +0200 |
| commit | cf8b4645e2744fff455fc09167f91d011a3e620a (patch) | |
| tree | f8480964ec9e531ed98916f3cb6a5d513833a2b6 /tests/test_formats.py | |
| parent | loading: ask how to load an unrecognised file, like IDA does (diff) | |
| download | ida-tui-cf8b4645e2744fff455fc09167f91d011a3e620a.tar.gz ida-tui-cf8b4645e2744fff455fc09167f91d011a3e620a.tar.xz ida-tui-cf8b4645e2744fff455fc09167f91d011a3e620a.zip | |
formats: verify every offered processor name against a real IDA
The curated list was written from the procs/ directory listing. Two of the
twenty names were wrong, and wrong here is not a soft failure: IDA REFUSES to
open the database (rc=4) with nothing useful said. The load dialog would have
handed people a dead end from inside the UI that exists to rescue them — the
same silent-failure class the dialog was built to kill.
h8 -> h8300 (h8.so is the module FILENAME, not a processor name)
sparc -> sparcb / sparcl (and SPARC has endianness variants, like MIPS/PPC)
Also probed the aliases people reach for first: arm64, aarch64, mips, m68k are
all invalid. 'arm' covers AArch64 (verified: an AArch64 blob analyses to 35
functions under -parm), so those names now live in the human labels, where the
filter still finds them — typing "arm64" finds ARM, "m68k" finds 68k, "mips"
finds both endiannesses.
tools/verify_procs.py does the check: open a scratch blob with -p<name>, read
back inf_get_procname(), compare. Fresh temp dir per name, because once a
database exists IDA ignores the load switches and every name after the first
would "pass". 21/21 verified.
tests: +11 formats, including the verified-set guard (adding a processor without
re-running the script fails on purpose) and checks that the rejected aliases are
NOT offered but ARE still findable by typing them. 32/0 formats, 199/0 scenarios.
Diffstat (limited to 'tests/test_formats.py')
| -rw-r--r-- | tests/test_formats.py | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/test_formats.py b/tests/test_formats.py index f88021c..ab72e8d 100644 --- a/tests/test_formats.py +++ b/tests/test_formats.py @@ -79,6 +79,35 @@ def main() -> int: check("the processor list leads with the common targets", [n for n, _ in PROCESSORS[:3]] == ["arm", "armb", "metapc"], f"{[n for n, _ in PROCESSORS[:3]]}") + + # Every offered name must have been checked against a real IDA, because a + # wrong one is REJECTED (rc=4) with nothing useful said — handing the user a + # dead end from inside the dialog meant to rescue them. This list is the + # output of tools/verify_procs.py; adding a processor without re-running it + # fails here on purpose. + VERIFIED = { + "arm", "armb", "metapc", "mipsl", "mipsb", "ppc", "ppcl", "sh4", "68k", + "riscv", "tricore", "xtensa", "avr", "z80", "tms320c6", "m32r", "arc", + "h8300", "sparcb", "sparcl", "s390", + } + offered = {n for n, _ in PROCESSORS} + check("every offered processor name is IDA-verified", + offered <= VERIFIED, f"unverified: {sorted(offered - VERIFIED)}") + + # These are module FILENAMES or common aliases, not -p names. IDA refuses + # them; they were in the list until a real run said otherwise. + for wrong in ("h8", "sparc", "arm64", "aarch64", "mips", "m68k"): + check(f"{wrong!r} is not offered (IDA rejects it)", wrong not in offered) + + # ...but someone WILL type them, so the labels have to carry the alias. + def finds(q): + ql = q.lower() + return [n for n, d in PROCESSORS if ql in n.lower() or ql in d.lower()] + check("typing 'arm64' still finds ARM", "arm" in finds("arm64"), f"{finds('arm64')}") + check("typing 'aarch64' still finds ARM", "arm" in finds("aarch64")) + check("typing 'm68k' still finds 68k", "68k" in finds("m68k"), f"{finds('m68k')}") + check("typing 'mips' finds both endiannesses", + set(finds("mips")) == {"mipsl", "mipsb"}, f"{finds('mips')}") check("every processor entry has a human label", all(n and d for n, d in PROCESSORS)) check("endianness is spelled out where it matters", |
