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

70 lines
3.0 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/account-activity-test
data=$(mktemp -d /tmp/inbe-account-activity.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/generated"
mkdir -p "$work/generated"
cd "$root"
"$compiler" build --project --offline ${PACKAGE_FLAGS:-} --target=c \
--define PLATFORM_DESKTOP --root "$root/tests" --entry account_activity_behavior:Check \
-o "$work/generated" "$root/tests/account_activity_behavior.zi" "$root/tests/sync_test_host.zi"
cat > "$work/generated/main.c" <<'C'
#include "account_activity_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; }
#include <time.h>
typedef struct sqlite3 sqlite3;
typedef struct sqlite3_stmt sqlite3_stmt;
static int64_t fixture_now = 1791540000;
static double fixture_clock = 10.0;
static int schedules;
static int queries;
time_t __wrap_time(time_t *output) {
if (output) *output = fixture_now;
return fixture_now;
}
double __wrap_app_monotonic_seconds(void) { return fixture_clock; }
void FixtureAdvance(int64_t seconds) { fixture_now += seconds; fixture_clock += seconds; }
void FixtureFrame(void) { fixture_clock += 1.0 / 60.0; }
int32_t FixtureQueries(void) { return queries; }
int __real_sqlite3_prepare_v2(sqlite3 *, const char *, int, sqlite3_stmt **, const char **);
int __wrap_sqlite3_prepare_v2(sqlite3 *db, const char *sql, int length,
sqlite3_stmt **statement, const char **tail) {
queries++;
return __real_sqlite3_prepare_v2(db, sql, length, statement, tail);
}
int32_t FixtureSchedules(void) { return schedules; }
/* Observe the activity boundary without replacing the production export. */
int32_t __wrap_app_auto_sync(void *app) {
(void)app;
schedules++;
return 1;
}
int main(void) {
int result = Check();
if (result) fprintf(stderr, "Account activity 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 -Wl,--wrap=time -Wl,--wrap=app_monotonic_seconds -Wl,--wrap=sqlite3_prepare_v2 -Wl,--wrap=app_auto_sync \
-ldl -lpthread -lz -lm -o "$work/test"
APP_DATA_ROOT="$data" "$work/test"
printf '%s\n' 'Account activity, private outbox, controls, freshness and account switching passed'