Files
breeze/tests/sync_recovery_link_test.c
waoziandClaude Opus 5.5 054a29f02c Remove raylib: run every host on Kryon and Ziran
Breeze builds and runs with no raylib anywhere, on Ziran 7fbc8152 and
Kryon b5a61b37, with plot, entity, apps, css and game2d pinned to that
Kryon, so the lock has one Kryon and no raylib package.

- Linux and Windows run on Kryon's SDL2 and Cairo desktop host; WebP
  decodes with the linked libwebp (KRYON_WEBP_LINKED).
- Android owns its NativeActivity loop on Kryon's android_runtime:
  Pixmap on the activity's surface, android_touch input and Android's
  typefaces, paced to the app's frame target. The CMake build drops
  breeze_raylib, GLES and the raylib link wraps, and links Kryon's fopen
  wrapper.
- The browser reaches Kryon's canvas modules directly.
- Audio is Ziran's std audio: its mixer, the SDL, AAudio and OpenSL ES
  sinks, the WAV, MP3 and Vorbis decoders and the audio package's Opus.
  The MP3 and Vorbis archives come from Ziran's own codec recipes. The
  browser keeps Kryon's Web Audio.
- Host modules choose the desktop host, Android, the canvas or, for
  native tests that select none, a headless host with no window, input
  or audio device. host_keys.zi and text_input_host.zi replace
  raylib_host.zi and raylib_text_input.zi; the log is one implementation,
  with logcat on Android and the C runtime's open flags on Windows.
- The Makefile, Click packaging, CI and release workflows build no raylib.
- Tests: radio, app log, asset files, DPI, legacy sessions, sync recovery
  and the Android JNI bridge run without raylib stubs; voice playback is
  a Ziran test of real Ogg Opus narration through Ziran's mixer. Tests
  that only exercised raylib internals are removed.
- AppsControllerSha256 is the controller built from Apps b96d9afe on
  this graph.

Local tests: Linux desktop window, Habits UI and the Ziran and native
tests above pass on a private Xvfb; the Android debug APK runs on a
Pixel 4a; the Windows package runs under Wine on a private Xvfb.

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

114 lines
2.4 KiB
C

#include "sync_recovery_behavior.h"
#include "db.h"
#include <stdio.h>
#include <string.h>
/* The storage layer is replaced by two in-memory settings and a queue, so this
checks only the retry and status decisions in app_sync. */
static double test_time = 100;
static int last_result;
static int retry_attempt;
static int enabled = 1;
static int64_t queued;
static int repair;
static int full_upload;
static int status_reads;
static bool valid_server = true;
bool storage_sync_node_failover(void) { return false; }
int32_t app_preview_mode(void) { return 0; }
String storage_get_setting_text(String key) {
return valid_server ? StringLiteral("https://sync.example") : StringLiteral("");
}
void recovery_set_url(bool valid) {
valid_server = valid;
storage_connection_generation++;
}
double
GetTime(void)
{
return test_time;
}
static int
is_key(String key, const char *name)
{
return key.length == strlen(name) && memcmp(key.data, name, key.length) == 0;
}
int32_t
storage_get_setting_int(String key, int32_t fallback)
{
if(is_key(key, "sync_last_result"))
return last_result;
if(is_key(key, "sync_retry_attempt"))
return retry_attempt;
return fallback;
}
void
storage_set_setting_int(String key, int32_t value)
{
if(is_key(key, "sync_last_result"))
last_result = value;
if(is_key(key, "sync_retry_attempt"))
retry_attempt = value;
}
int32_t
storage_sync_enabled(void)
{
return enabled;
}
int32_t
storage_sync_status(StorageSyncStatus *status)
{
status_reads++;
memset(status, 0, sizeof(*status));
status->has_account = 1;
status->enabled = enabled;
status->repair_pending = repair;
status->full_upload_done = full_upload;
status->queued_changes = queued;
return 1;
}
int32_t recovery_status_reads(void) { return status_reads; }
void
recovery_set_time(double seconds)
{
test_time = seconds;
}
void
recovery_set_enabled(int32_t value)
{
enabled = value;
storage_connection_generation++;
}
void
recovery_set_queue(int64_t queued_changes, int32_t repair_pending,
int32_t full_upload_done)
{
queued = queued_changes;
repair = repair_pending;
full_upload = full_upload_done;
}
int
main(void)
{
int failed = Answer();
if(failed != 0) {
fprintf(stderr, "sync recovery check %d failed\n", failed);
return 1;
}
return 0;
}