test: prune redundant conformance checks and document test priorities

This commit is contained in:
morluto
2026-10-08 04:03:24 +08:00
parent f8a53a8c06
commit aafdf8a01b
8 changed files with 20 additions and 249 deletions
@@ -1,16 +0,0 @@
import { describe, expect, it } from "vitest";
import { sourceDigest } from "../../../scripts/lib/conformance-fixtures.mjs";
describe("source-built conformance fixtures", () => {
it("hashes source manifests independently of input ordering", () => {
const left = [
{ path: "b.c", content: "b" },
{ path: "a.c", content: "a" },
];
const right = [...left].reverse();
expect(sourceDigest(left)).toBe(sourceDigest(right));
expect(sourceDigest(left)).toMatch(/^[0-9a-f]{64}$/u);
});
});
@@ -1,37 +0,0 @@
import { execFile } from "node:child_process";
import { createHash } from "node:crypto";
import { readFile } from "node:fs/promises";
import { dirname, resolve } from "node:path";
import { promisify } from "node:util";
import { fileURLToPath } from "node:url";
import { describe, expect, it } from "vitest";
import { parseExecutableHeader } from "../../../../src/domain/binaryTarget.js";
const exec = promisify(execFile);
const root = resolve(dirname(fileURLToPath(import.meta.url)), "../../../..");
const generator = resolve(root, "scripts", "create-ghidra-windows-fixture.mjs");
const fixture = resolve(root, "build", "fixtures", "rea-ghidra-windows.exe");
const expectedSha256 =
"732ec6083ae3b63bcbda33f2d0fd7e1a6539babade07cbdae4fc20d3394faf49";
describe("controlled Windows Ghidra fixture", () => {
it("generates one deterministic native x86-64 PE application", async () => {
await exec(process.execPath, [generator]);
const bytes = await readFile(fixture);
expect(createHash("sha256").update(bytes).digest("hex")).toBe(
expectedSha256,
);
expect(parseExecutableHeader(bytes, "x64")).toMatchObject({
ok: true,
value: {
format: "pe",
architecture: "x86_64",
executableRole: "application",
managed: false,
},
});
});
});
@@ -1,37 +0,0 @@
import { rm, writeFile } from "node:fs/promises";
import { join } from "node:path";
import { afterEach, describe, expect, it } from "vitest";
import { createTestTempDirectory } from "../../../fixtures/temporaryDirectory.js";
import { buildManagedPeFixture } from "../../../../scripts/fixtures/managed/pe.mjs";
import { parseBinaryTarget } from "../../../../src/application/BinaryTargetResolver.js";
const workspaces: string[] = [];
afterEach(async () => {
await Promise.all(
workspaces.splice(0).map((path) => rm(path, { recursive: true })),
);
});
describe("managed conformance fixture", () => {
it("emits PE32+ headers when the COFF machine is x86-64", async () => {
const workspace = await createTestTempDirectory("rea-managed-fixture-");
workspaces.push(workspace);
const path = join(workspace, "fixture.exe");
await writeFile(path, buildManagedPeFixture({ machine: 0x8664 }));
const parsed = await parseBinaryTarget(path);
expect(parsed).toMatchObject({
ok: true,
value: {
format: "pe",
architecture: "x86_64",
managed: true,
},
});
});
});