feat(ffi): prove dart-to-rust pipeline and arm64 determinism on device

This commit is contained in:
2026-10-24 22:27:48 +02:00
parent 214ab7aac7
commit e371c72a35
11 changed files with 276 additions and 114 deletions
+15
View File
@@ -0,0 +1,15 @@
#!/usr/bin/env bash
# Builds (optional), installs and launches the debug APK.
set -euo pipefail
cd "$(dirname "$0")/../.."
ADB=${ADB:-adb}
PKG=${PKG:-com.ironarc.iron_arc}
if [ "${SKIP_BUILD:-0}" != "1" ]; then
(cd app && flutter build apk --debug --target-platform android-arm64)
fi
apk=app/build/app/outputs/flutter-apk/app-debug.apk
[ -f "$apk" ] || { echo "missing $apk" >&2; exit 1; }
$ADB install -r "$apk"
$ADB shell am force-stop "$PKG"
$ADB shell am start -n "$PKG/.MainActivity"
echo 'launched'
+5
View File
@@ -0,0 +1,5 @@
#!/usr/bin/env bash
# Filters logcat for crashes and our native library.
set -euo pipefail
ADB=${ADB:-adb}
$ADB logcat -d -t "${1:-500}" 2>/dev/null | grep -iE 'iron_arc|libffi|FATAL EXCEPTION|AndroidRuntime|signal [0-9]+|backtrace' || true
+9
View File
@@ -0,0 +1,9 @@
#!/usr/bin/env bash
# Measures frame statistics for a running app (Android 11+ prints percentiles).
set -euo pipefail
ADB=${ADB:-adb}
PKG=${PKG:-com.ironarc.iron_arc}
SECS=${1:-30}
$ADB shell dumpsys gfxinfo "$PKG" reset > /dev/null
sleep "$SECS"
$ADB shell dumpsys gfxinfo "$PKG" | sed -n '/Total frames rendered/,/HISTOGRAM/p' | head -40
+16
View File
@@ -0,0 +1,16 @@
#!/usr/bin/env bash
# Launches the app and captures a screenshot sequence for visual review.
set -euo pipefail
ADB=${ADB:-adb}
PKG=${PKG:-com.ironarc.iron_arc}
OUT=${OUT:-/tmp/shots}
COUNT=${1:-3}
DELAY=${2:-3}
mkdir -p "$OUT"
$ADB shell am force-stop "$PKG"
$ADB shell am start -n "$PKG/.MainActivity" >/dev/null
for i in $(seq 1 "$COUNT"); do
sleep "$DELAY"
$ADB exec-out screencap -p > "$OUT/shot-$i.png"
done
echo "screenshots in $OUT"
+17
View File
@@ -0,0 +1,17 @@
#!/usr/bin/env bash
# Prints the attached device profile (model, API, display, GPU, RAM).
set -euo pipefail
ADB=${ADB:-adb}
serial=$($ADB devices | awk 'NR>1 && $2=="device" {print $1; exit}')
[ -n "${serial:-}" ] || { echo 'no device attached' >&2; exit 1; }
run() { $ADB -s "$serial" shell "$@" | tr -d '\r'; }
echo "serial : $serial"
echo "model : $(run getprop ro.product.manufacturer) $(run getprop ro.product.model)"
echo "android : $(run getprop ro.build.version.release) (API $(run getprop ro.build.version.sdk))"
echo "abi : $(run getprop ro.product.cpu.abi)"
echo "display : $(run wm size | sed 's/Physical size: //') @ $(run wm density | sed 's/Physical density: //') dpi"
refresh=$(run dumpsys display | grep -m1 -o 'fps=[0-9.]*' || true)
echo "refresh : ${refresh:-unknown}"
gpu=$(run dumpsys SurfaceFlinger | grep -m1 -oE 'Adreno[^,]*|Mali[^,]*|PowerVR[^,]*' || true)
echo "gpu : ${gpu:-unknown}"
echo "ram : $(run cat /proc/meminfo | awk '/MemTotal/ {printf "%.1f GB", $2/1048576}')"