aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorGravatar zinc <zinc@downsta.ir> 2026-10-14 10:36:08 +0000
committerGravatar zinc <zinc@downsta.ir> 2026-10-14 10:36:08 +0000
commit6762e78ceb59ac65d30073aef49a7f3ad2ad98d1 (patch)
treea0b81e86507a017500f2029b5a20d9c72f8b329b /tests
parentMerge the x86-64 jit, phase 1; todo: tick it, add phase 2 (diff)
jit_x64_test: run programs in a scratch directory so bareio's note stays out of the tree
Diffstat (limited to 'tests')
-rw-r--r--tests/drivers/jit_x64_test.sh10
1 files changed, 6 insertions, 4 deletions
diff --git a/tests/drivers/jit_x64_test.sh b/tests/drivers/jit_x64_test.sh
index ce0438f..39e1583 100644
--- a/tests/drivers/jit_x64_test.sh
+++ b/tests/drivers/jit_x64_test.sh
@@ -7,20 +7,22 @@
# runs with a timeout (JIT_TEST_TIMEOUT seconds, 120 by default). a program that
# differs is listed with the first lines of the difference; the exit status of
# this script is the number of programs that differ.
-ref=${1:?usage: jit_x64_test.sh <reference core> <jit core> [filter]}
-jit=${2:?usage: jit_x64_test.sh <reference core> <jit core> [filter]}
+ref=$(realpath "${1:?usage: jit_x64_test.sh <reference core> <jit core> [filter]}")
+jit=$(realpath "${2:?usage: jit_x64_test.sh <reference core> <jit core> [filter]}")
filter=${3:-}
limit=${JIT_TEST_TIMEOUT:-120}
root=$(cd "$(dirname "$0")/../.." && pwd)
cd "$root" || exit 2
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"
pass=0 fail=0 total=0
for f in tests/programs/*.zc examples/*.zc examples/learn/*.zc; do
[ -n "$filter" ] && [[ "$f" != *$filter* ]] && continue
total=$((total + 1))
- timeout "$limit" "$ref" < "$f" > "$tmp/ref.out" 2> "$tmp/ref.err"; rr=$?
- timeout "$limit" "$jit" < "$f" > "$tmp/jit.out" 2> "$tmp/jit.err"; rj=$?
+ (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=$?
if [ "$rr" = "$rj" ] && cmp -s "$tmp/ref.out" "$tmp/jit.out"; then
pass=$((pass + 1))
else