feat(stress): add a deterministic particle demo with sequenced music

Move Storm Eagle playback and source assets to Stress Console and keep Dummy Boy silent. Exercise VM math, seeded Random and persistent typed particles with a projected tunnel, bounded 512-sprite heavy workload, reproducible replays and measured costs.
This commit is contained in:
2026-11-20 22:15:47 +00:00
parent 8510c5b00d
commit c2bf8d055c
42 changed files with 20688 additions and 232 deletions
@@ -687,6 +687,50 @@ impl ApplicationHandler for HostRunner {
mod tests {
use super::*;
#[test]
fn studio_stress_demoscene_publishes_graphics_and_native_music() {
let cart = std::path::Path::new(env!("CARGO_MANIFEST_DIR"))
.join("../../../test-cartridges/stress-console");
let mut host = HostRunner::new(None, None);
host.set_boot_target(BootTarget::Cartridge {
path: cart.to_string_lossy().into_owned(),
debug: false,
debug_port: 0,
});
let deadline = Instant::now() + Duration::from_secs(5);
while !host.studio_boot_step(true).unwrap() {
assert!(Instant::now() < deadline);
std::thread::sleep(Duration::from_millis(1));
}
let (mut callback, mut reclaimer) = crate::audio::AudioCallback::new();
let transport = host.hardware.audio.transport();
let mut pcm = [0.0; 1600];
let mut audible = false;
while host.studio_frame(None).is_none() || !audible {
assert!(Instant::now() < deadline, "demo did not publish graphics/music");
host.studio_step(Default::default()).unwrap();
callback.render(&transport, &mut pcm);
audible |= pcm.iter().any(|x| x.abs() > 0.001);
reclaimer.service(&transport);
std::thread::sleep(Duration::from_millis(2));
}
assert!(callback.diagnostics().maximum_voices > 0);
assert_eq!(host.studio_frame(None).unwrap().ownership.app_id, 1);
let before_pause = callback.diagnostics().frames;
host.studio_pause(true);
callback.render(&transport, &mut pcm);
assert!(pcm.iter().all(|x| *x == 0.0));
assert_eq!(callback.diagnostics().frames, before_pause);
reclaimer.service(&transport);
host.studio_pause(false);
callback.render(&transport, &mut pcm);
assert!(callback.diagnostics().frames > before_pause);
reclaimer.service(&transport);
host.studio_stop(true).unwrap();
callback.render(&transport, &mut pcm);
assert!(pcm.iter().all(|x| *x == 0.0));
}
#[test]
fn studio_can_boot_and_publish_without_a_window() {
let cart = std::path::Path::new(env!("CARGO_MANIFEST_DIR"))
@@ -68,6 +68,7 @@ fn regenerated_cartridges_run_six_complete_frames_on_production_host() {
struct Effects {
scene_binds: usize,
frame_commands: usize,
music_plays: usize,
}
impl NativeInterface for Effects {
fn syscall(
@@ -81,6 +82,9 @@ fn regenerated_cartridges_run_six_complete_frames_on_production_host() {
if syscall == Syscall::ComposerBindScene {
self.scene_binds += 1;
}
if syscall == Syscall::MusicPlay {
self.music_plays += 1;
}
if matches!(syscall, Syscall::GfxClear | Syscall::ComposerSetCamera) {
self.frame_commands += 1;
}
@@ -125,7 +129,7 @@ fn regenerated_cartridges_run_six_complete_frames_on_production_host() {
)
.unwrap();
let mut vm = prometeu_vm::VirtualMachine::from_image(image, Default::default());
let mut effects = Effects { scene_binds: 0, frame_commands: 0 };
let mut effects = Effects { scene_binds: 0, frame_commands: 0, music_plays: 0 };
for _ in 0..6 {
vm.prepare_boot_call().unwrap();
assert_eq!(
@@ -135,6 +139,7 @@ fn regenerated_cartridges_run_six_complete_frames_on_production_host() {
}
assert_eq!(effects.frame_commands, 6);
assert_eq!(effects.scene_binds, usize::from(name == "stress-console"));
assert_eq!(effects.music_plays, usize::from(name == "stress-console"));
}
}