Files
breeze/tests/habit_session_rules_zi_test.sh
T
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

29 lines
1015 B
Bash

#!/bin/sh
set -eu
root=$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd)
bin=${1:-"$root/build/packages/ziran/build/bin"}
work=$(mktemp -d "$root/build/habit-session-rules-test.XXXXXX")
trap 'rm -rf "$work"' EXIT HUP INT TERM
source=$root/tests/habit_session_rules_behavior.zi
"$bin/ziran" bundle --root "$root" \
--module-path "$root/src" \
--entry habit_session_rules_behavior:Answer \
-o "$work/rules.zx" "$source"
test "$("$bin/ziran" run "$work/rules.zx")" = 42
"$bin/zi2c" --no-main --root "$root" \
--module-path "$root/src" \
-o "$work/c" "$source"
cat > "$work/c/main.c" <<'C'
#include "habit_session_rules_behavior.h"
int main(void) { return Answer() == 42 ? 0 : 1; }
C
"${CC:-cc}" -std=c11 -ffunction-sections -fdata-sections \
-Wl,--gc-sections -I"$root/build/packages/ziran/include" \
-I"$work/c" -I"$work/c/tests" \
"$work/c"/*.c "$work/c/tests"/*.c -o "$work/rules-test"
env -u DISPLAY -u WAYLAND_DISPLAY "$work/rules-test"
echo "Habit session second parsing passed"