Files
reverse-engineering-anything/tests/boundary/cli/nativeMachoObjectSegmentCli.test.ts
T
morluto 60149282fc test: strengthen integration oracles and verification (#8295)
* 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
2026-11-01 00:15:28 +08:00

59 lines
2.1 KiB
TypeScript

import { join } from "node:path";
import { writeFile } from "node:fs/promises";
import { describe, expect } from "vitest";
import { z } from "zod";
import { inspectMachoSchema } from "../../../src/domain/native/nativeInspection.js";
import { createTestTempDirectory } from "../../fixtures/temporaryDirectory.js";
import { cliTest } from "../../support/cli/cliFixture.js";
const evidenceSchema = z.object({ normalized_result: inspectMachoSchema });
describe.skipIf(process.platform !== "darwin")(
"native Mach-O CLI object segment",
() => {
cliTest(
"reports an object file's unnamed segment by its observed empty name",
async ({ cli, processes }) => {
const directory = await createTestTempDirectory("rea-object-segment-");
const source = join(directory, "qa.c");
const object = join(directory, "qa.o");
await writeFile(source, "int qa(void) { return 7; }\n");
const compiled = await processes.run(
"/usr/bin/xcrun",
["clang", "-c", source, "-o", object],
{ timeoutMs: 30_000 },
);
expect(compiled.exitCode, compiled.stderr).toBe(0);
const result = await cli.run({
arguments: ["inspect-macho", object, "--json"],
environment: { REA_LOG_LEVEL: "silent" },
});
expect(result.exitCode, result.stdout + result.stderr).toBe(0);
const inspected = evidenceSchema.parse(result.json).normalized_result;
const segment = inspected.load_commands.items.find(
({ kind }) => kind === "LC_SEGMENT_64" || kind === "LC_SEGMENT",
);
expect(segment?.fields["segname #1"]).toBe("");
expect(inspected.segments).toMatchObject({
items: [
{
name: "",
sections: {
items: expect.arrayContaining([
expect.objectContaining({
segment: "__TEXT",
name: "__text",
}),
]),
},
},
],
exhaustive: true,
});
},
);
},
);