diff --git a/src/domain/firmware/firmwareLiteralPools.test.ts b/src/domain/firmware/firmwareLiteralPools.test.ts index 02636743794..89ea6ae5f1c 100644 --- a/src/domain/firmware/firmwareLiteralPools.test.ts +++ b/src/domain/firmware/firmwareLiteralPools.test.ts @@ -960,18 +960,25 @@ describe("firmwareLiteralPools domain scanner", () => { expect(compactArrRes.value.intervals).toHaveLength(1); } - // 8. Reverse-declared 4,000-deep derivedFrom chain adding 1 distinct register per peripheral shares persistent links without O(N^2) heap copies and refuses promptly. + // 8. The reverse-declared chain shares inherited registers. It reaches the + // logical measurement ceiling before the budget for allocated tree nodes. const chainPeriphs = Array.from({ length: 4_000 }, (_, i) => { const derived = i < 3_999 ? ` derivedFrom="CH_${String(i + 1)}"` : ""; return `CH_${String(i)}0x${(0x5000_0000 + i * 0x1000).toString(16)}32R_${String(i)}0x${(i * 4).toString(16)}`; }).join(""); - const chainStart = performance.now(); const chainRes = parseSvdPeripheralSpans( `${chainPeriphs}`, 200_000, ); - expect(chainRes.ok).toBe(false); - expect(performance.now() - chainStart).toBeLessThan(1000); + if (chainRes.ok) throw new Error("expected the SVD measurement limit"); + // The first 1,414 layouts account for 1,000,405 logical frames. + const { detail, ...failure } = chainRes.error.failure; + expect(failure).toEqual({ + kind: "limit", + format: "cmsis-svd", + limit: { name: "max_svd_xml_nodes", maximum: 200_000 }, + }); + expect(detail).toMatch(/\b1000405\b/u); // 9. 12,000-peripheral derivedFrom chain repeatedly overriding the same register "R" replaces shadowed nodes in O(log K) and completes in linearithmic time. const overrideChainPeriphs = Array.from({ length: 12_000 }, (_, i) => {