mirror of
https://github.com/isod89/sloop-fm1.git
synced 2026-12-05 20:34:19 +01:00
100 lines
5.8 KiB
Bash
100 lines
5.8 KiB
Bash
#!/bin/sh
|
|
# SPDX-License-Identifier: GPL-3.0-only
|
|
# Copyright (C) 2026 Leo Kuroshita (@kurogedelic), Hügelton Instruments
|
|
# Host tests (no hardware). Run from the repo root after ./build.sh:
|
|
# tests/run_tests.sh
|
|
#
|
|
# Regression suite (tests/regress.c, tests/target_budget.py; details at the top of regress.c):
|
|
# golden renders every engine x preset, the drum kit, voice modes, FX sends, a 4-track mix: one hash
|
|
# each in tests/golden.txt. A change of the sound fails with the list of renders.
|
|
# health clipping, DC, peak level, voices free after the release, silence at the end.
|
|
# CPU instructions / sample per preset and mix (tests/cpu_baseline.txt, +25 %), ns printed;
|
|
# target: loop instructions of the render functions in build/felucca.dis
|
|
# (tests/target_budget.txt, +10 %; exact, static).
|
|
# voices the budget of 8, steal fades, MONO / LEGATO / UNISON keep their note, the VOICE cap,
|
|
# no hanging notes on any MIDI / key routing.
|
|
# After an intended change of the sound: GOLDEN_UPDATE=1 sh tests/run_tests.sh, review the diff
|
|
# of tests/golden.txt, commit it with the change. After an intended change of the cost (or a new
|
|
# compiler): BUDGET_UPDATE=1 (rewrites cpu_baseline.txt and target_budget.txt). VERBOSE=1: every render.
|
|
set -e
|
|
export AC79_SDK="${AC79_SDK:-$HOME/fw-AC79_AIoT_SDK}"
|
|
cd "$(dirname "$0")/.."
|
|
OUT=build/host
|
|
mkdir -p "$OUT"
|
|
CC="${CC:-cc} -O1 -Wall -Wno-unused-function"
|
|
fail=0
|
|
run() { echo "== $1"; shift; "$@" || fail=1; }
|
|
|
|
[ -f build/felucca.fwsc ] || { echo "run ./build.sh first"; exit 1; }
|
|
|
|
$CC -o "$OUT/storage_test" tests/storage_test.c
|
|
run "flash storage (A/B, torn writes)" "$OUT/storage_test"
|
|
|
|
$CC -o "$OUT/recovery_test" tests/recovery_test.c
|
|
run "application USB recovery and boot-loop guard" "$OUT/recovery_test"
|
|
|
|
$CC -o "$OUT/arranger_test" tests/arranger_test.c
|
|
run "song order, timing, repeats and missing scenes" "$OUT/arranger_test"
|
|
$CC -O2 -w -Ibuild/gen -Ifirmware/src -o "$OUT/song_audio_test" tests/song_audio_test.c -lm
|
|
run "song: four simultaneous tracks, scene transition and stop" "$OUT/song_audio_test" "$OUT/song-demo.wav"
|
|
$CC -O2 -w -Ibuild/gen -Ifirmware/src -o "$OUT/song_ui_test" tests/song_ui_test.c -lm
|
|
run "song screen: commands, load (OCT+ twice), display bounds" "$OUT/song_ui_test" "$OUT/song-screen.ppm"
|
|
|
|
$CC -O2 -w -Ibuild/gen -Ifirmware/src -o "$OUT/studio_drums_test" tests/studio_drums_test.c -lm
|
|
run "drum lanes, kit audio, metronome, record arm, free take" "$OUT/studio_drums_test" "$OUT/drum-styles.wav"
|
|
$CC -O2 -w -Ibuild/gen -Ifirmware/src -o "$OUT/seq2_test" tests/seq2_test.c -lm
|
|
run "sequencer 2.0: no drift, ratchets, roll, erase / undo, ghost / hard, chords, mute / solo" "$OUT/seq2_test"
|
|
|
|
$CC -O2 -w -Ibuild/gen -Ifirmware/src -o "$OUT/drumkit_test" tests/drumkit_test.c -lm
|
|
run "synthesised drum kits: every kit x sound bounded, audible, finite, levels, cost" "$OUT/drumkit_test" "$OUT/drum-kits.wav" "$OUT/drum-kits.txt"
|
|
$CC -O2 -w -Ibuild/gen -Ifirmware/src -o "$OUT/punch_test" tests/punch_test.c -lm
|
|
run "punch-in FX: 16 effects, bounded, dry after release, FX-held keys" "$OUT/punch_test" "$OUT/punch-fx.wav"
|
|
|
|
$CC -O2 -w -Ibuild/gen -Ifirmware/src -Ifirmware/hal -o "$OUT/ui_pages_test" tests/ui_pages_test.c -lm
|
|
run "live UI: pages, layers (punch, steps, erase, roll, key, mix), holds, drums, REC, fuzz" "$OUT/ui_pages_test" "$OUT"
|
|
|
|
$CC -O2 -w -Ibuild/gen -Ifirmware/src -o "$OUT/soak_test" tests/soak_test.c -lm
|
|
run "soak: ${SOAK_MIN:-10} minutes of random live use (bounded, no hanging voices, idle after stop)" "$OUT/soak_test" "${SOAK_MIN:-10}"
|
|
|
|
$CC -o "$OUT/upreset_test" tests/upreset_test.c
|
|
run "user presets (UP_PUT parser, bank round trip, versions)" "$OUT/upreset_test"
|
|
|
|
$CC -o "$OUT/midi_uart_test" tests/midi_uart_test.c
|
|
run "TRS MIDI parser" "$OUT/midi_uart_test"
|
|
|
|
$CC -o "$OUT/ota_test" tests/ota_test.c
|
|
run "M-UPGRADE entry" "$OUT/ota_test" build/felucca.fwsc
|
|
|
|
head -c 200000 build/felucca.bin > "$OUT/old_app.bin"
|
|
python3 tools/fm1pkg_make.py "$OUT/old_app.bin" build/loader/ota.bin "$OUT/old.fwsc" >/dev/null
|
|
$CC -o "$OUT/ldr_test" tests/ldr_test.c
|
|
run "update loader: other app -> this build" "$OUT/ldr_test" "$OUT/old.fwsc" build/felucca.fwsc
|
|
|
|
$CC -O2 -w -Ibuild/gen -Ifirmware/src -o "$OUT/hostsim" tests/hostsim.c -lm
|
|
$CC -O2 -w -Ibuild/gen -Ifirmware/src -o "$OUT/scale_test" tests/scale_test.c -lm
|
|
run "scales: white-key mapping and note lifecycle" "$OUT/scale_test"
|
|
run "DSP render (ANALOG preset 0)" "$OUT/hostsim" 0 0 1 "$OUT/render.wav"
|
|
mkdir -p build/tracks_demo
|
|
run "TRACKS: 4-track pattern, live recording (lengths, swing), voice budget, engine switch, cost" env TRACKS=build/tracks_demo "$OUT/hostsim" 0 0 1 "$OUT/tracks.wav"
|
|
$CC -w -Ibuild/gen -Ifirmware/src -o "$OUT/project_test" tests/project_test.c -lm
|
|
run "project formats (FUN3 / FUN2 / FUN1 -> FUN4), capture / apply, autosave" "$OUT/project_test"
|
|
$CC -O2 -w -Ibuild/gen -Ifirmware/src -o "$OUT/slicer_test" tests/slicer_test.c -lm
|
|
mkdir -p build/slicer_demo
|
|
run "SLICER: no clicks, timing, sync with the sequencer, STUT, cost, demos" "$OUT/slicer_test" build/slicer_demo
|
|
$CC -O2 -w -Ibuild/gen -Ifirmware/src -o "$OUT/regress" tests/regress.c -lm
|
|
run "regression: golden renders, health, voices, CPU budget" "$OUT/regress" tests/golden.txt tests/cpu_baseline.txt
|
|
# SLICE (tests/slice_test.c) needs a FELUCCA_SLICE=1 build; the engine is not built by default
|
|
|
|
run "regression: target cost of the render loops" python3 tests/target_budget.py \
|
|
build/felucca.dis tests/target_budget.txt
|
|
|
|
run "installer CLI (fm1_install.py) against a simulated FM-1" python3 tests/install_test.py
|
|
|
|
if command -v node >/dev/null 2>&1; then
|
|
run "web pages: editor protocol, samples, packages, update protocol" node web/test_web.mjs
|
|
else
|
|
echo "== skip web tests (no node)"
|
|
fi
|
|
|
|
[ $fail -eq 0 ] && echo "ALL HOST TESTS PASSED" || { echo "HOST TESTS FAILED"; exit 1; }
|