Files
breeze/tests/route_catalog_zi_test.sh
waoziandClaude Opus 5.5 6f6d19f24d Rename account sync to Mesh
The codex-daochi-client-mesh-client-rename integration, committed as that
task staged it: mesh_client replaces daochi_client, account storage and
tests move to the Mesh names, and docs, locales and CI follow, with
existing accounts, encrypted records and local storage kept compatible.
The task stopped before its dependency versions were pushed; the next
commit moves Breeze to the pushed pins it needs.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-18 13:14:02 -03:00

67 lines
2.5 KiB
Bash

#!/bin/sh
set -eu
root=$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd)
bin=${1:-"$root/build/packages/ziran/build/bin"}
work=${ROUTE_CATALOG_TEST_BUILD_DIR:-"$root/build/route-catalog-test"}
source=$root/tests/route_catalog_behavior.zi
include=${ZIRAN_INCLUDE:-"$root/build/packages/ziran/include"}
ui=${KRYON_UI_DIR:-$root/build/packages/kryon/src/ui}
mkdir -p "$work/ir"
"$bin/zi2zir" --root "$root/tests" --module-path "$root/src" \
--module-path "$ui" --module-path "$root/build/packages/ziran/std" --module-path "$root/build/packages/mesh-client" $(sh "$root/scripts/package-paths.sh" "$root/build/packages") --module-path "$root/build/packages/kryon/src/backend" -o "$work/ir" "$source"
for input in source saved; do
if [ "$input" = source ]; then
file=$source
module_root=$root/tests
app_path=$root/src
ui_path=$ui
std_path=$root/build/packages/ziran/std
else
file=$work/ir/route_catalog_behavior.zir
module_root=$work/ir
app_path=$work/ir
ui_path=$work/ir
std_path=$work/ir
fi
output=$work/$input
rm -rf "$output/c" "$output/go"
mkdir -p "$output/c" "$output/go"
"$bin/zi2zx" --root "$module_root" \
--module-path "$app_path" --module-path "$ui_path" --module-path "$std_path" \
--entry route_catalog_behavior:Answer \
-o "$output/routes.zx" "$file"
[ "$("$bin/zi2zx" run "$output/routes.zx")" = 42 ]
"$bin/zi2c" --no-main --root "$module_root" \
--module-path "$app_path" --module-path "$ui_path" --module-path "$std_path" \
-o "$output/c" "$file"
cat > "$output/c/main.c" <<'C'
#include "route_catalog_behavior.h"
int main(void) { return Answer() == 42 ? 0 : 1; }
C
"${CC:-cc}" -std=c11 -ffunction-sections -fdata-sections \
-Wl,--gc-sections -I"$include" -I"$output/c" \
"$output/c"/*.c -o "$output/c/test"
env -u DISPLAY -u WAYLAND_DISPLAY "$output/c/test"
"$bin/zi2go" --no-main --root "$module_root" \
--module-path "$app_path" --module-path "$ui_path" --module-path "$std_path" \
-o "$output/go" "$file"
cat > "$output/go/route_catalog_behavior_test.go" <<'GO'
package ziran
import "testing"
func TestRouteCatalog(t *testing.T) {
if got := RouteCatalogBehavior_Answer(); got != 42 {
t.Fatalf("route catalog: got %d, want 42", got)
}
}
GO
GO111MODULE=off go test "$output/go"/*.go
done
cmp "$work/source/routes.zx" "$work/saved/routes.zx"
echo "route catalog Ziran test passed"