mirror of
https://github.com/Lakr233/vphone-cli.git
synced 2026-04-05 04:59:05 +08:00
Add testing_do script and Makefile target
Introduce a new zsh helper script (scripts/testing_do.sh) and a Makefile target (testing_do) to automate the testing DFU workflow. The script sets strict error handling, kills any existing vphone-cli, runs fw_prepare, fw_patch_jb and testing_ramdisk_build, sends the ramdisk in the background, boots DFU, and tracks/cleans up child processes on exit. This simplifies and sequences the steps required to prepare, patch, send and boot the test ramdisk.
This commit is contained in:
3
Makefile
3
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
|
||||
# ═══════════════════════════════════════════════════════════════════
|
||||
|
||||
49
scripts/testing_do.sh
Executable file
49
scripts/testing_do.sh
Executable file
@@ -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
|
||||
Reference in New Issue
Block a user