From c4bf286e419b24b2317f250884c3235dedb1c53c Mon Sep 17 00:00:00 2001 From: blasty Date: Fri, 24 Jul 2026 14:24:05 +0200 Subject: tests: add --worker to run the pilot suite against the idalib worker run()/main() gain a worker path: IdaTui(open_path=binary, backend="worker", ensure_server=False) instead of attaching to an mcp supervisor via --db. boot() and every scenario are backend-agnostic (they drive app.program), so the full 31-scenario suite runs unchanged on the worker. This is the verification gate before deleting the mcp transport: ~/ida-venv/bin/python tests/test_scenarios.py --worker targets/echo The default (no --worker) still uses the mcp supervisor + --db, so nothing regresses until we pull the plug. --- tests/test_scenarios.py | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/tests/test_scenarios.py b/tests/test_scenarios.py index 7372c02..eed3c59 100644 --- a/tests/test_scenarios.py +++ b/tests/test_scenarios.py @@ -1651,9 +1651,15 @@ async def s_func_banners(c: Ctx): # --------------------------------------------------------------------------- # # Runner # --------------------------------------------------------------------------- # -async def run(db, only=None): - url = os.environ.get("IDA_MCP_URL", "http://127.0.0.1:8745/mcp") - app = IdaTui(url=url, db=db, keepalive=False) +async def run(db, only=None, binary=None, backend="mcp"): + if backend == "worker": + # Own idalib worker: opens the binary in-process over a unix socket, no + # supervisor. Mirrors launch.py's worker branch. + app = IdaTui(open_path=binary, ensure_server=False, + backend="worker", keepalive=False) + else: + url = os.environ.get("IDA_MCP_URL", "http://127.0.0.1:8745/mcp") + app = IdaTui(url=url, db=db, keepalive=False) async with app.run_test(size=(140, 44)) as pilot: c = Ctx(app, pilot) await c.boot() @@ -1676,7 +1682,8 @@ async def run(db, only=None): def main(argv): global STOP_AFTER - db = only = None + db = only = binary = None + backend = "mcp" it = iter(argv) for a in it: if a == "--db": @@ -1685,12 +1692,16 @@ def main(argv): only = next(it).split(",") elif a == "--stop-after": STOP_AFTER = next(it) + elif a == "--worker": + # --worker : run the suite against our own idalib worker + backend = "worker" + binary = os.path.abspath(os.path.expanduser(next(it))) elif a == "--list": for name, _ in SCENARIOS: print(name) return 0 try: - asyncio.run(run(db, only)) + asyncio.run(run(db, only, binary=binary, backend=backend)) except _StopSuite: print(f" … stopped after '{STOP_AFTER}'") print(f"\n{PASS} passed, {FAIL} failed") -- cgit v1.3.1-sl0p