pcbjam/tests/apps/standalone/jspi-coroutine/build.sh
Gergő Törcsvári db84293af1
tests: fix two-tab collab baseline race + build the jspi harnesses in CI
1) pcbnew/eeschema two-tab 'a local move propagates A->B' read the
   pre-move baseline AFTER kicadCollabTestMoveFirst. The move is queued
   through CallAfter + the apply coroutine, and the drain can land
   between two consecutive page.evaluate round-trips — when it does
   (~50% under CI load, reproduced locally with --repeat-each) orig
   captures the ALREADY-MOVED position and the not-toBe poll waits on
   itself. Wire tracing showed the bridge working: the moved delta
   emits, nothing reverts. Fix: baseline from kicadCollabSnapshot
   BEFORE the move. 12/12 green at --repeat-each=4 (was ~50% red).

2) jspi-firefox suites 404'd their harness modules: jspi-stack and
   jspi-coroutine build via ad-hoc build.sh (Phase 3 Makefile wiring
   TODO) which CI never ran. Wire both into build-wasm-test.sh (its
   hash is already in the testapps cache key), and add the _pt pthread
   variant that index.html?pt=1 loads but nothing built. jspi-firefox
   8/8 green locally.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PmR6goSk7JC17h7fkgGvHG
2026-08-14 21:46:24 +02:00

30 lines
1.1 KiB
Shell
Executable file

#!/bin/bash
# Ad-hoc build for the jspi-coroutine harness (Makefile.wasm wiring in Phase 3).
# Compiles the REAL kicad/thirdparty/libcontext (JSPI backend).
set -eo pipefail
cd "$(dirname "$0")"
ROOT="$(cd ../../../.. && pwd)"
EMXX="${EMXX:-$ROOT/tools/emsdk/upstream/emscripten/em++}"
LIBCTX="$ROOT/kicad/thirdparty/libcontext"
COMMON=(
-I"$LIBCTX"
-O1
-fwasm-exceptions -sSUPPORT_LONGJMP=wasm -sWASM_LEGACY_EXCEPTIONS=1
-sJSPI -sJSPI_EXPORTS=pcbjam_libctx_entry,main
-sMODULARIZE=1 -sEXPORT_ES6=1
-sALLOW_MEMORY_GROWTH=1
)
"$EMXX" coroutine_jspi_test.cpp "$LIBCTX/libcontext.cpp" "${COMMON[@]}" \
-sENVIRONMENT=node,web \
-o coroutine_jspi_test.mjs
# pthread variant (index.html?pt=1 / run_pt.mjs) — same battery with the
# pthread runtime linked, mirroring jspi-stack's *_pt build.
"$EMXX" coroutine_jspi_test.cpp "$LIBCTX/libcontext.cpp" "${COMMON[@]}" \
-pthread -sPTHREAD_POOL_SIZE=2 -sPTHREAD_POOL_SIZE_STRICT=0 \
-sENVIRONMENT=node,web,worker \
-o coroutine_jspi_test_pt.mjs
echo "built: coroutine_jspi_test.mjs + coroutine_jspi_test_pt.mjs"