test(firmware): share absent SVD fixture inputs (#16446)

This commit is contained in:
Vincent Koc authored and GitHub committed 2026-12-03 19:24:25 +00:00
1 parent 8fc70aeba0
commit aa62b054c9
1 file changed
+25 -57
+25 -57
View File
@@ -9,6 +9,12 @@ import {
} from "./firmwareVectorTable.js";
import { parseFirmwareVectorTable } from "./firmwareVectorTableParser.js";
const noSvdInput = () => ({
svdSupplied: false,
svdMap: new Map(),
svdSkipped: [],
});
const SAMPLE_SVD = `<?xml version="1.0" encoding="utf-8"?>
<device>
<name>STM32F405</name>
@@ -147,9 +153,7 @@ describe("parseFirmwareVectorTable ARM M-profile", () => {
vectorTableOffset: 0,
maxEntries: 16,
tableBytes: buf,
svdSupplied: false,
svdMap: new Map(),
svdSkipped: [],
...noSvdInput(),
});
expect(parsed.ok).toBe(true);
if (!parsed.ok) return;
@@ -191,9 +195,7 @@ describe("parseFirmwareVectorTable ARM M-profile", () => {
vectorTableOffset: 0x20,
maxEntries: 8,
tableBytes: buf.subarray(0x20),
svdSupplied: false,
svdMap: new Map(),
svdSkipped: [],
...noSvdInput(),
});
expect(parsed.ok).toBe(true);
if (!parsed.ok) return;
@@ -303,9 +305,7 @@ describe("parseFirmwareVectorTable RISC-V mtvec", () => {
vectorTableOffset: 0,
maxEntries: 20,
tableBytes: buf,
svdSupplied: false,
svdMap: new Map(),
svdSkipped: [],
...noSvdInput(),
});
expect(parsed.ok).toBe(true);
if (!parsed.ok) return;
@@ -360,9 +360,7 @@ describe("parseFirmwareVectorTable RISC-V mtvec", () => {
vectorTableOffset: 0,
maxEntries: 8,
tableBytes: fitsBuf,
svdSupplied: false,
svdMap: new Map(),
svdSkipped: [],
...noSvdInput(),
});
expect(fits.ok).toBe(true);
if (!fits.ok) return;
@@ -390,9 +388,7 @@ describe("parseFirmwareVectorTable RISC-V mtvec", () => {
vectorTableOffset: 0,
maxEntries: 8,
tableBytes: wrapsBuf,
svdSupplied: false,
svdMap: new Map(),
svdSkipped: [],
...noSvdInput(),
});
expect(wraps.ok).toBe(true);
if (!wraps.ok) return;
@@ -543,9 +539,7 @@ describe("vector table size and SVD duplicate rules", () => {
vectorTableOffset: 0,
maxEntries: 1,
tableBytes: jal,
svdSupplied: false,
svdMap: new Map(),
svdSkipped: [],
...noSvdInput(),
} as const;
const riscv = parseFirmwareVectorTable({
...options,
@@ -571,9 +565,7 @@ describe("vector table size and SVD duplicate rules", () => {
vectorTableOffset: 4,
maxEntries: 1,
tableBytes: pair.subarray(4, 12),
svdSupplied: false,
svdMap: new Map(),
svdSkipped: [],
...noSvdInput(),
});
expect(parsed.ok).toBe(true);
if (!parsed.ok) return;
@@ -616,9 +608,7 @@ describe("stored vector-table slot counts", () => {
vectorTableOffset: 0,
maxEntries: 64,
tableBytes,
svdSupplied: false,
svdMap: new Map(),
svdSkipped: [],
...noSvdInput(),
});
if (!parsed.ok) throw new Error(parsed.error.message);
return parsed.value;
@@ -687,9 +677,7 @@ describe("parseFirmwareVectorTable ARM A/R, AVR, and M68000", () => {
vectorTableOffset: 0,
maxEntries: 16,
tableBytes: buf,
svdSupplied: false,
svdMap: new Map(),
svdSkipped: [],
...noSvdInput(),
});
expect(parsed.ok).toBe(true);
@@ -822,9 +810,7 @@ describe("parseFirmwareVectorTable ARM A/R, AVR, and M68000", () => {
vectorTableOffset: 0,
maxEntries: 68,
tableBytes: buf,
svdSupplied: false,
svdMap: new Map(),
svdSkipped: [],
...noSvdInput(),
});
expect(parsed.ok).toBe(true);
@@ -979,9 +965,7 @@ describe("parseFirmwareVectorTable ARM A/R, AVR, and M68000", () => {
vectorTableOffset: 0,
maxEntries: 3,
tableBytes: avrMixed,
svdSupplied: false,
svdMap: new Map(),
svdSkipped: [],
...noSvdInput(),
});
expect(avrMixedRes.ok).toBe(true);
if (avrMixedRes.ok) {
@@ -1004,9 +988,7 @@ describe("parseFirmwareVectorTable ARM A/R, AVR, and M68000", () => {
vectorTableOffset: 0,
maxEntries: 4,
tableBytes: avrAmb,
svdSupplied: false,
svdMap: new Map(),
svdSkipped: [],
...noSvdInput(),
});
expect(ambRes.ok).toBe(true);
if (ambRes.ok) {
@@ -1023,9 +1005,7 @@ describe("parseFirmwareVectorTable ARM A/R, AVR, and M68000", () => {
avrSlotBytes: 2,
maxEntries: 4,
tableBytes: avrAmb,
svdSupplied: false,
svdMap: new Map(),
svdSkipped: [],
...noSvdInput(),
});
expect(explicit2.ok && explicit2.value.avr_slot_bytes).toBe(2);
if (explicit2.ok) expect(explicit2.value.avr_slots).toHaveLength(4);
@@ -1044,9 +1024,7 @@ describe("parseFirmwareVectorTable ARM A/R, AVR, and M68000", () => {
vectorTableOffset: 0,
maxEntries: 8,
tableBytes: armZero,
svdSupplied: false,
svdMap: new Map(),
svdSkipped: [],
...noSvdInput(),
});
expect(armZeroRes.ok).toBe(true);
if (armZeroRes.ok) {
@@ -1068,9 +1046,7 @@ describe("parseFirmwareVectorTable ARM A/R, AVR, and M68000", () => {
vectorTableOffset: 0,
maxEntries: 8,
tableBytes: armOddMov,
svdSupplied: false,
svdMap: new Map(),
svdSkipped: [],
...noSvdInput(),
});
expect(armOddRes.ok).toBe(true);
if (armOddRes.ok) {
@@ -1102,9 +1078,7 @@ describe("parseFirmwareVectorTable ARM A/R, AVR, and M68000", () => {
vectorTableOffset: 0,
maxEntries: 1,
tableBytes: avrLookahead,
svdSupplied: false,
svdMap: new Map(),
svdSkipped: [],
...noSvdInput(),
});
expect(avrLookaheadRes.ok).toBe(true);
if (avrLookaheadRes.ok) {
@@ -1135,9 +1109,7 @@ describe("parseFirmwareVectorTable ARM A/R, AVR, and M68000", () => {
vectorTableOffset: 0,
maxEntries: 16,
tableBytes: avrTruncatedJmp,
svdSupplied: false,
svdMap: new Map(),
svdSkipped: [],
...noSvdInput(),
});
expect(truncJmpRes.ok).toBe(true);
if (truncJmpRes.ok) {
@@ -1172,9 +1144,7 @@ describe("parseFirmwareVectorTable ARM A/R, AVR, and M68000", () => {
vectorTableOffset: 0,
maxEntries: 8,
tableBytes: armUnalignedLdr,
svdSupplied: false,
svdMap: new Map(),
svdSkipped: [],
...noSvdInput(),
});
expect(unalignedLdrRes.ok).toBe(true);
if (unalignedLdrRes.ok) {
@@ -1204,9 +1174,7 @@ describe("parseFirmwareVectorTable ARM A/R, AVR, and M68000", () => {
vectorTableOffset: 0,
maxEntries: 1,
tableBytes: armPartial36,
svdSupplied: false,
svdMap: new Map(),
svdSkipped: [],
...noSvdInput(),
});
expect(armPartial36Res.ok).toBe(true);
if (armPartial36Res.ok) {