aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorGravatar zinc <zinc@downsta.ir> 2026-10-14 19:49:46 +0330
committerGravatar zinc <zinc@downsta.ir> 2026-10-14 20:04:08 +0330
commit1a0af8a98894175d53928bd4e1e40c90fb773eea (patch)
tree1751258a413e41b38097fe7ba0e3d6831efe63c0 /tests
parenttodo: callee generation guard for direct o3 calls, region 474..692 and fib di... (diff)
jit_x64_test: link tests, src and examples into the scratch directory so embed and include programs compile; list the programs whose compile error is expected
Diffstat (limited to 'tests')
-rw-r--r--tests/drivers/jit_x64_test.sh6
1 files changed, 5 insertions, 1 deletions
diff --git a/tests/drivers/jit_x64_test.sh b/tests/drivers/jit_x64_test.sh
index 4038d21..ea6e11d 100644
--- a/tests/drivers/jit_x64_test.sh
+++ b/tests/drivers/jit_x64_test.sh
@@ -19,6 +19,10 @@ tmp=$(mktemp -d)
trap 'rm -rf "$tmp"' EXIT
# programs run in a scratch directory, so files they create (bareio writes `note`) stay out of the tree
mkdir "$tmp/cwd"
+# embed and include name paths from the root, so the scratch directory links to them
+for d in tests src examples; do ln -s "$root/$d" "$tmp/cwd/$d"; done
+# programs whose compile error is the point (tests/test.sh checks the message), or zc0 only
+expect_error=" decl_undefined manyerrors undefined_call zc0typed "
pass=0 fail=0 total=0
for f in tests/programs/*.zc examples/*.zc examples/learn/*.zc; do
[ -n "$filter" ] && [[ "$f" != *$filter* ]] && continue
@@ -26,7 +30,7 @@ for f in tests/programs/*.zc examples/*.zc examples/learn/*.zc; do
(cd "$tmp/cwd" && timeout "$limit" "$ref" < "$root/$f" > "$tmp/ref.out" 2> "$tmp/ref.err"); rr=$?
(cd "$tmp/cwd" && timeout "$limit" "$jit" < "$root/$f" > "$tmp/jit.out" 2> "$tmp/jit.err"); rj=$?
ce=
- grep -qE '^zc: [0-9]+ errors?$' "$tmp/ref.out" "$tmp/jit.out" "$tmp/ref.err" "$tmp/jit.err" && ce=" compile error"
+ grep -qE '^zc: [0-9]+ errors?$' "$tmp/ref.out" "$tmp/jit.out" "$tmp/ref.err" "$tmp/jit.err" && [[ "$expect_error" != *" $(basename "$f" .zc) "* ]] && ce=" compile error"
if [ -z "$ce" ] && [ "$rr" = "$rj" ] && cmp -s "$tmp/ref.out" "$tmp/jit.out"; then
pass=$((pass + 1))
else