Files
breeze/tests/audio_policy_zi_test.sh
waozi 458f4fb5eb Run the test harnesses on the Ziran 0.6 toolchain
Point every harness's default toolchain at build/packages/ziran/build,
drop the removed `zi2zx bundle` form, link the generated C each harness
actually gets (whole generated folders where the test has no stubs, and
Kryon's package-prefixed frame pacing module), and stop listing the
header-only type module in the modal rules test. Twenty-two more test
targets pass from a clean export; plans/2026-11-17-test-harnesses.md
lists the 54 that still fail and why.
2026-11-17 03:12:21 -03:00

32 lines
1.2 KiB
Bash

#!/bin/sh
set -eu
root=$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd)
bin=${1:-"$root/build/packages/ziran/build/bin"}
work=$root/build/audio-policy-test
source=$root/tests/audio_policy_behavior.zi
mkdir -p "$work/ir" "$work/c"
"$bin/zi2zir" --root "$root/tests" --module-path "$root/src" \
-o "$work/ir" "$source"
"$bin/zi2zx" --root "$root/tests" --module-path "$root/src" \
--entry audio_policy_behavior:Answer -o "$work/source.zx" "$source"
"$bin/zi2zx" --root "$work/ir" --module-path "$work/ir" \
--entry audio_policy_behavior:Answer \
-o "$work/saved.zx" "$work/ir/audio_policy_behavior.zir"
[ "$(env -u DISPLAY -u WAYLAND_DISPLAY "$bin/zi2zx" run "$work/source.zx")" = 42 ]
[ "$(env -u DISPLAY -u WAYLAND_DISPLAY "$bin/zi2zx" run "$work/saved.zx")" = 42 ]
cmp "$work/source.zx" "$work/saved.zx"
"$bin/zi2c" --no-main --root "$root/tests" --module-path "$root/src" \
-o "$work/c" "$source"
cat > "$work/c/main.c" <<'C'
#include "audio_policy_behavior.h"
int main(void) { return Answer() == 42 ? 0 : 1; }
C
"${CC:-cc}" -std=c11 -DZIRAN_BOUNDS_CHECK \
-I"$root/build/packages/ziran/include" -I"$work/c" \
"$work/c"/*.c -o "$work/c/test"
env -u DISPLAY -u WAYLAND_DISPLAY "$work/c/test"
echo "audio policy Ziran tests passed"