feat(wasm): kicad_editor — merge the pcbnew+eeschema kifaces into ONE bundle (Part 2)
All four editors (PCB / Footprint / Schematic / Symbol) are now runtime --frame
choices of a single kicad_editor.wasm (178 MB at -O1 vs 147+82 separate; shared
wx/common/boost linked once). One editor per page load, as before; frames pcb /
fpedit / sch / symedit.
- wasm/editor/: the merged executable target (single_top + both kiface library sets,
whole-archive pcbcommon) + the safety-net focus-walk Kiface() dispatch TU. Gated by
KICAD_WASM_MERGED_EDITOR (kicad submodule bump carries the fork side: per-engine
Kiface/getter binding + ODR renames + dual-kiface launcher).
- wasm/bindings/: per-editor collab entries renamed pcbCollab*/schCollab* (JS names
unchanged); duplicate kicadOpenFile/kicadCollabOnSave + shared-name registrations
guarded behind KICAD_MERGED_EMBIND; new kicad_editor_embind.cpp registers each
shared JS name once, dispatching on the live frame.
- Build: kicad_editor app (build wrapper, target case arms, 3-object embind compile
with the ABI-critical flags, STUB_APP=pcbnew); docker/build.sh "all" =
kicad_editor calculator pl_editor gerbview (pcbnew/eeschema stay as explicit debug
apps); scripts/kicad/audit-merged-symbols.sh = repeatable ODR-collision audit (run
on kicad bumps).
- Frontend: Bundle type (bundle ≠ tool); TOOL_BUNDLE maps all four editors to
kicad_editor; explicit --frame tokens for pcbnew (pcb) and eeschema (sch); publish
list = the 4 real bundles.
- Tests/CI: five harnesses load kicad_editor.js with explicit frame tokens;
PCBNEW_FAMILY_SPECS renamed BIG_MODULE_SPECS + the 8 eeschema-family specs (they
now boot the merged module — SpiderMonkey x86 CI OOM routing); frame-runtime spec
covers all four frames from the one bundle.
Validated so far: frame-runtime 4/4 (each frame boots with the right title, no
aborts, no duplicate embind registration); 24-spec merged-module regression green;
3D raytracer renders. Known pre-existing failure: 3d-viewer title-bar drag deadlock,
fixed on main by 7630c7e (2N+8 pthread pre-warm) — picked up by the follow-up rebase.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
parent
c6716e6b60
commit
bbeef6d20e
23 changed files with 691 additions and 149 deletions
|
|
@ -3,34 +3,47 @@ import { test, expect } from '@playwright/test';
|
|||
/**
|
||||
* Editor-unification runtime-frame validation.
|
||||
*
|
||||
* After unification the library editors are no longer separate .wasm bundles:
|
||||
* - the Symbol Editor is the eeschema bundle booted with --frame=symedit
|
||||
* - the Footprint Editor is the pcbnew bundle booted with --frame=fpedit
|
||||
* The frame token is threaded through Module.arguments and parsed in
|
||||
* kicad/common/single_top.cpp (mirroring kicad/kicad.cpp's --frame parser).
|
||||
* Since Part 2 ALL FOUR editors are served by the ONE merged kicad_editor bundle
|
||||
* (pcbnew + eeschema kifaces statically linked): each harness loads kicad_editor.js
|
||||
* with its frame token in Module.arguments —
|
||||
* - PCB Editor --frame=pcb (also the bundle's build-time default)
|
||||
* - Footprint Editor --frame=fpedit
|
||||
* - Schematic Editor --frame=sch
|
||||
* - Symbol Editor --frame=symedit
|
||||
* parsed in kicad/common/single_top.cpp (mirroring kicad/kicad.cpp's --frame parser).
|
||||
*
|
||||
* This asserts the decisive fact the launch-smoke specs don't: that the shared
|
||||
* bundle actually opens the LIBRARY editor frame, not its parent editor. The
|
||||
* window title is the discriminator — the parent bundle's default frame would
|
||||
* title itself "Schematic Editor" / "PCB Editor".
|
||||
* This asserts the decisive fact the launch-smoke specs don't: that the merged
|
||||
* bundle actually opens the REQUESTED frame. The window title is the discriminator —
|
||||
* a dropped/ignored token would land on the build default ("PCB Editor") or a
|
||||
* sibling editor's title.
|
||||
*/
|
||||
|
||||
interface FrameCase {
|
||||
harness: string;
|
||||
/** title the library-editor frame settles on */
|
||||
/** title the requested editor frame settles on */
|
||||
titleRe: RegExp;
|
||||
/** the parent editor's title — must NOT appear (would mean --frame was ignored) */
|
||||
parentRe: RegExp;
|
||||
/** any OTHER editor's title — must NOT appear (would mean --frame went wrong) */
|
||||
wrongRe: RegExp;
|
||||
}
|
||||
|
||||
const CASES: FrameCase[] = [
|
||||
{ harness: 'symbol_editor.html', titleRe: /Symbol Editor/i, parentRe: /Schematic Editor/i },
|
||||
{ harness: 'footprint_editor.html', titleRe: /Footprint Editor/i, parentRe: /PCB Editor/i },
|
||||
{ harness: 'pcbnew.html',
|
||||
titleRe: /PCB Editor/i,
|
||||
wrongRe: /Schematic Editor|Symbol Editor|Footprint Editor/i },
|
||||
{ harness: 'footprint_editor.html',
|
||||
titleRe: /Footprint Editor/i,
|
||||
wrongRe: /PCB Editor|Schematic Editor|Symbol Editor/i },
|
||||
{ harness: 'eeschema.html',
|
||||
titleRe: /Schematic Editor/i,
|
||||
wrongRe: /PCB Editor|Footprint Editor|Symbol Editor/i },
|
||||
{ harness: 'symbol_editor.html',
|
||||
titleRe: /Symbol Editor/i,
|
||||
wrongRe: /PCB Editor|Schematic Editor|Footprint Editor/i },
|
||||
];
|
||||
|
||||
test.describe('editor-unification runtime frame (--frame)', () => {
|
||||
for (const tc of CASES) {
|
||||
test(`${tc.harness} opens the library editor frame from its parent bundle`, async ({ page }) => {
|
||||
test(`${tc.harness} opens its editor frame from the merged bundle`, async ({ page }) => {
|
||||
const consoleLines: string[] = [];
|
||||
page.on('console', (m) => consoleLines.push(m.text()));
|
||||
page.on('pageerror', (e) => consoleLines.push(`pageerror: ${e.message}`));
|
||||
|
|
@ -43,7 +56,7 @@ test.describe('editor-unification runtime frame (--frame)', () => {
|
|||
// The frame sets the document title once it is up; poll until it settles.
|
||||
await expect
|
||||
.poll(() => page.title(), {
|
||||
message: `${tc.harness}: never reached the expected library-editor title`,
|
||||
message: `${tc.harness}: never reached the expected editor title`,
|
||||
timeout: 120000,
|
||||
intervals: [1000],
|
||||
})
|
||||
|
|
@ -53,13 +66,14 @@ test.describe('editor-unification runtime frame (--frame)', () => {
|
|||
// eslint-disable-next-line no-console
|
||||
console.log(`[frame-runtime] ${tc.harness} -> title=${JSON.stringify(title)}`);
|
||||
|
||||
// The runtime --frame flag actually switched frames: the parent editor's
|
||||
// title must not be what we ended up on.
|
||||
expect(title, `${tc.harness}: opened the library editor, not its parent`).not.toMatch(tc.parentRe);
|
||||
// The runtime --frame flag actually selected the right frame: no sibling
|
||||
// editor's title.
|
||||
expect(title, `${tc.harness}: opened the requested editor, not a sibling`).not.toMatch(tc.wrongRe);
|
||||
|
||||
// No WASM abort during load.
|
||||
const aborted = consoleLines.some((l) => /Aborted\(/.test(l));
|
||||
expect(aborted, 'no WASM abort during load').toBe(false);
|
||||
// No WASM abort during load — and no duplicate embind registration (the
|
||||
// merged dispatcher must register each shared JS name exactly once).
|
||||
const aborted = consoleLines.some((l) => /Aborted\(|Cannot register public name/.test(l));
|
||||
expect(aborted, 'no WASM abort / duplicate embind registration during load').toBe(false);
|
||||
|
||||
await page.screenshot({ path: `test-results/frame-runtime-${tc.harness}.png`, scale: 'device' });
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue