mirror of
https://github.com/morluto/rea.git
synced 2026-11-04 22:06:10 +00:00
* test: strengthen integration oracles and verification * test: bound lifecycle gates and strengthen workflow checks * test: verify complete paged and extracted results * test: preserve bytecode and cancellation evidence * test: strengthen retained evidence and fixture cleanup * test: require cross-projection bridge identities * test: retain fixture owners through cleanup failures * test: verify graph examples and project selectors * test: tighten provider and lifecycle regressions * test: consolidate hex coverage and bound cutter cleanup * test: bound subprocess output waits and strengthen graph checks * test: check mcp recovery and preserve cleanup owners * test: verify structured mcp argument failures * test: preserve artifact cleanup and gdb limit evidence * test: preserve evidence identities and bound provider gates * test: retain browser and comparison cleanup owners * test: bound startup and strengthen fixture oracles * test: bound lifecycle gates and verify recovered evidence * test: verify public outcomes and lifecycle ownership * test: assert precise evidence and release lifecycle gates * test: verify selected facts and bound cleanup waits * test: check retained evidence and decoded records * test: verify final reports and retain cleanup ownership * test: bound reviewed startup gates and retain cleanup * test: verify PE errors and preserve MCP cleanup * test: preserve MCP fixture cleanup ownership * test: release provider gates before late startup
60 lines
2.1 KiB
TypeScript
60 lines
2.1 KiB
TypeScript
import { mkdir, writeFile } from "node:fs/promises";
|
|
import { delimiter, join } from "node:path";
|
|
|
|
import { expect, it } from "vitest";
|
|
import { z } from "zod";
|
|
|
|
import { connectLocalToolsMcp } from "../fixtures/localToolsMcp.js";
|
|
import { parseMcpToolError } from "../fixtures/mcpToolError.js";
|
|
import { createTestTempDirectory } from "../fixtures/temporaryDirectory.js";
|
|
|
|
it("isolates Ghidra PATH discovery while honoring an explicit installation override", async () => {
|
|
const root = await createTestTempDirectory("rea-local-tools-provider-");
|
|
await mkdir(join(root, "Ghidra"), { recursive: true });
|
|
await mkdir(join(root, "support"), { recursive: true });
|
|
await writeFile(
|
|
join(root, "Ghidra", "application.properties"),
|
|
"application.version=12.1.4\napplication.java.min=21\n",
|
|
);
|
|
await writeFile(
|
|
join(root, process.platform === "win32" ? "ghidraRun.bat" : "ghidraRun"),
|
|
"",
|
|
{ mode: 0o700 },
|
|
);
|
|
await writeFile(
|
|
join(
|
|
root,
|
|
"support",
|
|
process.platform === "win32" ? "analyzeHeadless.bat" : "analyzeHeadless",
|
|
),
|
|
"",
|
|
{ mode: 0o700 },
|
|
);
|
|
const path = [root, process.env.PATH ?? ""].join(delimiter);
|
|
const probe = async (environment: Readonly<Record<string, string>>) => {
|
|
const { call } = await connectLocalToolsMcp({ PATH: path, ...environment });
|
|
const response = await call("open_binary", {
|
|
path: process.execPath,
|
|
provider_id: "ghidra",
|
|
});
|
|
expect(response.isError).toBe(true);
|
|
const error = parseMcpToolError(response);
|
|
const details = z
|
|
.object({
|
|
rejections: z.array(
|
|
z.object({ provider_id: z.string(), diagnostics: z.unknown() }),
|
|
),
|
|
})
|
|
.parse(error.error.details);
|
|
const rejection = details.rejections.find(
|
|
(item) => item.provider_id === "ghidra",
|
|
);
|
|
if (rejection === undefined) throw new Error("Missing Ghidra rejection");
|
|
return z.object({ install_dir: z.string() }).parse(rejection.diagnostics)
|
|
.install_dir;
|
|
};
|
|
|
|
expect(await probe({})).toBe(process.execPath);
|
|
expect(await probe({ GHIDRA_INSTALL_DIR: root })).toBe(root);
|
|
});
|