The canvas (wxUniversal) mode is gone (wxwidgets submodule); remove every piece of side-by-side plumbing so there is exactly one build and one test flow: - scripts/build-wxuniversal-wasm.sh -> scripts/build-wx-wasm.sh; no --dom/--enable-universal; builds into build-wasm/wxwidgets - build-wasm-test.sh: no DOM_BUILD / apps-dom rsync mirror / PORT=dom; apps build straight into tests/apps (Makefile.wasm PORT conditionals collapsed; wx.js + wx-dom.js always pre-js) - docker/build.sh, build-kicad-target.sh, env.sh: WX_PORT / -dom / -universal suffixes removed; kicad builds to kicad-<app>, outputs to output/; wx.js/wx-dom.js copied from the real source path (/workspace/wxwidgets/build/wasm — the old build-wasm path never existed and silently failed) - setup-kicad-wasm.sh: single target dir; the perl wx-dom.js injection is gone — the 7 checked-in kicad pages now reference wx-dom.js directly - playwright configs serve apps/; fixtures drop the test-results/dom and logs/wxwidgets/dom namespacing; boot.spec asserts wxDomPort unconditionally; pcbnew.spec uses one reference image; appearance.spec assertions unconditional - compare/update-baseline-screenshots.sh: --port removed - tests/gal-regression/wasm/Makefile: links build-wasm/wxwidgets and carries wx-dom.js as a second pre-js — the gal-webgl suite (30 specs) now actually builds and runs here (it needed host-side boost+glm via scripts/deps; the bundle had been missing, timing the whole spec out) - tests: clickCanvas() dispatches via page.mouse (DOM widgets legitimately cover the canvas; locator actionability refused the click); the comprehensive spec drives wxChoice through its native <select> (browser-owned popup cannot be coordinate-clicked) - docs: README/CLAUDE.md/build.md script names and dirs; features/wx-dom-port README reframed (DOM is THE port), visual-notes bugs 26-28; FindwxWidgets.cmake config label drops 'wasmuniv' - wxwidgets submodule -> 9dbacc9448 (DOM-only port, fork diff shrunk) Gate: full wx e2e suite 292 passed / 1 skipped / 0 failed — first run ever with the gal-webgl specs green (28 scenarios + load + sequential). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
117 lines
4.5 KiB
Shell
Executable file
117 lines
4.5 KiB
Shell
Executable file
#!/bin/bash
|
|
# Copies KiCad WASM build output to test directory
|
|
#
|
|
# Priority: Use local output/ directory (populated by docker/build.sh)
|
|
# Fallback: Copy from Docker volume directly
|
|
#
|
|
# Copies whichever apps are present (pcbnew, eeschema, calculator).
|
|
|
|
set -e
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
|
PROJECT_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
|
|
|
|
KICAD_TEST="$PROJECT_ROOT/tests/apps/kicad"
|
|
OUTPUT_DIR="$PROJECT_ROOT/output"
|
|
|
|
mkdir -p "$KICAD_TEST"
|
|
|
|
# Smart copy: skip when the destination already exists and is byte-identical to
|
|
# the source (cmp -s is portable across macOS/Linux). Makes this a real sync —
|
|
# re-running does not rewrite unchanged multi-hundred-MB .wasm files.
|
|
smart_cp() {
|
|
local src="$1" destdir="$2"
|
|
[ -f "$src" ] || return 0
|
|
local dst="$destdir/$(basename "$src")"
|
|
if [ -f "$dst" ] && cmp -s "$src" "$dst"; then
|
|
echo " = $(basename "$src") (up-to-date)"
|
|
return 0
|
|
fi
|
|
cp "$src" "$dst"
|
|
echo " + $(basename "$src")"
|
|
}
|
|
|
|
# Map an app name to its inner CMake build subdirectory. Most apps share their
|
|
# subdir name with the app name; pcb_calculator emits OUTPUT_NAME=calculator
|
|
# but lives under the pcb_calculator/ subtree of the build dir, and pl_editor's
|
|
# source lives under pagelayout_editor/.
|
|
kicad_subdir_for() {
|
|
case "$1" in
|
|
calculator) echo "pcb_calculator" ;;
|
|
pl_editor) echo "pagelayout_editor" ;;
|
|
symbol_editor) echo "eeschema" ;;
|
|
*) echo "$1" ;;
|
|
esac
|
|
}
|
|
|
|
# Copy one app's artifacts (js, wasm, optional debug/map/worker). Returns 0
|
|
# if the app was present, 1 if neither output/ nor the docker volume has it.
|
|
copy_app() {
|
|
local app="$1"
|
|
local subdir
|
|
subdir=$(kicad_subdir_for "$app")
|
|
|
|
if [ -f "$OUTPUT_DIR/${app}.js" ] && [ -f "$OUTPUT_DIR/${app}.wasm" ]; then
|
|
echo "Syncing ${app} WASM files from output directory..."
|
|
smart_cp "$OUTPUT_DIR/${app}.js" "$KICAD_TEST"
|
|
smart_cp "$OUTPUT_DIR/${app}.wasm" "$KICAD_TEST"
|
|
smart_cp "$OUTPUT_DIR/${app}.wasm.map" "$KICAD_TEST"
|
|
smart_cp "$OUTPUT_DIR/${app}.worker.js" "$KICAD_TEST"
|
|
smart_cp "$OUTPUT_DIR/images.tar.gz" "$KICAD_TEST"
|
|
return 0
|
|
fi
|
|
|
|
echo "Output ${app} not found locally, trying Docker volume..."
|
|
if docker compose -f "$PROJECT_ROOT/docker/docker-compose.yml" cp \
|
|
kicad-wasm-builder:/workspace/build-wasm/kicad-${app}/${subdir}/${app}.js "$KICAD_TEST/" 2>/dev/null \
|
|
&& docker compose -f "$PROJECT_ROOT/docker/docker-compose.yml" cp \
|
|
kicad-wasm-builder:/workspace/build-wasm/kicad-${app}/${subdir}/${app}.wasm "$KICAD_TEST/" 2>/dev/null; then
|
|
docker compose -f "$PROJECT_ROOT/docker/docker-compose.yml" cp \
|
|
kicad-wasm-builder:/workspace/build-wasm/kicad-${app}/${subdir}/${app}.wasm.map "$KICAD_TEST/" 2>/dev/null || true
|
|
docker compose -f "$PROJECT_ROOT/docker/docker-compose.yml" cp \
|
|
kicad-wasm-builder:/workspace/build-wasm/kicad-${app}/${subdir}/${app}.worker.js "$KICAD_TEST/" 2>/dev/null || true
|
|
docker compose -f "$PROJECT_ROOT/docker/docker-compose.yml" cp \
|
|
kicad-wasm-builder:/workspace/build-wasm/kicad-${app}/resources/images.tar.gz "$KICAD_TEST/" 2>/dev/null || true
|
|
return 0
|
|
fi
|
|
|
|
echo " (no ${app} artifacts found — skipping)"
|
|
return 1
|
|
}
|
|
|
|
found_any=0
|
|
copy_app pcbnew && found_any=1
|
|
copy_app eeschema && found_any=1
|
|
copy_app calculator && found_any=1
|
|
copy_app pl_editor && found_any=1
|
|
copy_app symbol_editor && found_any=1
|
|
copy_app gerbview && found_any=1
|
|
|
|
if [ "$found_any" -eq 0 ]; then
|
|
echo "Error: no pcbnew/eeschema/calculator/pl_editor/symbol_editor/gerbview artifacts found in output/ or docker volume" >&2
|
|
exit 1
|
|
fi
|
|
|
|
# wxWidgets WASM JavaScript glue code (defines JS functions called from WASM)
|
|
echo "Syncing wxWidgets WASM glue code..."
|
|
if [ -f "$OUTPUT_DIR/wx.js" ]; then
|
|
smart_cp "$OUTPUT_DIR/wx.js" "$KICAD_TEST"
|
|
else
|
|
if docker compose -f "$PROJECT_ROOT/docker/docker-compose.yml" cp \
|
|
kicad-wasm-builder:/workspace/wxwidgets/build/wasm/wx.js "$KICAD_TEST/" 2>/dev/null; then
|
|
:
|
|
else
|
|
smart_cp "$PROJECT_ROOT/wxwidgets/build/wasm/wx.js" "$KICAD_TEST"
|
|
fi
|
|
fi
|
|
|
|
# The control-layer shim loads after wx.js (the checked-in kicad pages
|
|
# reference both via <script> tags).
|
|
if [ -f "$OUTPUT_DIR/wx-dom.js" ]; then
|
|
smart_cp "$OUTPUT_DIR/wx-dom.js" "$KICAD_TEST"
|
|
else
|
|
smart_cp "$PROJECT_ROOT/wxwidgets/build/wasm/wx-dom.js" "$KICAD_TEST"
|
|
fi
|
|
|
|
echo "KiCad WASM files synced to $KICAD_TEST"
|
|
ls -lh "$KICAD_TEST"
|