-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun_codegen_wasm_tests.sh
More file actions
executable file
·35 lines (28 loc) · 886 Bytes
/
run_codegen_wasm_tests.sh
File metadata and controls
executable file
·35 lines (28 loc) · 886 Bytes
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
27
28
29
30
31
32
33
34
35
#!/usr/bin/env bash
set -euo pipefail
ROOT_DIR="$(cd "$(dirname "$0")/.." && pwd)"
TEST_DIR="$ROOT_DIR/tests/codegen"
if [ -x "$ROOT_DIR/_build/default/bin/main.exe" ]; then
COMPILER="$ROOT_DIR/_build/default/bin/main.exe"
COMPILE_CMD=("$COMPILER" compile)
elif command -v affinescript >/dev/null 2>&1; then
COMPILER="affinescript"
COMPILE_CMD=("$COMPILER" compile)
else
COMPILER="dune exec affinescript --"
COMPILE_CMD=(dune exec affinescript -- compile)
fi
echo "Using compiler: $COMPILER"
for src in "$TEST_DIR"/*.affine; do
base="${src%.affine}"
wasm="$base.wasm"
echo "Compiling $(basename "$src") -> $(basename "$wasm")"
"${COMPILE_CMD[@]}" "$src" -o "$wasm"
done
echo ""
echo "Running JS harnesses"
for js in "$TEST_DIR"/*.mjs; do
echo "node $(basename "$js")"
(cd "$ROOT_DIR" && node "${js#$ROOT_DIR/}")
done
echo "All codegen WASM tests passed."