diff options
| author | blasty <blasty@local> | 2026-07-10 15:35:21 +0200 |
|---|---|---|
| committer | blasty <blasty@local> | 2026-07-10 15:35:21 +0200 |
| commit | 0531f0e1787061aff06b01981d0e72d3718e3637 (patch) | |
| tree | c8c14283ffb581be90260e5770cd7952c98fa9ff /tests/rpc_smoke.py | |
| parent | rpc: more verbs — structured reads, modal select, in-view search, save (diff) | |
| download | ida-tui-0531f0e1787061aff06b01981d0e72d3718e3637.tar.gz ida-tui-0531f0e1787061aff06b01981d0e72d3718e3637.tar.xz ida-tui-0531f0e1787061aff06b01981d0e72d3718e3637.zip | |
rpc: readiness, quit, methods discovery, not-ready guard
Spawn-and-drive needs to know when the freshly-launched TUI is usable:
ping/state now carry {ready,functions,complete} (cheap; no health call)
and ping adds the module name. Add a graceful 'quit' verb (acks, then
exits on a short delay so the reply still flushes) and a self-documenting
'methods' table. Program-dependent verbs are refused with a clear
'not ready' instead of exploding in a worker while still loading.
rpc_smoke covers readiness, methods and quit (21 green).
Diffstat (limited to 'tests/rpc_smoke.py')
| -rw-r--r-- | tests/rpc_smoke.py | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/tests/rpc_smoke.py b/tests/rpc_smoke.py index 01418b8..ba579a9 100644 --- a/tests/rpc_smoke.py +++ b/tests/rpc_smoke.py @@ -62,7 +62,15 @@ async def run(db): c = Conn(r, w) resp = await c.call("ping") - check("ping returns proto", resp.get("result", {}).get("proto") == 1, str(resp)) + pong = resp.get("result", {}) + check("ping returns proto + readiness", + pong.get("proto") == 1 and pong.get("ready") is True and pong.get("functions", 0) > 0, + str(pong)) + + resp = await c.call("methods") + check("methods lists the verb table", + isinstance(resp.get("result"), dict) and "pseudocode" in resp["result"], + str(resp)[:80]) resp = await c.call("functions", limit=400) funcs = resp.get("result", []) @@ -200,7 +208,20 @@ async def run(db): st.get("active") in ("decomp", "disasm"), str(st.get("active"))) await c.call("keys", keys=["escape"]) - w.close() + try: + w.close() + except Exception: # noqa: BLE001 + pass + + # --- graceful quit (last: it tears the app down) ------------------- # + r2, w2 = await asyncio.open_unix_connection(sock) + c2 = Conn(r2, w2) + resp = await c2.call("quit") + check("quit acknowledges before shutting down", + resp.get("result", {}).get("quitting") is True, str(resp)) + w2.close() + await wait_for(lambda: not app.is_running, pilot.pause, 10) + check("quit actually exits the app", not app.is_running, "still running") print(f"\n{PASS} passed, {FAIL} failed") return 1 if FAIL else 0 |
