Files
breeze/tests/web_bridge_wasm_test.sh
T
waozi 458f4fb5eb Run the test harnesses on the Ziran 0.6 toolchain
Point every harness's default toolchain at build/packages/ziran/build,
drop the removed `zi2zx bundle` form, link the generated C each harness
actually gets (whole generated folders where the test has no stubs, and
Kryon's package-prefixed frame pacing module), and stop listing the
header-only type module in the modal rules test. Twenty-two more test
targets pass from a clean export; plans/2026-11-17-test-harnesses.md
lists the 54 that still fail and why.
2026-11-17 03:12:21 -03:00

26 lines
1.2 KiB
Bash

#!/bin/sh
set -eu
root=$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd)
bin=${1:-"$root/build/packages/ziran/build/bin"}
emcc=${2:-"$HOME/emsdk/upstream/emscripten/emcc"}
work=$(mktemp -d "$root/build/web-bridge-wasm.XXXXXX")
trap 'rm -rf "$work"' EXIT HUP INT TERM
"$bin/zi2c" --no-main --define PLATFORM_WEB --root "$root" \
--module-path "$root/src" --module-path "$root/build/packages/ziran/std" \
-o "$work/c" "$root/tests/web_storage_bridge_link.zi" \
"$root/src/app/host_services.zi" "$root/src/platform/web_bridge.zi"
cat > "$work/fixture.js" <<'JS'
Module.__inbeFlushStorageSync = () => new Promise(resolve => {
setTimeout(() => resolve(true), 2);
});
JS
find "$work/c" -type f -name '*.c' -exec \
"$emcc" -O1 -I"$root/build/packages/ziran/include" -I"$work/c" \
-I"$work/c/src/app" -I"$work/c/src/platform" -I"$work/c/tests" \
--js-library "$root/src/web_host.js" --pre-js "$work/fixture.js" \
-sASYNCIFY -sEXIT_RUNTIME=1 -sENVIRONMENT=node -sWASM_ASYNC_COMPILATION=0 \
-o "$work/test.js" {} +
env -u DISPLAY -u WAYLAND_DISPLAY -u XAUTHORITY -u GDK_DISPLAY \
"${JS_RUNTIME:-node}" "$work/test.js"
echo "Inbe Ziran browser storage WebAssembly test passed"