diff options
| author | 2026-10-14 10:00:13 +0000 | |
|---|---|---|
| committer | 2026-10-14 10:00:13 +0000 | |
| commit | e52a9a399762e5715c261c45d7ecd8e3a68ad50c (patch) | |
| tree | 48d0f2ec228cef26122ef0525619be19c753d491 /tests/drivers | |
| parent | todo: tick typedefs and the string alias (diff) | |
x86-64 jit: translate ordinary vm blocks to x86-64 on linux, o3 regions on the region interpreter
Diffstat (limited to 'tests/drivers')
| -rw-r--r-- | tests/drivers/jit_x64_test.sh | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/drivers/jit_x64_test.sh b/tests/drivers/jit_x64_test.sh new file mode 100644 index 0000000..ce0438f --- /dev/null +++ b/tests/drivers/jit_x64_test.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# runs every program in tests/programs, examples and examples/learn on two cores +# and compares stdout and the exit status. usage: +# bash tests/drivers/jit_x64_test.sh <reference core> <jit core> [name-filter] +# the reference is normally the interpreter (built with -DZYINTERP) and the second +# core the x86-64 jit. each program is the core's stdin, with nothing after it, and +# 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]} +filter=${3:-} +limit=${JIT_TEST_TIMEOUT:-120} +root=$(cd "$(dirname "$0")/../.." && pwd) +cd "$root" || exit 2 +tmp=$(mktemp -d) +trap 'rm -rf "$tmp"' EXIT +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=$? + if [ "$rr" = "$rj" ] && cmp -s "$tmp/ref.out" "$tmp/jit.out"; then + pass=$((pass + 1)) + else + fail=$((fail + 1)) + echo "DIFF $f (status $rr vs $rj)" + diff "$tmp/ref.out" "$tmp/jit.out" | head -6 + head -3 "$tmp/jit.err" + fi +done +echo "$pass of $total programs agree, $fail differ" +exit "$fail" |
