refactor(verify): share Ghidra installation prerequisites (#14569)

This commit is contained in:
Vincent Koc authored and GitHub committed 2026-11-26 01:24:43 +08:00
1 parent 6cdab224f9
commit a156d20516
20 files changed
+84 -168

No files matched your search

@@ -1,4 +1,5 @@
import type {
AvailableGhidraInstallation,
GhidraInstallationHost,
GhidraInstallationInspection,
GhidraInstallationOptions,
@@ -9,3 +10,12 @@ export function inspectVerifierGhidraInstallation(
options: Omit<GhidraInstallationOptions, "resourceOwner">,
host?: GhidraInstallationHost,
): Promise<GhidraInstallationInspection>;
export function inspectVerifierGhidraFromEnvironment(
environment: GhidraInstallationOptions["environment"],
installDir?: string,
): Promise<GhidraInstallationInspection>;
export function requireVerifierGhidraInstallation(
environment: GhidraInstallationOptions["environment"],
): Promise<AvailableGhidraInstallation>;
@@ -7,3 +7,33 @@ export function inspectVerifierGhidraInstallation(options, host) {
inspectGhidraInstallation({ ...options, resourceOwner }, host),
);
}
/** Inspect the verifier's selected installation with its optional Java home. */
export function inspectVerifierGhidraFromEnvironment(
environment,
installDir = environment.GHIDRA_INSTALL_DIR,
) {
return inspectVerifierGhidraInstallation({
environment,
installDir,
...(environment.JAVA_HOME === undefined
? {}
: { javaHome: environment.JAVA_HOME }),
});
}
/** Require a caller-selected, available installation before fixture setup. */
export async function requireVerifierGhidraInstallation(environment) {
const installDir = environment.GHIDRA_INSTALL_DIR;
if (installDir === undefined)
throw new Error("Missing prerequisite: caller-supplied GHIDRA_INSTALL_DIR");
const installation = await inspectVerifierGhidraFromEnvironment(
environment,
installDir,
);
if (installation.status !== "available")
throw new Error(
`Ghidra prerequisite unavailable: ${JSON.stringify(installation)}`,
);
return installation;
}
@@ -7,7 +7,7 @@ import { tmpdir } from "node:os";
import { basename, dirname, join } from "node:path";
import { fileURLToPath } from "node:url";
import { promisify } from "node:util";
import { inspectVerifierGhidraInstallation } from "./ghidra-installation-inspection.mjs";
import { inspectVerifierGhidraFromEnvironment } from "./ghidra-installation-inspection.mjs";
/** Exercise qualified annotation names against real demangled C++ ABI symbols. */
export async function verifyGhidraNamespaceAnnotations({
@@ -476,11 +476,7 @@ async function verifyAddressNames(call, symbols, kind) {
}
async function requireNamespaceDemangler(env) {
const inspection = await inspectVerifierGhidraInstallation({
environment: env,
installDir: env.GHIDRA_INSTALL_DIR,
...(env.JAVA_HOME === undefined ? {} : { javaHome: env.JAVA_HOME }),
});
const inspection = await inspectVerifierGhidraFromEnvironment(env);
if (
inspection.status !== "available" ||
inspection.nativeDecompilerPath === null
+2 -8
View File
@@ -13,7 +13,7 @@ import {
spawnOwnedProviderProcess,
} from "../dist/process/ProviderProcess.js";
import { cleanupOwnedProcessGroup } from "../dist/process/ProcessOwnership.js";
import { inspectVerifierGhidraInstallation } from "./lib/ghidra-installation-inspection.mjs";
import { inspectVerifierGhidraFromEnvironment } from "./lib/ghidra-installation-inspection.mjs";
import { completeVerifierRun, createVerifierRun } from "./lib/verifier-run.mjs";
import {
VerifierFixture,
@@ -65,13 +65,7 @@ if (process.env.GHIDRA_INSTALL_DIR === undefined)
"Set GHIDRA_INSTALL_DIR to a bring-your-own Ghidra installation.",
);
const installation = await inspectVerifierGhidraInstallation({
environment: process.env,
installDir: process.env.GHIDRA_INSTALL_DIR,
...(process.env.JAVA_HOME === undefined
? {}
: { javaHome: process.env.JAVA_HOME }),
});
const installation = await inspectVerifierGhidraFromEnvironment(process.env);
assert.ok(
installation.analyzeHeadlessPath !== null &&
(installation.status === "available" ||
+2 -8
View File
@@ -17,7 +17,7 @@ import { Ajv2020 } from "ajv/dist/2020.js";
import { parseEvidence } from "../dist/domain/evidence.js";
import { functionDossierSchema } from "../dist/domain/native/functionDossier.js";
import { nativeInstructionSchema } from "../dist/domain/native/nativeInstruction.js";
import { inspectVerifierGhidraInstallation } from "./lib/ghidra-installation-inspection.mjs";
import { inspectVerifierGhidraFromEnvironment } from "./lib/ghidra-installation-inspection.mjs";
import {
buildDosComFixture,
buildRejectedDosComFixture,
@@ -50,13 +50,7 @@ if (process.env.GHIDRA_INSTALL_DIR === undefined)
throw new Error(
"verify:ghidra:com prerequisite missing: GHIDRA_INSTALL_DIR (bring your own Ghidra).",
);
const installation = await inspectVerifierGhidraInstallation({
environment: process.env,
installDir: process.env.GHIDRA_INSTALL_DIR,
...(process.env.JAVA_HOME === undefined
? {}
: { javaHome: process.env.JAVA_HOME }),
});
const installation = await inspectVerifierGhidraFromEnvironment(process.env);
if (installation.status !== "available")
throw new Error(
`verify:ghidra:com prerequisite unavailable: ${JSON.stringify(installation)}`,
+2 -8
View File
@@ -24,7 +24,7 @@ import {
v8mBaselineFixture,
v8mMsplimFixture,
} from "../tests/conformance/ghidra/cortexM.fixture.mjs";
import { inspectVerifierGhidraInstallation } from "./lib/ghidra-installation-inspection.mjs";
import { inspectVerifierGhidraFromEnvironment } from "./lib/ghidra-installation-inspection.mjs";
import { llvmThumbMnemonics } from "./lib/llvm-thumb-oracle.mjs";
import {
requireMcpLifecycleResult,
@@ -53,13 +53,7 @@ if (process.env.GHIDRA_INSTALL_DIR === undefined)
throw new Error(
"Set GHIDRA_INSTALL_DIR to a bring-your-own Ghidra installation.",
);
const installation = await inspectVerifierGhidraInstallation({
environment: process.env,
installDir: process.env.GHIDRA_INSTALL_DIR,
...(process.env.JAVA_HOME === undefined
? {}
: { javaHome: process.env.JAVA_HOME }),
});
const installation = await inspectVerifierGhidraFromEnvironment(process.env);
assert.equal(installation.status, "available", JSON.stringify(installation));
const run = createVerifierRun();
// Every LLVM and CLI command runs as an owned process tree with a deadline.
+2 -14
View File
@@ -15,7 +15,7 @@ import {
} from "../dist/ghidra/GhidraLanguageCatalog.js";
import { parseEvidence } from "../dist/domain/evidence.js";
import { functionDossierSchema } from "../dist/domain/native/functionDossier.js";
import { inspectVerifierGhidraInstallation } from "./lib/ghidra-installation-inspection.mjs";
import { requireVerifierGhidraInstallation } from "./lib/ghidra-installation-inspection.mjs";
import { buildGameCubeDolFixture } from "../tests/conformance/ghidra/dol-fixture.mjs";
import {
GEKKO_LANGUAGE,
@@ -48,19 +48,7 @@ if (!["linux", "darwin"].includes(process.platform))
throw new Error(
"GameCube DOL verification requires a supported Linux/macOS Ghidra host",
);
if (process.env.GHIDRA_INSTALL_DIR === undefined)
throw new Error("Missing prerequisite: caller-supplied GHIDRA_INSTALL_DIR");
const installation = await inspectVerifierGhidraInstallation({
environment: process.env,
installDir: process.env.GHIDRA_INSTALL_DIR,
...(process.env.JAVA_HOME === undefined
? {}
: { javaHome: process.env.JAVA_HOME }),
});
if (installation.status !== "available")
throw new Error(
`Ghidra prerequisite unavailable: ${JSON.stringify(installation)}`,
);
const installation = await requireVerifierGhidraInstallation(process.env);
const entrypoint = fileURLToPath(new URL("./rea.mjs", import.meta.url));
const run = createVerifierRun();
+2 -8
View File
@@ -15,7 +15,7 @@ import { StdioClientTransport } from "@modelcontextprotocol/client/stdio";
import { parseEvidence } from "../dist/domain/evidence.js";
import { functionDossierSchema } from "../dist/domain/native/functionDossier.js";
import { functionBodySchema } from "../dist/domain/native/functionBody.js";
import { inspectVerifierGhidraInstallation } from "./lib/ghidra-installation-inspection.mjs";
import { inspectVerifierGhidraFromEnvironment } from "./lib/ghidra-installation-inspection.mjs";
import { buildDosMzFixture } from "../tests/conformance/ghidra/dos-mz-fixture.mjs";
import {
assertVerifierCleanupComplete,
@@ -41,13 +41,7 @@ if (process.env.GHIDRA_INSTALL_DIR === undefined)
throw new Error(
"verify:ghidra:dos prerequisite missing: GHIDRA_INSTALL_DIR (bring your own Ghidra).",
);
const installation = await inspectVerifierGhidraInstallation({
environment: process.env,
installDir: process.env.GHIDRA_INSTALL_DIR,
...(process.env.JAVA_HOME === undefined
? {}
: { javaHome: process.env.JAVA_HOME }),
});
const installation = await inspectVerifierGhidraFromEnvironment(process.env);
if (installation.status !== "available")
throw new Error(
`verify:ghidra:dos prerequisite unavailable: ${JSON.stringify(installation)}`,
@@ -10,7 +10,7 @@ import { parseBinaryTarget } from "../dist/application/BinaryTargetResolver.js";
import { parseEvidence } from "../dist/domain/evidence.js";
import { parseAnalysisSnapshot } from "../dist/domain/analysisSnapshot.js";
import { functionDossierSchema } from "../dist/domain/native/functionDossier.js";
import { inspectVerifierGhidraInstallation } from "./lib/ghidra-installation-inspection.mjs";
import { requireVerifierGhidraInstallation } from "./lib/ghidra-installation-inspection.mjs";
import { buildMipsRelocatableFixture } from "../tests/conformance/ghidra/mips-fixture.mjs";
import {
assertMipsRelocations,
@@ -41,19 +41,7 @@ if (!["linux", "darwin"].includes(process.platform))
throw new Error(
"MIPS verification requires a supported Linux/macOS Ghidra host",
);
if (process.env.GHIDRA_INSTALL_DIR === undefined)
throw new Error("Missing prerequisite: caller-supplied GHIDRA_INSTALL_DIR");
const installation = await inspectVerifierGhidraInstallation({
environment: process.env,
installDir: process.env.GHIDRA_INSTALL_DIR,
...(process.env.JAVA_HOME === undefined
? {}
: { javaHome: process.env.JAVA_HOME }),
});
if (installation.status !== "available")
throw new Error(
`Ghidra prerequisite unavailable: ${JSON.stringify(installation)}`,
);
const installation = await requireVerifierGhidraInstallation(process.env);
const entrypoint = fileURLToPath(new URL("./rea.mjs", import.meta.url));
const run = createVerifierRun();
// Refuse a host without the fixture toolchain before allocating anything.
+2 -14
View File
@@ -29,7 +29,7 @@ import {
import { parseEvidence } from "../dist/domain/evidence.js";
import { parseAnalysisSnapshot } from "../dist/domain/analysisSnapshot.js";
import { functionDossierSchema } from "../dist/domain/native/functionDossier.js";
import { inspectVerifierGhidraInstallation } from "./lib/ghidra-installation-inspection.mjs";
import { requireVerifierGhidraInstallation } from "./lib/ghidra-installation-inspection.mjs";
import { buildMipsFixture } from "../tests/conformance/ghidra/mips-fixture.mjs";
import {
buildPspFixture,
@@ -70,19 +70,7 @@ if (!["linux", "darwin"].includes(process.platform))
throw new Error(
"MIPS verification requires a supported Linux/macOS Ghidra host",
);
if (process.env.GHIDRA_INSTALL_DIR === undefined)
throw new Error("Missing prerequisite: caller-supplied GHIDRA_INSTALL_DIR");
const installation = await inspectVerifierGhidraInstallation({
environment: process.env,
installDir: process.env.GHIDRA_INSTALL_DIR,
...(process.env.JAVA_HOME === undefined
? {}
: { javaHome: process.env.JAVA_HOME }),
});
if (installation.status !== "available")
throw new Error(
`Ghidra prerequisite unavailable: ${JSON.stringify(installation)}`,
);
const installation = await requireVerifierGhidraInstallation(process.env);
const entrypoint = fileURLToPath(new URL("./rea.mjs", import.meta.url));
const run = createVerifierRun();
// Refuse a host without the fixture toolchain before allocating anything.
+2 -14
View File
@@ -10,7 +10,7 @@ import { parseBinaryTarget } from "../dist/application/BinaryTargetResolver.js";
import { parseEvidence } from "../dist/domain/evidence.js";
import { parseAnalysisSnapshot } from "../dist/domain/analysisSnapshot.js";
import { functionDossierSchema } from "../dist/domain/native/functionDossier.js";
import { inspectVerifierGhidraInstallation } from "./lib/ghidra-installation-inspection.mjs";
import { requireVerifierGhidraInstallation } from "./lib/ghidra-installation-inspection.mjs";
import { buildMipsSharedFixture } from "../tests/conformance/ghidra/mips-fixture.mjs";
import {
assertMipsSharedLoad,
@@ -40,19 +40,7 @@ if (!["linux", "darwin"].includes(process.platform))
throw new Error(
"MIPS verification requires a supported Linux/macOS Ghidra host",
);
if (process.env.GHIDRA_INSTALL_DIR === undefined)
throw new Error("Missing prerequisite: caller-supplied GHIDRA_INSTALL_DIR");
const installation = await inspectVerifierGhidraInstallation({
environment: process.env,
installDir: process.env.GHIDRA_INSTALL_DIR,
...(process.env.JAVA_HOME === undefined
? {}
: { javaHome: process.env.JAVA_HOME }),
});
if (installation.status !== "available")
throw new Error(
`Ghidra prerequisite unavailable: ${JSON.stringify(installation)}`,
);
const installation = await requireVerifierGhidraInstallation(process.env);
const entrypoint = fileURLToPath(new URL("./rea.mjs", import.meta.url));
const run = createVerifierRun();
// Refuse a host without the fixture toolchain before allocating anything. The
+2 -14
View File
@@ -17,7 +17,7 @@ import {
import { parseEvidence } from "../dist/domain/evidence.js";
import { parseAnalysisSnapshot } from "../dist/domain/analysisSnapshot.js";
import { functionDossierSchema } from "../dist/domain/native/functionDossier.js";
import { inspectVerifierGhidraInstallation } from "./lib/ghidra-installation-inspection.mjs";
import { requireVerifierGhidraInstallation } from "./lib/ghidra-installation-inspection.mjs";
import { buildPowerPcFixture } from "../tests/conformance/ghidra/ppc-fixture.mjs";
import { requireMcpOperationResult } from "./lib/mcp-verifier-results.mjs";
import {
@@ -41,19 +41,7 @@ if (!["linux", "darwin"].includes(process.platform))
throw new Error(
"PowerPC verification requires a supported Linux/macOS Ghidra host",
);
if (process.env.GHIDRA_INSTALL_DIR === undefined)
throw new Error("Missing prerequisite: caller-supplied GHIDRA_INSTALL_DIR");
const installation = await inspectVerifierGhidraInstallation({
environment: process.env,
installDir: process.env.GHIDRA_INSTALL_DIR,
...(process.env.JAVA_HOME === undefined
? {}
: { javaHome: process.env.JAVA_HOME }),
});
if (installation.status !== "available")
throw new Error(
`Ghidra prerequisite unavailable: ${JSON.stringify(installation)}`,
);
const installation = await requireVerifierGhidraInstallation(process.env);
const entrypoint = fileURLToPath(new URL("./rea.mjs", import.meta.url));
const run = createVerifierRun();
// Refuse a host without the fixture toolchain before allocating anything.
+2 -14
View File
@@ -18,7 +18,7 @@ import {
import { parseEvidence } from "../dist/domain/evidence.js";
import { parseAnalysisSnapshot } from "../dist/domain/analysisSnapshot.js";
import { functionDossierSchema } from "../dist/domain/native/functionDossier.js";
import { inspectVerifierGhidraInstallation } from "./lib/ghidra-installation-inspection.mjs";
import { requireVerifierGhidraInstallation } from "./lib/ghidra-installation-inspection.mjs";
import { buildPowerPc64Fixture } from "../tests/conformance/ghidra/ppc-fixture.mjs";
import {
requireMcpOperationResult,
@@ -44,19 +44,7 @@ if (!["linux", "darwin"].includes(process.platform))
throw new Error(
"PPC64 verification requires a supported Linux/macOS Ghidra host",
);
if (process.env.GHIDRA_INSTALL_DIR === undefined)
throw new Error("Missing prerequisite: caller-supplied GHIDRA_INSTALL_DIR");
const installation = await inspectVerifierGhidraInstallation({
environment: process.env,
installDir: process.env.GHIDRA_INSTALL_DIR,
...(process.env.JAVA_HOME === undefined
? {}
: { javaHome: process.env.JAVA_HOME }),
});
if (installation.status !== "available")
throw new Error(
`Ghidra prerequisite unavailable: ${JSON.stringify(installation)}`,
);
const installation = await requireVerifierGhidraInstallation(process.env);
const entrypoint = fileURLToPath(new URL("./rea.mjs", import.meta.url));
const run = createVerifierRun();
// Refuse a host without the fixture toolchain before allocating anything.
@@ -14,7 +14,7 @@ import { createVerifierRun, completeVerifierRun } from "./lib/verifier-run.mjs";
import { Client } from "@modelcontextprotocol/client";
import { createAnalysisProfile } from "../dist/domain/analysisProfile.js";
import { createEvidenceBundle } from "../dist/domain/evidenceBundle.js";
import { inspectVerifierGhidraInstallation } from "./lib/ghidra-installation-inspection.mjs";
import { inspectVerifierGhidraFromEnvironment } from "./lib/ghidra-installation-inspection.mjs";
import { withVerifierCleanup } from "./lib/verifier-cleanup.mjs";
import {
VerifierFixture,
@@ -36,13 +36,10 @@ export async function verifyProjectCoverage(run) {
throw new Error(
"Set GHIDRA_INSTALL_DIR to an absolute Ghidra installation path.",
);
const installation = await inspectVerifierGhidraInstallation({
environment: process.env,
const installation = await inspectVerifierGhidraFromEnvironment(
process.env,
installDir,
...(process.env.JAVA_HOME === undefined
? {}
: { javaHome: process.env.JAVA_HOME }),
});
);
if (installation.status !== "available")
throw new Error(`Ghidra is unavailable: ${JSON.stringify(installation)}`);
if (process.platform === "win32")
+2 -8
View File
@@ -15,7 +15,7 @@ import {
ProviderProcessSupervisor,
spawnOwnedProviderProcess,
} from "../dist/process/ProviderProcess.js";
import { inspectVerifierGhidraInstallation } from "./lib/ghidra-installation-inspection.mjs";
import { inspectVerifierGhidraFromEnvironment } from "./lib/ghidra-installation-inspection.mjs";
import {
requireMcpLifecycleResult,
requireMcpOutput,
@@ -48,13 +48,7 @@ if (process.env.GHIDRA_INSTALL_DIR === undefined)
throw new Error(
"Set GHIDRA_INSTALL_DIR to a bring-your-own Ghidra installation.",
);
const installation = await inspectVerifierGhidraInstallation({
environment: process.env,
installDir: process.env.GHIDRA_INSTALL_DIR,
...(process.env.JAVA_HOME === undefined
? {}
: { javaHome: process.env.JAVA_HOME }),
});
const installation = await inspectVerifierGhidraFromEnvironment(process.env);
assert.equal(installation.status, "available", JSON.stringify(installation));
const run = createVerifierRun();
+2 -8
View File
@@ -14,7 +14,7 @@ import { parseBinaryTarget } from "../dist/application/BinaryTargetResolver.js";
import { parseAnalysisSnapshot } from "../dist/domain/analysisSnapshot.js";
import { parseEvidence } from "../dist/domain/evidence.js";
import { functionDossierSchema } from "../dist/domain/native/functionDossier.js";
import { inspectVerifierGhidraInstallation } from "./lib/ghidra-installation-inspection.mjs";
import { inspectVerifierGhidraFromEnvironment } from "./lib/ghidra-installation-inspection.mjs";
import { SUPPORTED_GHIDRA_VERSION } from "../dist/ghidra/GhidraReleasePolicy.js";
import {
buildRiscvFixture,
@@ -59,13 +59,7 @@ for (const key of ["REA_GHIDRA_LANGUAGE_ID", "REA_GHIDRA_COMPILER_SPEC_ID"])
throw new Error(
`Unset ${key}: this lane verifies provider-pinned selection.`,
);
const installation = await inspectVerifierGhidraInstallation({
environment: process.env,
installDir: process.env.GHIDRA_INSTALL_DIR,
...(process.env.JAVA_HOME === undefined
? {}
: { javaHome: process.env.JAVA_HOME }),
});
const installation = await inspectVerifierGhidraFromEnvironment(process.env);
assert.equal(installation.status, "available", JSON.stringify(installation));
assert.equal(installation.providerVersion, SUPPORTED_GHIDRA_VERSION);
+2 -8
View File
@@ -99,19 +99,13 @@ try {
let installation;
try {
if (!compilerOnly) {
const { inspectVerifierGhidraInstallation } =
const { inspectVerifierGhidraFromEnvironment } =
await import("./lib/ghidra-installation-inspection.mjs");
assert.ok(
process.env.GHIDRA_INSTALL_DIR,
"Ghidra switch lane prerequisite missing: GHIDRA_INSTALL_DIR (bring your own)",
);
installation = await inspectVerifierGhidraInstallation({
environment: process.env,
installDir: process.env.GHIDRA_INSTALL_DIR,
...(process.env.JAVA_HOME === undefined
? {}
: { javaHome: process.env.JAVA_HOME }),
});
installation = await inspectVerifierGhidraFromEnvironment(process.env);
assert.equal(
installation.status,
"available",
+4 -7
View File
@@ -19,7 +19,7 @@ import {
parseGhidraInventoryInput,
parseGhidraInventoryResult,
} from "../dist/ghidra/GhidraInventoryValues.js";
import { inspectVerifierGhidraInstallation } from "./lib/ghidra-installation-inspection.mjs";
import { inspectVerifierGhidraFromEnvironment } from "./lib/ghidra-installation-inspection.mjs";
import { SUPPORTED_GHIDRA_VERSION } from "../dist/ghidra/GhidraReleasePolicy.js";
import { GhidraHeadlessLauncher } from "../dist/ghidra/GhidraLauncher.js";
import { GHIDRA_PROVIDER_IDENTITY } from "../dist/ghidra/GhidraProviderMetadata.js";
@@ -60,13 +60,10 @@ if (installDir === undefined || !isAbsolute(installDir))
throw new Error(
`Set GHIDRA_INSTALL_DIR to the absolute root of Ghidra ${SUPPORTED_GHIDRA_VERSION}.`,
);
const installation = await inspectVerifierGhidraInstallation({
environment: process.env,
const installation = await inspectVerifierGhidraFromEnvironment(
process.env,
installDir,
...(process.env.JAVA_HOME === undefined
? {}
: { javaHome: process.env.JAVA_HOME }),
});
);
if (
installation.status !== "available" ||
installation.analyzeHeadlessPath === null ||
+4 -7
View File
@@ -9,7 +9,7 @@ import { fileURLToPath } from "node:url";
import { parseBinaryTarget } from "../dist/application/BinaryTargetResolver.js";
import { resolveGhidraAnalysisProfile } from "../dist/ghidra/GhidraAnalysisProfile.js";
import { GhidraClient } from "../dist/ghidra/GhidraClient.js";
import { inspectVerifierGhidraInstallation } from "./lib/ghidra-installation-inspection.mjs";
import { inspectVerifierGhidraFromEnvironment } from "./lib/ghidra-installation-inspection.mjs";
import { SUPPORTED_GHIDRA_VERSION } from "../dist/ghidra/GhidraReleasePolicy.js";
import { GhidraHeadlessLauncher } from "../dist/ghidra/GhidraLauncher.js";
import { GHIDRA_PROVIDER_IDENTITY } from "../dist/ghidra/GhidraProviderMetadata.js";
@@ -60,13 +60,10 @@ if (installDir === undefined || !isAbsolute(installDir))
throw new Error(
`Set GHIDRA_INSTALL_DIR to the absolute root of an extracted Ghidra ${SUPPORTED_GHIDRA_VERSION} release.`,
);
const installation = await inspectVerifierGhidraInstallation({
environment: process.env,
const installation = await inspectVerifierGhidraFromEnvironment(
process.env,
installDir,
...(process.env.JAVA_HOME === undefined
? {}
: { javaHome: process.env.JAVA_HOME }),
});
);
if (
installation.status !== "available" ||
installation.analyzeHeadlessPath === null
@@ -181,6 +181,7 @@ it("Ghidra verifier probes await the shared owned inspection contract", async ()
);
const paths = [
...names.map((name) => `scripts/${name}`),
"scripts/verify-ghidra-loader-relocation.mjs",
"scripts/lib/real-ghidra-namespace-annotations.mjs",
];
const probes: string[] = [];
@@ -200,6 +201,8 @@ it("Ghidra verifier probes await the shared owned inspection contract", async ()
[
"inspectGhidraInstallation",
"inspectVerifierGhidraInstallation",
"inspectVerifierGhidraFromEnvironment",
"requireVerifierGhidraInstallation",
].includes(node.expression.text)
) {
probes.push(path);
@@ -208,7 +211,7 @@ it("Ghidra verifier probes await the shared owned inspection contract", async ()
path,
reason: "installation result was not awaited",
});
if (node.expression.text !== "inspectVerifierGhidraInstallation")
if (node.expression.text === "inspectGhidraInstallation")
violations.push({
path,
reason: "inspection has no shared cleanup owner",