Fix setup on stock macOS bash, shader step false success, battery gate misreport (#4, #5, #7)

- Brace every $NAME that is directly followed by a non-ASCII character in the shell scripts: bash 3.2 in a UTF-8 locale read the first byte of the following character as part of the variable name and aborted under set -u (#4, #6).
- setup.sh and d2rm_pack.py: the shader translation step is complete only when every entry in the completion marker is ok and every library file exists; the script's exit status is no longer hidden by a pipe (#5).
- devbattery.sh / devlock.sh: a missing local timeout or ideviceinfo is reported as such and stops at once, instead of being reported as an offline device and polled for up to an hour (#7).
- smoke_mac.sh builds its package for iPhone only regardless of the project default.

Reported by @SakuraToErii. The setup.sh part of #4 was also submitted by @hubeiqiao in #6.

Co-authored-by: hubeiqiao <12777592+hubeiqiao@users.noreply.github.com>
This commit is contained in:
jhaizhou
2026-10-13 03:17:23 +08:00
co-authored by hubeiqiao
parent 824d2d3f0b
commit 66c3a2fb70
28 changed files with 121 additions and 68 deletions
+1 -1
View File
@@ -62,7 +62,7 @@ if [ "${ACCEPT_ALL:-0}" != 1 ]; then
elif ! printf '%s\n' "$CH" | grep -qvE '^(dm/gfx/|dm/ios/|docs/)|\.md$'; then SKIP="1 2 5 6 7 9"; SCOPE="改动只在 dm/gfx(及 dm/ios、文档)"; fi
fi
fi
echo "SCOPE ${SCOPE}$([ -n "$SKIP" ] && echo ";跳过项序号 $SKIP(ACCEPT_ALL=1 强制全量)")"
echo "SCOPE ${SCOPE}$([ -n "$SKIP" ] && echo ";跳过项序号 ${SKIP}(ACCEPT_ALL=1 强制全量)")"
[ "${ACCEPT_SCOPE_ONLY:-0}" = 1 ] && exit 0
# 并行子项都调用增量make;先在锁内只构建一次,避免冷树多个链接器争写同一个dmhost/dSYM。
# The parallel sub-items all invoke an incremental make; build once first inside the lock, so that on a cold tree several linkers do not compete to write the same dmhost/dSYM.
+1 -1
View File
@@ -86,7 +86,7 @@ EOF2
else
if [ -f "$log" ]; then cat "$frame_tmp/run.log" >> "$log"; else cp "$frame_tmp/run.log" "$log"; fi
printf '%s\t%s\n' "$id" "$name" >> "$fail_file"
echo "失败 $id $name(见 $log)" >&2
echo "失败 $id ${name}(见 ${log})" >&2
fi
}
+1 -1
View File
@@ -14,7 +14,7 @@ SRC=${1:-$(bash "$(dirname "$0")/../../tools/product.sh" path keypage)}; DST=$SR
OFF=$((0x8524c4)); OLD=d2a20808; NEW=d2a40008 # MOVZ X8,#0x1040,LSL#16 → MOVZ X8,#0x2000,LSL#16(小端存放) | MOVZ X8,#0x1040,LSL#16 → MOVZ X8,#0x2000,LSL#16 (stored little-endian)
le() { echo "$1" | sed -E 's/(..)(..)(..)(..)/\4\3\2\1/'; }
cur=$(xxd -s $OFF -l 4 -p "$SRC/main.patched.bin")
[ "$cur" = "$(le $OLD)" ] || { echo "【红】源产物 main+0x8524c4 不是预期指令 $OLD(读到小端 $cur),构建号变了?不改" >&2; exit 2; }
[ "$cur" = "$(le $OLD)" ] || { echo "【红】源产物 main+0x8524c4 不是预期指令 ${OLD}(读到小端 ${cur}),构建号变了?不改" >&2; exit 2; }
rm -rf "$DST"; cp -R "$SRC" "$DST"
printf "$(le $NEW | sed 's/../\\x&/g')" | dd of="$DST/main.patched.bin" bs=1 seek=$OFF conv=notrunc 2>/dev/null
[ "$(xxd -s $OFF -l 4 -p "$DST/main.patched.bin")" = "$(le $NEW)" ] || { echo "【红】写入核对失败" >&2; exit 1; }
+1 -1
View File
@@ -22,7 +22,7 @@ touch "$R/index.start" # 起跑时刻(收崩溃报告用) | Run start time
make -s -C "$HERE/../host" || { echo "🔴 宿主编译失败"; exit 1; }
# 宿主日志红线关键字表在 logred.sh(与 accept ② 共用)
# The host log a failure line-line keyword table lives in logred.sh (shared with accept ②)
ROUTE=${DM_NVN_ROUTE:-B}; [ -n "${DM_NVN_B:-}" ] && [ "${DM_NVN_B}" != all ] && ROUTE="A/B 混(DM_NVN_B=$DM_NVN_B)" # 着色器路线:宿主缺省 B,DM_NVN_ROUTE=A 切回 A | Shader route: the host defaults to B, DM_NVN_ROUTE=A switches back to A
ROUTE=${DM_NVN_ROUTE:-B}; [ -n "${DM_NVN_B:-}" ] && [ "${DM_NVN_B}" != all ] && ROUTE="A/B 混(DM_NVN_B=${DM_NVN_B})" # 着色器路线:宿主缺省 B,DM_NVN_ROUTE=A 切回 A | Shader route: the host defaults to B, DM_NVN_ROUTE=A switches back to A
echo "着色器路线 ${ROUTE};产物 $(basename "$OUT");宿主 $BIN"
rc=0; rows=""
page() { # 单页:截图 + 比对,结果写 $R/$1.res(首行 rc,次行读数) | Single page: screenshot + comparison, result written to $R/$1.res (first line rc, second line readings)
+2 -2
View File
@@ -6,8 +6,8 @@
# those marked KEEP (artifacts of a failed host screenshot / watchdog) are not deleted; to keep some artifacts long term (a document references them), put an empty file PIN in the directory. Default root $DM_ROOT/run/verify/dm/shotgate, default 3 days (SHOTGATE_KEEP_DAYS). shotgate.sh calls it once at the end of every run.
# Background: 956 directories and 34 GB piled up here with nobody cleaning, and the disk hit the limit twice.
ROOT=${1:-${DM_ROOT:-$HOME/dm-work}/run/verify/dm/shotgate}; DAYS=${2:-${SHOTGATE_KEEP_DAYS:-3}}
case "$ROOT" in */shotgate|*/shotgate/) ;; *) echo "shotgate_gc:根目录不是 shotgate($ROOT),不动"; exit 2;; esac
case "$DAYS" in ''|*[!0-9]*) echo "shotgate_gc:天数不是整数($DAYS),不动"; exit 2;; esac
case "$ROOT" in */shotgate|*/shotgate/) ;; *) echo "shotgate_gc:根目录不是 shotgate(${ROOT}),不动"; exit 2;; esac
case "$DAYS" in ''|*[!0-9]*) echo "shotgate_gc:天数不是整数(${DAYS}),不动"; exit 2;; esac
[ -d "$ROOT" ] || exit 0
n=0
while IFS= read -r d; do
+1 -1
View File
@@ -77,6 +77,6 @@ if [ "$host_status" -eq 0 ] && [ "$assert_status" -eq 0 ]; then
echo "TOUCHCHAIN $CASE OK 用时 $((SECONDS - START)) 秒"
exit 0
fi
echo "【红】touchchain $CASE:host=$host_status assert=$assert_status;局目录:$RUN" >&2
echo "【红】touchchain ${CASE}:host=$host_status assert=${assert_status};局目录:$RUN" >&2
echo "TOUCHCHAIN $CASE RED 用时 $((SECONDS - START)) 秒"
exit 1