mirror of
https://github.com/penpot/penpot.git
synced 2026-10-29 14:00:37 +00:00
* 🔧 Fail CI when render-wasm JS glue exports invoke_*V Add check-no-invoke-v (path from _build_env) and run it in CI: WASM after a production frontend build so JS longjmp + SIMD ABI regressions are caught in the pipeline. * 🐛 Fail closed in render-wasm invoke_* glue check * 🔧 Check exporter wasm glue for any invoke_* wrapper --------- Co-authored-by: Elena Torro <elenatorro@gmail.com>
42 lines
1.1 KiB
Bash
Executable File
42 lines
1.1 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Usage: ./check-no-invoke-v [frontend|export] [glue-path]
|
|
#
|
|
# Fail if the Emscripten JS glue has any invoke_* wrapper. With Wasm EH and
|
|
# Wasm SjLj there should be none; invoke_*V (v128) throws a TypeError at the
|
|
# JS boundary.
|
|
set -euo pipefail
|
|
|
|
_SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)
|
|
TARGET=${1:-frontend}
|
|
# _build_env reads NODE_ENV without a default; keep set -u happy.
|
|
NODE_ENV=${NODE_ENV:-}
|
|
RENDER_TARGET=$TARGET
|
|
# shellcheck source=/dev/null
|
|
. "$_SCRIPT_DIR/_build_env" "$TARGET"
|
|
|
|
if [[ $# -ge 2 ]]; then
|
|
GLUE=$2
|
|
elif [[ "$TARGET" = "export" ]]; then
|
|
GLUE="$_SCRIPT_DIR/$EXPORT_DEST/$BUILD_NAME.js"
|
|
else
|
|
GLUE="$_SCRIPT_DIR/$FRONTEND_DEST/$BUILD_NAME.js"
|
|
fi
|
|
|
|
if [[ ! -f "$GLUE" ]]; then
|
|
echo "error: JS glue not found: $GLUE" >&2
|
|
echo "hint: run ./build $TARGET first" >&2
|
|
exit 1
|
|
fi
|
|
|
|
status=0
|
|
grep -qE 'invoke_[A-Za-z0-9]+' "$GLUE" || status=$?
|
|
|
|
if [[ $status -eq 0 ]]; then
|
|
echo "error: JS glue has invoke_* wrappers: $GLUE" >&2
|
|
grep -oE 'invoke_[A-Za-z0-9]+' "$GLUE" | sort -u >&2
|
|
exit 1
|
|
elif [[ $status -gt 1 ]]; then
|
|
echo "error: grep failed on $GLUE" >&2
|
|
exit "$status"
|
|
fi
|