Skip to content

Run a virtual iPhone on an Apple Silicon Mac.

Swift

Add testing_do script and Makefile target

Lakr9bb53b7368b1
diff --git a/Makefile b/Makefile
index 70a007bd..6128ee34 100644
--- a/Makefile
+++ b/Makefile
@@ -233,6 +233,9 @@ testing_ramdisk_build:
testing_ramdisk_send:
cd $(VM_DIR) && IRECOVERY="$(CURDIR)/$(IRECOVERY)" zsh "$(CURDIR)/$(SCRIPTS)/testing_ramdisk_send.sh"
+testing_do:
+ zsh "$(CURDIR)/$(SCRIPTS)/testing_do.sh"
+
# ═══════════════════════════════════════════════════════════════════
# CFW
# ═══════════════════════════════════════════════════════════════════
diff --git a/scripts/testing_do.sh b/scripts/testing_do.sh
new file mode 100755
index 00000000..b5d1aa66
--- /dev/null
+++ b/scripts/testing_do.sh
@@ -0,0 +1,49 @@
+#!/usr/bin/env zsh
+set -euo pipefail
+
+# ─── Track child PIDs for cleanup ───────────────────────────────────
+typeset -a CHILD_PIDS=()
+
+cleanup() {
+ echo "\n[testing_do] cleaning up..."
+ for pid in "${CHILD_PIDS[@]}"; do
+ if kill -0 "$pid" 2>/dev/null; then
+ echo "[testing_do] killing PID $pid"
+ kill -9 "$pid" 2>/dev/null || true
+ fi
+ done
+ exit 0
+}
+
+trap cleanup EXIT INT TERM
+
+PROJECT_DIR="$(cd "$(dirname "${0:a:h}")" && pwd)"
+cd "$PROJECT_DIR"
+
+# ─── Kill existing vphone-cli ──────────────────────────────────────
+echo "[testing_do] killing existing vphone-cli..."
+pkill -9 vphone-cli 2>/dev/null || true
+sleep 1
+
+# ─── Build pipeline ───────────────────────────────────────────────
+echo "[testing_do] fw_prepare..."
+make fw_prepare
+
+echo "[testing_do] fw_patch_jb..."
+make fw_patch_jb
+
+echo "[testing_do] testing_ramdisk_build..."
+make testing_ramdisk_build
+
+# ─── Send ramdisk in background ───────────────────────────────────
+echo "[testing_do] testing_ramdisk_send (background)..."
+make testing_ramdisk_send &
+CHILD_PIDS+=($!)
+
+# ─── Boot DFU ─────────────────────────────────────────────────────
+echo "[testing_do] boot_dfu..."
+make boot_dfu &
+CHILD_PIDS+=($!)
+
+echo "[testing_do] waiting for boot_dfu (PID ${CHILD_PIDS[-1]})..."
+wait "${CHILD_PIDS[-1]}" 2>/dev/null || true