mirror of
https://github.com/morluto/rea.git
synced 2026-11-14 18:52:48 +00:00
The darwin-only acceptance test passes the caller's environment to the CLI and points only Hopper, Ghidra and Java at missing paths. On macOS the list_names fallback has four candidates (ghidra, hopper, ida, kuna), so a REA_IDA_MCP_CONFIG or REA_KUNA_COMMAND set in the developer's shell still reaches it: with REA_KUNA_COMMAND set, kuna is no longer rejected as not_configured. Point both at missing paths, as tests/acceptance/nativeDispatchSnapshot.test.ts does, so the test always exercises the unavailable fallback. Signed-off-by: Zhaowei Gu <83746079+zw-g@users.noreply.github.com> Refs #7651 Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>
50 lines
1.7 KiB
TypeScript
50 lines
1.7 KiB
TypeScript
import { writeFile } from "node:fs/promises";
|
|
import { join } from "node:path";
|
|
import { expect } from "vitest";
|
|
import { createTestTempDirectory } from "../fixtures/temporaryDirectory.js";
|
|
import { cliTest } from "../support/cli/cliFixture.js";
|
|
|
|
cliTest.skipIf(process.platform !== "darwin")(
|
|
"retains the 32-bit reader refusal when symbol fallback is unavailable",
|
|
async ({ cli }) => {
|
|
const root = await createTestTempDirectory("rea-dispatch-width-");
|
|
for (const cpu of [7, 12]) {
|
|
const image = Buffer.alloc(28);
|
|
image.writeUInt32LE(0xfeedface, 0);
|
|
image.writeUInt32LE(cpu, 4);
|
|
image.writeUInt32LE(cpu === 7 ? 3 : 9, 8);
|
|
image.writeUInt32LE(2, 12);
|
|
const path = join(root, `image-${cpu}`);
|
|
await writeFile(path, image);
|
|
const result = await cli.run({
|
|
arguments: [
|
|
"inspect-native-dispatch-metadata",
|
|
path,
|
|
"--format",
|
|
"json",
|
|
],
|
|
environment: {
|
|
...process.env,
|
|
REA_ANALYSIS_PROVIDER: "auto",
|
|
HOPPER_LAUNCHER_PATH: join(root, "missing-hopper"),
|
|
GHIDRA_INSTALL_DIR: join(root, "missing-ghidra"),
|
|
JAVA_HOME: join(root, "missing-java"),
|
|
REA_IDA_MCP_CONFIG: join(root, "missing-ida-mcp.json"),
|
|
REA_KUNA_COMMAND: join(root, "missing-kuna"),
|
|
REA_KUNA_CACHE_DIR: join(root, "missing-kuna-cache"),
|
|
},
|
|
});
|
|
expect(result.exitCode).toBe(1);
|
|
expect(result.json).toMatchObject({
|
|
details: {
|
|
diagnostics: {
|
|
binary_metadata_failure: {
|
|
details: { reason: expect.stringMatching(/32.bit/i) },
|
|
},
|
|
},
|
|
},
|
|
});
|
|
}
|
|
},
|
|
);
|