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

89 lines
4.7 KiB
Bash
Executable File

#!/bin/sh
set -eu
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=${APPS_TEST_DIR:-$root/build/apps-test}
bundles=${APPS_TEST_BUNDLES:-$root/build}
# Apps the node offers reach the shared-list service, which links curl; the
# system library is 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)}
webp=$(pkg-config --libs libwebp libwebpdemux)
# The radio player decodes MP3 with Ziran's dr_mp3 archive.
audio=$root/vendor-builds/linux/x86_64/audio-codecs
mkdir -p "$work/generated" "$work/wrong-record" "$work/wrong-scalar"
if [ -z "${APPS_TEST_BUNDLES:-}" ]; then
sh "$root/scripts/build-apps.sh" "$ziran"
fi
# These are valid portable bundles with an identity handshake and all three
# named capabilities. Their mismatched values must never reach a decoder.
for shape in wrong-record wrong-scalar; do
if [ "$shape" = wrong-record ]; then
declaration='Bad :: struct { unexpected: s32; }'
argument='Bad.{.unexpected = 1}'
type='Bad'
else
declaration=''
argument='"wrong"'
type='string'
fi
cat > "$work/$shape/lists.zi" <<ZIRAN
#import, file "../../../src/apps/lists_types.zi";
#import, file "../../../apps/lists/lists_view.zi";
host_api :: #system_library "host_api";
ReadListsHost :: () -> ListsMessage #foreign host_api;
WriteListsHost :: (value: $type) #foreign host_api;
PersistListsHost :: (value: $type) -> s32 #foreign host_api;
$declaration
#program_export
Main :: () -> s32 {
message := ReadListsHost()
if message.action == 0 { return 1 }
if message.action == LISTS_FRAME { unused ListsView(message) }
WriteListsHost($argument)
return PersistListsHost($argument)
}
ZIRAN
"$ziran" bundle --project --offline --root "$root" --module-path "$work/$shape" \
--define KRYON_HOSTED_UI --entry lists:Main -o "$work/$shape.zx" "$work/$shape/lists.zi"
done
"$ziran" bundle --project --offline --root "$root" --module-path "$root/apps/inbe" \
--define KRYON_HOSTED_UI --entry inbe:Main -o "$work/missing-assets.zx" \
"$root/apps/inbe/inbe.zi"
mkdir -p "$work/invalid-nested"
printf 'ZX' > "$work/invalid-nested/lists.zx"
cp "$bundles/apps/habits.zx" "$bundles/apps/practices.zx" "$work/invalid-nested/"
"$ziran" bundle --project --offline --root "$root" --module-path "$root/apps/inbe" \
--define KRYON_HOSTED_UI --entry inbe:Main \
--asset-dir "cells=$work/invalid-nested" -o "$work/invalid-nested.zx" \
"$root/apps/inbe/inbe.zi"
"$ziran" build --target=c --no-main --project --offline --define PLATFORM_DESKTOP --root "$root/tests" \
-o "$work/generated" "$root/tests/apps_behavior.zi" "$root/tests/sync_test_host.zi"
# The --wrap fakes below must see every call, not header inline copies.
"${CC:-cc}" -D_GNU_SOURCE -DZIRAN_NO_HEADER_INLINE -std=c11 -O0 -ffunction-sections -fdata-sections \
-I"$root/build/packages/ziran/include" -iquote "$work/generated" -iquote "$work/generated/apps" \
-I"$root/build/packages/monocypher/src" -I"$root/build/packages/monocypher/src/optional" \
-I"$root/vendor-builds/sqlite" -I"$root/vendor-builds/linux/x86_64/inbe-liboqs/include" \
"$root/tests/apps_host_test.c" "$root/tests/diary_lock_host.c" "$work/generated"/*.c \
"$root/build/packages/monocypher/src/monocypher.c" \
"$root/build/packages/monocypher/src/optional/monocypher-ed25519.c" \
"$root/vendor-builds/sqlite/sqlite3.c" "$liboqs" "${ZIRAN_LIB:-$(dirname "$(dirname "$ziran")")/libziran.a}" \
-Wl,--wrap=tmpfile -Wl,--wrap=BundleInstanceRun -Wl,--wrap=BundleInstantiate -Wl,--wrap=BundleOpenBytes \
-Wl,--wrap=package_manager_PackageInstalledBytes -Wl,--wrap=package_manager_PackageRevisionFor \
-Wl,--wrap=package_files_PackageRead \
-Wl,--wrap=package_manager_PackageTrustedRelease \
"$audio/libziran_mp3.a" \
-Wl,--gc-sections -ldl -lpthread -lz -lm "$curl" $webp -o "$work/test"
# All data and fixture upgrade paths are disposable. No owner profile is used.
data=$(mktemp -d "$work/profile.XXXXXX")
trap 'rm -rf "$data"' EXIT HUP INT TERM
mkdir -p "$data/module-data"
cp "$root/tests/fixtures/schema-1.8.9.sql" "$data/"
cd "$data"
env -u INBE_DIARY_IMPORT -u DISPLAY -u WAYLAND_DISPLAY -u XAUTHORITY -u DBUS_SESSION_BUS_ADDRESS \
APP_DATA_ROOT="$data/module-data" "$work/test" "$bundles/apps/lists.zx" \
"$bundles/apps/habits.zx" "$bundles/apps/practices.zx" \
"$work/wrong-record.zx" "$work/wrong-scalar.zx" "$bundles/inbe-full.zx" \
"$work/missing-assets.zx" "$work/invalid-nested.zx" "$bundles/apps/diary.zx" "$bundles/apps/lumi.zx" \
"$bundles/apps/leaderboard.zx"