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

50 lines
2.5 KiB
Bash
Executable File

#!/bin/sh
set -eu
# Builds the two-client sync scenario as a Ziran program. It runs against a
# real Mesh server through scripts/sync-server-test.mjs, which needs
# MESH_BIN (a built Mesh server) and node.
root=$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd)
ziran=${1:-"$root/build/packages/ziran/build/bin/ziran"}
liboqs=${2:-"$root/vendor-builds/linux/x86_64/inbe-liboqs/lib/liboqs.a"}
work=${SYNC_SERVER_TEST_WORK:-$root/build/sync-server-zi-test}
include=$root/build/packages/ziran/include
# The system library, linked by name where there is no development symlink.
curl=${CURL_LIBRARY:-$(ls /usr/lib/x86_64-linux-gnu/libcurl.so.4 2>/dev/null || echo -lcurl)}
rm -rf "$work"
mkdir -p "$work/generated"
"$ziran" build --target=c --define PLATFORM_DESKTOP --root "$root/tests" \
--module-path "$root/src" \
--module-path "$root/build/packages/kryon/src/ui" \
--module-path "$root/build/packages/css/src" $(sh "$root/scripts/package-paths.sh" "$root/build/packages") \
--module-path "$root/build/packages/kryon/src/backend" \
--module-path "$root/build/packages/game2d/src" \
--module-path "$root/build/packages/ziran/std" \
--module-path "$root/build/packages/mesh-client" \
--entry sync_server_behavior:Check \
-o "$work/generated" "$root/tests/sync_server_behavior.zi" \
"$root/tests/sync_test_host.zi"
cat > "$work/generated/main.c" <<'C'
#include <stdio.h>
#include "sync_server_behavior.h"
/* Diary files are flushed by the browser's storage only on the web. */
void app_web_storage_flush(void) {}
int main(void)
{
int result = Check();
if (result != 0) fprintf(stderr, "sync server check failed with code %d\n", result);
if (result == 0) puts("PASS two-client sync, habit/session/list/alias/friend recovery, entity photos and their chunks, library photos on two nodes, an old copy moved then deleted, offline retry, conflict, backup restore, deletion");
return result == 0 ? 0 : 1;
}
C
"${CC:-cc}" -std=c11 -O0 -ffunction-sections -fdata-sections \
-I"$include" -I"$work/generated" -I"$root/vendor-builds/sqlite" \
-I"$root/vendor-builds/linux/x86_64/inbe-liboqs/include" \
-I"$root/build/packages/monocypher/src" -I"$root/build/packages/monocypher/src/optional" \
"$work/generated"/*.c "$root/vendor-builds/sqlite/sqlite3.c" "$liboqs" \
"$root/build/packages/monocypher/src/monocypher.c" \
"$root/build/packages/monocypher/src/optional/monocypher-ed25519.c" \
-Wl,--gc-sections -ldl -lpthread -lz -lm "$curl" -o "$work/test"
echo "$work/test"