Files
breeze/tests/sync_connection_zi_test.sh
T
waozi ef0de86e02
Cloudflare Pages / Build and verify the site (push) Successful in 3m29s
Integrate Breeze desktop, Android, and app updates
Use the verified dependency lock across native hosts and bundled apps. Preserve saved styles, local app reactivation, and offline packages while integrating the latest practice, Habits, Lumi, and figure preview updates.
2026-11-20 02:24:34 -03:00

50 lines
2.2 KiB
Bash

#!/bin/sh
set -eu
root=$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd)
compiler=${1:-"$root/build/packages/ziran/build/bin/ziran"}
liboqs=${2:-"$root/vendor-builds/linux/x86_64/inbe-liboqs/lib/liboqs.a"}
work=$root/build/sync-connection-test
exec 9>"$work.lock"
flock 9
data=$(mktemp -d /tmp/inbe-sync-connection.XXXXXX)
trap 'rm -rf "$data"' EXIT HUP INT TERM
unset DISPLAY WAYLAND_DISPLAY XAUTHORITY DBUS_SESSION_BUS_ADDRESS
export YUE_DESKTOP_RECOVERY=0
rm -rf "$work"
mkdir -p "$work/generated"
cd "$root"
"$compiler" build --project --offline ${PACKAGE_FLAGS:-} --target=c \
--define PLATFORM_DESKTOP --root "$root/tests" --entry sync_connection_behavior:Check \
-o "$work/generated" "$root/tests/sync_connection_behavior.zi" "$root/tests/sync_test_host.zi"
cat > "$work/generated/main.c" <<'C'
#include "sync_connection_behavior.h"
#include <stdint.h>
#include <stdio.h>
#include <assert.h>
#include "zir_string.h"
int32_t ImageWidth(String path) { (void)path; assert(0); return 0; }
int32_t ImageHeight(String path) { (void)path; assert(0); return 0; }
static int requests;
int32_t ConnectionRequests(void) { return requests; }
int32_t app_request_sync(void *app) { (void)app; requests++; return 1; }
void app_reload_after_import(void *app, int32_t settings) { (void)app; (void)settings; }
int32_t app_web_storage_flush_critical(int32_t timeout_ms, int32_t log_success) {
(void)timeout_ms; (void)log_success; return 1;
}
int main(void) {
int result = Check();
if (result) fprintf(stderr, "Sync connection checks failed: %d\n", result);
return result ? 1 : 0;
}
C
monocypher=$root/build/packages/monocypher/src
"${CC:-cc}" -std=c11 -O1 -ffunction-sections -fdata-sections \
-I"$root/build/packages/ziran/include" -I"$work/generated" \
-I"$root/vendor-builds/sqlite" -I"$root/vendor-builds/linux/x86_64/inbe-liboqs/include" \
-I"$monocypher" -I"$monocypher/optional" \
"$work/generated"/*.c "$root/vendor-builds/sqlite/sqlite3.c" \
"$monocypher/monocypher.c" "$monocypher/optional/monocypher-ed25519.c" "$liboqs" \
-Wl,--gc-sections -ldl -lpthread -lz -lm -l:libcurl.so.4 -o "$work/test"
APP_DATA_ROOT="$data" "$work/test"
printf '%s\n' 'Connecting enables and dispatches sync using the displayed node'