Replace the legacy Emscripten JS-exceptions model with native wasm-EH (legacy encoding) across the whole build, keeping Asyncify coroutines working via a from-source Binaryen --hoist-cpp-catches pre-pass. Net result: native-EH is the only build mode, the 3D viewer is on by default, and pcbnew shrinks substantially. Highlights: - Binaryen submodule everywhere + --hoist-cpp-catches integration in apply-asyncify; post-link Asyncify covers every app wasm (not just standalone test wasm). - Build deps (incl. OpenCASCADE without OCC_CONVERT_SIGNALS) and all KiCad apps with -fwasm-exceptions; emscripten_sleep added to the post-link asyncify-imports. - libcontext fiber entry wired under native exceptions; while-loop main loop + currData shim injected into all wx apps. - Native-EH collab apply fixed: DEBUG-define the embind TU + match all out-of-CMake C++ TUs' ABI flags to the core, fixing the vtable-layout skew / mis-dispatch. - 3D viewer enabled by default (real raytracer linked, not the stub). - Retire the EH-spike scaffolding; flip the asyncify-races ablation pins to shim-redundancy pins (native-EH stays clean with the legacy shims ablated). - Fix the asyncify-races quiescence check to not require Asyncify.currData==0: under the native-EH per-frame-yield top loop the main stack is asyncify-suspended every frame, so currData legitimately churns (a freed-but-not-yet-nulled buffer, not a leak). Refresh the pcbnew toolbar screenshot baseline for the new kicad. - CI: drop the obsolete binaryen_version input/env (the build uses the binaryen submodule fork's wasm-opt, not a version download); key the wasm-output cache on the binaryen submodule SHA instead. Bumps the wxwidgets + binaryen submodules to their squashed feature commits. Validated green: all 7 apps native-EH (real 3D in pcbnew); KiCad e2e 63/63 Firefox + Chromium (3D viewer renders); wx 336; coroutine 34/34 both engines; asyncify 7/7 both engines. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
86 lines
2.6 KiB
TypeScript
86 lines
2.6 KiB
TypeScript
import { defineConfig, devices } from '@playwright/test';
|
|
import { execSync } from 'child_process';
|
|
import * as fs from 'fs';
|
|
import * as path from 'path';
|
|
|
|
// Runs the Asyncify race-condition red-green harness (tests/asyncify/) in both
|
|
// Firefox and system Chrome. Mirrors playwright-coroutine.config.ts (Chrome must
|
|
// be --headed on ARM Mac; Firefox headless OK).
|
|
|
|
const PORT_FILE = path.join(__dirname, '.test-port-asyncify');
|
|
|
|
function findFreePort(): number {
|
|
try {
|
|
const result = execSync(
|
|
'python3 -c "import socket; s=socket.socket(); s.bind((\'\',0)); print(s.getsockname()[1]); s.close()"',
|
|
{ encoding: 'utf-8' }
|
|
);
|
|
return parseInt(result.trim());
|
|
} catch {
|
|
return 9100 + Math.floor(Math.random() * 800);
|
|
}
|
|
}
|
|
|
|
// Same port-pinning scheme as playwright-kicad.config.ts: the main runner picks a
|
|
// fresh port and writes the file before workers spawn; workers always reuse it.
|
|
function resolvePort(): number {
|
|
const isMainRunner = process.argv.slice(2).includes('test');
|
|
if (!isMainRunner) {
|
|
try {
|
|
const existing = parseInt(fs.readFileSync(PORT_FILE, 'utf-8').trim(), 10);
|
|
if (existing > 0 && existing < 65536) return existing;
|
|
} catch { /* fall through */ }
|
|
}
|
|
const port = findFreePort();
|
|
fs.writeFileSync(PORT_FILE, port.toString());
|
|
return port;
|
|
}
|
|
|
|
const port = resolvePort();
|
|
|
|
export default defineConfig({
|
|
globalSetup: './global-setup.ts',
|
|
testDir: './asyncify',
|
|
testMatch: /asyncify-races.*\.spec\.ts$/,
|
|
fullyParallel: false, // one heavy WASM app at a time
|
|
forbidOnly: !!process.env.CI,
|
|
retries: 0,
|
|
workers: 1,
|
|
reporter: 'html',
|
|
timeout: 120000,
|
|
|
|
use: {
|
|
baseURL: `http://localhost:${port}`,
|
|
trace: 'retain-on-failure',
|
|
screenshot: 'only-on-failure',
|
|
},
|
|
|
|
projects: [
|
|
{
|
|
// Firefox: headless, reliable on ARM Mac.
|
|
name: 'firefox',
|
|
use: { ...devices['Desktop Firefox'], viewport: { width: 1280, height: 720 } },
|
|
},
|
|
{
|
|
// System Chrome (real V8) — run via: npm run test:asyncify:chrome (must be --headed).
|
|
name: 'chromium',
|
|
use: {
|
|
channel: 'chrome',
|
|
viewport: { width: 1280, height: 720 },
|
|
permissions: ['clipboard-read', 'clipboard-write'],
|
|
},
|
|
},
|
|
{
|
|
// WebKit (Safari's engine) — headless OK on macOS. Project policy: every spec must be
|
|
// green in all three engines (Firefox + Chrome + Safari). Run via npm run test:asyncify:safari.
|
|
name: 'webkit',
|
|
use: { ...devices['Desktop Safari'], viewport: { width: 1280, height: 720 } },
|
|
},
|
|
],
|
|
|
|
webServer: {
|
|
command: `npx serve apps -p ${port} -c ../serve.json`,
|
|
port: port,
|
|
reuseExistingServer: !process.env.CI,
|
|
},
|
|
});
|