From 93e659d63593716d0eb127244b94130b52e1d6f2 Mon Sep 17 00:00:00 2001 From: zinc Date: Wed, 14 Oct 2026 18:43:45 +0330 Subject: jit_x64_test: a compile error on either core counts as a difference --- tests/drivers/jit_x64_test.sh | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/tests/drivers/jit_x64_test.sh b/tests/drivers/jit_x64_test.sh index 39e1583..4038d21 100644 --- a/tests/drivers/jit_x64_test.sh +++ b/tests/drivers/jit_x64_test.sh @@ -6,7 +6,9 @@ # 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. +# this script is the number of programs that differ. a program that does not +# compile (`zc: N error(s)` in the output of either core) counts as a difference even +# when both cores print the same error, since zy can still exit 0 after one. ref=$(realpath "${1:?usage: jit_x64_test.sh [filter]}") jit=$(realpath "${2:?usage: jit_x64_test.sh [filter]}") filter=${3:-} @@ -23,13 +25,15 @@ for f in tests/programs/*.zc examples/*.zc examples/learn/*.zc; do total=$((total + 1)) (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 + ce= + grep -qE '^zc: [0-9]+ errors?$' "$tmp/ref.out" "$tmp/jit.out" "$tmp/ref.err" "$tmp/jit.err" && ce=" compile error" + if [ -z "$ce" ] && [ "$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)" + echo "DIFF $f (status $rr vs $rj)$ce" diff "$tmp/ref.out" "$tmp/jit.out" | head -6 - head -3 "$tmp/jit.err" + head -3 "$tmp/jit.err"; [ -n "$ce" ] && head -3 "$tmp/ref.err" fi done echo "$pass of $total programs agree, $fail differ" -- cgit v1.2.3