-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun.sh
More file actions
executable file
·26 lines (21 loc) · 1.07 KB
/
Copy pathrun.sh
File metadata and controls
executable file
·26 lines (21 loc) · 1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/usr/bin/env bash
# SPDX-License-Identifier: PMPL-1.0-or-later
# INT-01 / #178 — compile the two cross-module fixtures and prove they
# link + execute across the wasm boundary. Reproducible acceptance run.
#
# ./run.sh # uses `deno` on PATH (or $AFFINESCRIPT_DENO)
# Exit 0 = substrate proven; non-zero = regression.
set -euo pipefail
here="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
root="$(cd "$here/../../.." && pwd)"
bin="$root/_build/default/bin/main.exe"
fix="$root/test/e2e/fixtures"
deno="${AFFINESCRIPT_DENO:-deno}"
export AFFINESCRIPT_STDLIB="$root/stdlib"
tmp="$(mktemp -d)"
trap 'rm -rf "$tmp"' EXIT
[ -x "$bin" ] || { echo "build the compiler first: dune build bin/main.exe" >&2; exit 9; }
command -v "$deno" >/dev/null 2>&1 || { echo "deno not found (set \$AFFINESCRIPT_DENO)" >&2; exit 9; }
( cd "$fix" && "$bin" compile CrossCallee.affine -o "$tmp/callee.wasm" >/dev/null )
( cd "$fix" && "$bin" compile cross_caller_ok.affine -o "$tmp/caller.wasm" >/dev/null )
"$deno" run --allow-read="$tmp" "$here/link.mjs" "$tmp/callee.wasm" "$tmp/caller.wasm"