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]>
103 lines
4.2 KiB
Ziran
103 lines
4.2 KiB
Ziran
// The production cache keeps its 64 MiB bound and all borrowed sources.
|
|
#import, file "../src/apps/node_child_packages.zi";
|
|
#import "std/file"
|
|
#import "std/file_linux"
|
|
#import "std/byte_text_linux"
|
|
#import "std/vec"
|
|
#import "std/option"
|
|
#import "apps/host"
|
|
#import "apps/tree"
|
|
#import, file "../src/apps/package_files.zi";
|
|
#import, file "../src/platform/web_bridge.zi";
|
|
#import, file "../src/apps/node_app_runner.zi";
|
|
#import, file "../src/apps/node_app_tree.zi";
|
|
|
|
// This test selects no host, so no raster measures pictures: each is missing.
|
|
#program_export "ImageWidth"
|
|
TestImageWidth :: (path: string) -> s32 {
|
|
unused path
|
|
return 0
|
|
}
|
|
|
|
#program_export "ImageHeight"
|
|
TestImageHeight :: (path: string) -> s32 {
|
|
unused path
|
|
return 0
|
|
}
|
|
#import, file "../src/apps/node_apps.zi";
|
|
|
|
cache_c :: #system_library "c";
|
|
CacheAllocate :: (size: usize) -> *u8 #foreign cache_c "malloc";
|
|
|
|
CacheCleanup :: () {
|
|
for slot: cast(s32)0..NODE_CHILD_LIMIT - 1 {
|
|
if node_children[slot].used { NodeChildClear(slot) }
|
|
}
|
|
VecFree(node_tree_images)
|
|
}
|
|
|
|
CacheFixture :: (index: s32, size: s64) -> bool {
|
|
data := CacheAllocate(cast(usize)size)
|
|
if data == null { return false }
|
|
data[0] = cast(u8)(65 + index)
|
|
child := *node_children[index]
|
|
child.used = true
|
|
child.status = 2
|
|
child.verified = true
|
|
child.bytes = TextFromBytes(BytesFromPointer(data, cast(u64)size))
|
|
child.size = size
|
|
child.touched = cast(u64)(index + 1)
|
|
node_child_memory += size
|
|
return true
|
|
}
|
|
|
|
#program_export
|
|
main :: () -> s32 {
|
|
mib: s64 = 1024 * 1024
|
|
path := "build/node-app-loading-test/cache.zx"
|
|
if !PackageWrite(path, "verified disk fixture") { return 1 }
|
|
defer { unused RemoveFile(path) }
|
|
if !CacheFixture(0, 28 * mib) || !CacheFixture(1, mib) || !CacheFixture(2, mib) { return 2 }
|
|
node_children[0].path = PackageText(path, "")
|
|
defer { CacheCleanup() }
|
|
host: AppHost
|
|
node: AppNode
|
|
runtime := New(AppRuntime)
|
|
if runtime == null { return 3 }
|
|
source := cast(*TextDescriptor)(*node_children[0].bytes)
|
|
runtime.source_data = source.data
|
|
runtime.source_bytes = node_children[0].bytes.count
|
|
runtime.host = *host
|
|
runtime.node = *node
|
|
node.runtime = cast(*void)runtime
|
|
if !VecPush(host.tree.nodes, AppSlot.{*node}) { return 4 }
|
|
node_runners[0].nested = *host
|
|
defer { node_runners[0].nested = null; VecFree(host.tree.nodes) }
|
|
// Pressure frees the two inactive packages rather than the older borrowed
|
|
// program. Their slots survive, and the verified file is never removed.
|
|
if !NodeChildRoom(36 * mib) || node_children[0].status != 2 ||
|
|
node_children[1].status != NODE_CHILD_CACHED || node_children[2].status != NODE_CHILD_CACHED ||
|
|
node_child_memory != 28 * mib || node_children[0].bytes[0] != cast(u8)65 { return 5 }
|
|
if !CacheFixture(3, 36 * mib) { return 6 }
|
|
// An impossible retained set and an oversized request make no partial
|
|
// eviction, do not exceed the limit and leave the active bytes intact.
|
|
if NodeChildRoom(40 * mib) || NodeChildRoom(NODE_CHILD_MEMORY_LIMIT + 1) ||
|
|
node_children[3].status != 2 || node_child_memory != NODE_CHILD_MEMORY_LIMIT { return 7 }
|
|
// A node that just closed is still borrowed by paint until collection.
|
|
AppHostClose(cast(*void)*host, *node)
|
|
if NodeChildRoom(40 * mib) || !NodeChildBorrowed(0) { return 8 }
|
|
AppHostCollect(*host)
|
|
if NodeChildBorrowed(0) || !NodeChildRoom(40 * mib) ||
|
|
node_children[0].status != NODE_CHILD_CACHED || node_child_memory != 0 { return 9 }
|
|
disk, found := ReadEntireFile(path)
|
|
defer { PackageFree(disk) }
|
|
if !found || disk != "verified disk fixture" || !node_children[0].verified ||
|
|
node_children[0].path != path || !node_children[0].used || node_children[0].size != 28 * mib { return 10 }
|
|
// A provider-owned frame image is an independent borrow even with no VM.
|
|
if !CacheFixture(4, mib) || !VecPush(node_tree_images, NodeTreeImage.{.data = node_children[4].bytes}) { return 11 }
|
|
if NodeChildRoom(NODE_CHILD_MEMORY_LIMIT) || node_children[4].status != 2 { return 12 }
|
|
unused VecPop(node_tree_images)
|
|
if !NodeChildRoom(NODE_CHILD_MEMORY_LIMIT) || node_child_memory != 0 { return 13 }
|
|
return 0
|
|
}
|