Skip to content

armgit / rea

Public Imported from GitHub
0

Reverse engineer anything with agents, from app behavior down to native binaries.

test(ghidra): use host-native absolute session root fixtures

N0zoM1z01e83d270c209
diff --git a/src/ghidra/GhidraSessionRoot.test.ts b/src/ghidra/GhidraSessionRoot.test.ts
index bc5369dd3..c1c1ecf60 100644
--- a/src/ghidra/GhidraSessionRoot.test.ts
+++ b/src/ghidra/GhidraSessionRoot.test.ts
@@ -1,4 +1,4 @@
-import { join, sep } from "node:path";
+import { join, resolve, sep } from "node:path";
import { describe, expect, it } from "vitest";
import { ghidraSessionRoot } from "./GhidraSessionRoot.js";
@@ -7,8 +7,8 @@ const hasDotPrefixElement = (directory: string): boolean =>
directory.split(sep).some((element) => element.startsWith("."));
const POSIX = process.platform !== "win32";
-const posixFallback = join(sep, "tmp");
-const posixBase = (...segments: string[]) => join(sep, ...segments);
+const posixFallback = join(resolve(sep), "tmp");
+const posixBase = (...segments: string[]) => join(resolve(sep), ...segments);
describe("ghidraSessionRoot", () => {
it("keeps an inherited base that Ghidra accepts", () => {
@@ -53,6 +53,15 @@ describe("ghidraSessionRoot", () => {
expect(hasDotPrefixElement(directory)).toBe(false);
});
+ it("uses the nearest safe ancestor when the platform has no fallback", () => {
+ expect(
+ ghidraSessionRoot({
+ base: posixBase("Users", "operator", ".cache", "scratch"),
+ platform: "win32",
+ }),
+ ).toBe(posixBase("Users", "operator"));
+ });
+
it.skipIf(!POSIX)("prefers the platform temp directory by default", () => {
expect(
ghidraSessionRoot({ base: posixBase("home", "operator", ".cache") }),