fix(ci): align FAT fixtures and consolidate duplicated workflow helpers

Declare the synthetic 4 KiB Mach-O slice alignment accurately while preserving the IDA thinning scenario. Share web cleanup aggregation and process-trace fixture facts instead of duplicating them across consumers and tests; keep the 3% duplication threshold unchanged.

Validation: npm run check:ci, test discovery, and 42 focused IDA, process-trace, web workflow and cleanup boundary tests. Duplication falls from 3.01% to 2.99%.
This commit is contained in:
morluto
2026-10-13 16:16:31 +08:00
parent 67c7a24e60
commit a0317cf732
7 changed files with 87 additions and 158 deletions
+9 -3
View File
@@ -40,6 +40,7 @@ interface Layout {
readonly cpu: number;
readonly offset: number;
readonly size: number;
readonly alignmentExponent?: number;
}
/**
@@ -57,12 +58,12 @@ const largeUniversalTarget = async (
const bytes = Buffer.alloc(total);
bytes.writeUInt32BE(0xcafebabe, 0);
bytes.writeUInt32BE(layout.length, 4);
layout.forEach(({ cpu, offset, size }, index) => {
layout.forEach(({ cpu, offset, size, alignmentExponent = 14 }, index) => {
const entry = 8 + index * 20;
bytes.writeUInt32BE(cpu, entry);
bytes.writeUInt32BE(offset, entry + 8);
bytes.writeUInt32BE(size, entry + 12);
bytes.writeUInt32BE(14, entry + 16);
bytes.writeUInt32BE(alignmentExponent, entry + 16);
bytes.fill(0x11 * (index + 1), offset, offset + size);
thinMach(0xfeedfacf, cpu).copy(bytes, offset);
});
@@ -122,7 +123,12 @@ describe("IDA workspace input thinning", () => {
async () => {
const { bytes, target } = await largeUniversalTarget(
[
{ cpu: 0x01000007, offset: 4096, size: 8480 },
{
cpu: 0x01000007,
offset: 4096,
size: 8480,
alignmentExponent: 12,
},
{ cpu: 0x0100000c, offset: 16384, size: 33464 },
{ cpu: 0x00000007, offset: 65536, size: 33464 },
],