Compare commits
3
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ccf9359e31 | ||
|
|
97903d55f4 | ||
|
|
feb66fd863 |
@@ -109,8 +109,7 @@ applying the patches, then stages `buildroot/files/` and applies
|
||||
a copy of the base tree and runs the android-tools rule of the Makefile under
|
||||
make. It checks the adbd TCP listener removal (flare-edge#3129), the rule's
|
||||
fail-closed behaviour (bfe-core1106-sdk#45) and the adbd rebuild gate as the
|
||||
Makefile evaluates it, including a changed source tarball (bfe-core1106-sdk#44,
|
||||
#46, #49). `BASE_DIR` is the luckfox base
|
||||
Makefile evaluates it (bfe-core1106-sdk#44, #46). `BASE_DIR` is the luckfox base
|
||||
commit 824b817f8, `sysdrv/tools/board/android-tools` only:
|
||||
|
||||
git -C <luckfox-sdk> archive 824b817f8 sysdrv/tools/board/android-tools | tar -C BASE_DIR -xf -
|
||||
@@ -120,7 +119,7 @@ commit 824b817f8, `sysdrv/tools/board/android-tools` only:
|
||||
The toolchain is a stub: the compiler stub only creates its output file, so
|
||||
nothing is compiled. Run the test with `none` as the patch file to see the base
|
||||
fail. `adbd-no-tcp-cases.sh` runs the real patch (must pass), the unpatched base
|
||||
and four mutants of the patch (each must fail for the reason it names).
|
||||
and three mutants of the patch (each must fail for the reason it names).
|
||||
|
||||
## Completeness check
|
||||
|
||||
@@ -327,8 +326,8 @@ calls from the device half of `adb_main()` and runs last in
|
||||
It also changes the Makefile gate. adbd was rebuilt only when `out/usr/bin/adbd`
|
||||
was missing, so a patch-set change never reached an SDK tree that already held
|
||||
the binary (bfe-core1106-sdk#44). `adbd-current.sh` now compares a stamp in
|
||||
`out/.adbd-inputs` with a hash of the Makefile, the gate script, the patch set
|
||||
and the two adbd source tarballs, and the build writes that stamp.
|
||||
`out/.adbd-inputs` with a hash of the Makefile, the gate script and the patch
|
||||
set, and the build writes that stamp.
|
||||
|
||||
The rule now stops at the first failed step (a debian series entry, an
|
||||
`android-tools.patch.sh` step run with `-e`, the build, or the copy into
|
||||
|
||||
@@ -15,8 +15,8 @@ It also closes a build gap (bfe-core1106-sdk#44). The Makefile rebuilt adbd
|
||||
only when out/usr/bin/adbd was missing, so a patch-set change never reached an
|
||||
image built on an SDK tree that already held the binary. The Makefile now
|
||||
gates adbd on adbd-current.sh: the build writes a stamp holding a hash of the
|
||||
Makefile, the gate script, the patch set and the two adbd source tarballs, and
|
||||
a missing or stale stamp rebuilds adbd (bfe-core1106-sdk#49).
|
||||
Makefile, the gate script and the patch set, and a missing or stale stamp
|
||||
rebuilds adbd.
|
||||
|
||||
The rule stops at the first failed step: a debian series entry, an
|
||||
android-tools.patch.sh step (run with -e), the build, or the copy into
|
||||
@@ -25,12 +25,12 @@ the patch set gets one (bfe-core1106-sdk#45).
|
||||
|
||||
Regression tests: luckfox-sdk-patches/tests/test-adbd-no-tcp.sh runs the rule
|
||||
under make with stub toolchains. It checks the listeners, the fail-closed
|
||||
cases, the stamp, a source tarball change and the gate that the Makefile
|
||||
evaluates (bfe-core1106-sdk#46, #49). tests/adbd-no-tcp-cases.sh runs the real
|
||||
patch, the unpatched base and mutants that must fail.
|
||||
cases, the stamp and the gate that the Makefile evaluates (bfe-core1106-sdk#46).
|
||||
tests/adbd-no-tcp-cases.sh runs the real patch, the unpatched base and mutants
|
||||
that must fail.
|
||||
|
||||
diff --git a/sysdrv/tools/board/android-tools/Makefile b/sysdrv/tools/board/android-tools/Makefile
|
||||
index bb72255..7ec24f7 100644
|
||||
index bb72255..889e983 100644
|
||||
--- a/sysdrv/tools/board/android-tools/Makefile
|
||||
+++ b/sysdrv/tools/board/android-tools/Makefile
|
||||
@@ -23,6 +23,15 @@ PKG_TARBALL_DEBIAN := android-tools_4.2.2+git20130218-3ubuntu41.debian.tar.gz
|
||||
@@ -38,13 +38,13 @@ index bb72255..7ec24f7 100644
|
||||
PKG_INSTALL_BIN_DIR := $(CURRENT_DIR)/$(PKG_BIN)/usr/bin
|
||||
|
||||
+# flare-edge#3129: adbd is rebuilt whenever its inputs change. The stamp holds
|
||||
+# the hash of this Makefile, adbd-current.sh, the android-tools patch set and
|
||||
+# the two adbd source tarballs. An adbd without a matching stamp (left in out/
|
||||
+# by a build from other inputs) is built again from the regenerated source.
|
||||
+# The series, patch, build and copy steps stop the rule on failure; the stamp is
|
||||
+# written last, so no binary that was not built from these inputs gets one (bfe-core1106-sdk#45).
|
||||
+# the hash of this Makefile, adbd-current.sh and the android-tools patch set.
|
||||
+# An adbd without a matching stamp (left in out/ by a build from other patches)
|
||||
+# is built again from the regenerated source. Every step below stops the rule
|
||||
+# when it fails, and the stamp is written last, so no binary that was not built
|
||||
+# from the patch set gets one (bfe-core1106-sdk#45).
|
||||
+ADBD_STAMP := $(CURRENT_DIR)/$(PKG_BIN)/.adbd-inputs
|
||||
+ADBD_INPUTS := $(shell cat $(CURRENT_DIR)/Makefile $(CURRENT_DIR)/adbd-current.sh $(CURRENT_DIR)/$(PKG_PATCHES_ANDROID_TOOLS)/* $(CURRENT_DIR)/$(PKG_TARBALL_ANDROID_TOOLS) $(CURRENT_DIR)/$(PKG_TARBALL_DEBIAN) | sha256sum | cut -d' ' -f1)
|
||||
+ADBD_INPUTS := $(shell cat $(CURRENT_DIR)/Makefile $(CURRENT_DIR)/adbd-current.sh $(CURRENT_DIR)/$(PKG_PATCHES_ANDROID_TOOLS)/* | sha256sum | cut -d' ' -f1)
|
||||
+
|
||||
PKG_DEP_OPENSSL := $(CURRENT_DIR)/../toolkits/openssl
|
||||
PKG_DEP_ZLIB := $(CURRENT_DIR)/../toolkits/zlib
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
# adbd-no-tcp-cases.sh BASE_DIR PATCH_FILE
|
||||
#
|
||||
# Runs test-adbd-no-tcp.sh on the real patch (must PASS), on the unpatched base
|
||||
# (must FAIL), and on four mutants of the patch. Each mutant must FAIL, and its
|
||||
# (must FAIL), and on three mutants of the patch. Each mutant must FAIL, and its
|
||||
# FAIL line must name the reason given here:
|
||||
# gate-makefile-only ADBD_INPUTS hashes only the Makefile; the patch set and
|
||||
# the gate script are dropped (bfe-core1106-sdk#46)
|
||||
@@ -10,8 +10,6 @@
|
||||
# so a failed 0017 hunk still stamps adbd (bfe-core1106-sdk#45)
|
||||
# copy-unchecked only the copy into out/usr/bin is unchecked, so a failed
|
||||
# copy still writes the stamp (bfe-core1106-sdk#45)
|
||||
# gate-no-tarballs ADBD_INPUTS drops the two source tarballs, so a changed
|
||||
# tarball keeps a stale adbd (bfe-core1106-sdk#49)
|
||||
# Usage and layout: see test-adbd-no-tcp.sh.
|
||||
# Exit 0 when every case behaves as expected, 1 otherwise, 2 on usage.
|
||||
set -u
|
||||
@@ -76,10 +74,6 @@ cat > "$WORK/copy-unchecked.sed" <<'SEDEOF'
|
||||
}
|
||||
SEDEOF
|
||||
|
||||
cat > "$WORK/gate-no-tarballs.sed" <<'SEDEOF'
|
||||
s#^+ADBD_INPUTS := .*$#+ADBD_INPUTS := $(shell cat $(CURRENT_DIR)/Makefile $(CURRENT_DIR)/adbd-current.sh $(CURRENT_DIR)/$(PKG_PATCHES_ANDROID_TOOLS)/* | sha256sum | cut -d' ' -f1)#
|
||||
SEDEOF
|
||||
|
||||
expect 0 "real patch" "$PATCH"
|
||||
expect 1 "unpatched base" none
|
||||
if mutant gate-makefile-only; then
|
||||
@@ -98,12 +92,6 @@ else
|
||||
bad "mutant copy-unchecked does not change the patch"
|
||||
fi
|
||||
|
||||
if mutant gate-no-tarballs; then
|
||||
expect 1 "mutant gate-no-tarballs" "$WORK/gate-no-tarballs.patch" "ADBD_INPUTS is"
|
||||
else
|
||||
bad "mutant gate-no-tarballs does not change the patch"
|
||||
fi
|
||||
|
||||
if [ "$fail" = 0 ]; then
|
||||
echo "RESULT PASS"
|
||||
exit 0
|
||||
|
||||
@@ -5,8 +5,7 @@
|
||||
# 127.0.0.1:5037), bfe-core1106-sdk#44 (a change to the adbd patch set never
|
||||
# reached the image), bfe-core1106-sdk#45 (a failed patch or copy step still
|
||||
# stamped adbd current) and bfe-core1106-sdk#46 (the gate was tested by a copy
|
||||
# of its formula instead of by the Makefile) and bfe-core1106-sdk#49 (a changed
|
||||
# source tarball did not rebuild adbd).
|
||||
# of its formula instead of by the Makefile).
|
||||
#
|
||||
# BASE_DIR holds sysdrv/tools/board/android-tools at the luckfox base commit
|
||||
# 824b817f8, as in the vendor checkout:
|
||||
@@ -155,16 +154,16 @@ else
|
||||
fi
|
||||
|
||||
# 4. The gate, as the Makefile evaluates it: ADBD_INPUTS must be the sha256 of
|
||||
# the Makefile, adbd-current.sh, the patch set and the two adbd source
|
||||
# tarballs, the five inputs that the stamp must match.
|
||||
# the Makefile, adbd-current.sh and the patch set, the three inputs that the
|
||||
# stamp must match.
|
||||
# shellcheck disable=SC2016 # the make text must reach make unexpanded
|
||||
printf '%s\n' '$(info ADBD_INPUTS=$(ADBD_INPUTS))' > "$WORK/probe.mk" || exit 2
|
||||
probe=$(cd "$GOOD" && make -s -f Makefile -f "$WORK/probe.mk" SYSDRV_PARAM=/dev/null no-such-target 2>/dev/null | sed -n 's/^ADBD_INPUTS=//p')
|
||||
want=$(cd "$AT" && cat Makefile adbd-current.sh android-tools-patches/* android-tools_4.2.2+git20130218.orig.tar.xz android-tools_4.2.2+git20130218-3ubuntu41.debian.tar.gz 2>/dev/null | sha256sum | cut -d' ' -f1)
|
||||
want=$(cd "$AT" && cat Makefile adbd-current.sh android-tools-patches/* 2>/dev/null | sha256sum | cut -d' ' -f1)
|
||||
if [ -n "$probe" ] && [ "$probe" = "$want" ]; then
|
||||
pass "ADBD_INPUTS is the sha256 of Makefile, adbd-current.sh, the patch set and the source tarballs"
|
||||
pass "ADBD_INPUTS is the sha256 of Makefile, adbd-current.sh and the patch set"
|
||||
else
|
||||
bad "ADBD_INPUTS is '$probe', want '$want' (sha256 of Makefile, adbd-current.sh, the patch set and the source tarballs)"
|
||||
bad "ADBD_INPUTS is '$probe', want '$want' (sha256 of Makefile, adbd-current.sh and the patch set)"
|
||||
fi
|
||||
|
||||
# 5. The rule itself: a matching stamp with adbd present skips the build, and a
|
||||
@@ -195,26 +194,6 @@ else
|
||||
bad "rule did not rebuild adbd without a stamp (rc $RC, compiler runs $CC_RUNS)"
|
||||
fi
|
||||
|
||||
# 5b. The source tarballs are inputs too: a changed tarball must rebuild adbd
|
||||
# when the Makefile, the gate script and the patch set are unchanged.
|
||||
D=$(case_at tarball) || exit 2
|
||||
run_make "$D" "$WORK/tarball-built.log"
|
||||
first_built=0
|
||||
if [ "$RC" = 0 ] && [ "$CC_RUNS" -gt 0 ]; then first_built=1; fi
|
||||
t=$D/android-tools_4.2.2+git20130218-3ubuntu41.debian.tar.gz
|
||||
tb=$WORK/tarball-edit
|
||||
rm -rf "$tb" && mkdir -p "$tb" || exit 2
|
||||
if [ "$first_built" = 1 ] && tar -xzf "$t" -C "$tb" && : > "$tb/debian/.tarball-changed" && tar -czf "$t.new" -C "$tb" debian && mv "$t.new" "$t"; then
|
||||
run_make "$D" "$WORK/tarball.log"
|
||||
if [ "$RC" = 0 ] && [ "$CC_RUNS" -gt 0 ]; then
|
||||
pass "rule rebuilds adbd when a source tarball changes"
|
||||
else
|
||||
bad "rule did not rebuild adbd after a source tarball change (rc $RC, compiler runs $CC_RUNS)"
|
||||
fi
|
||||
else
|
||||
bad "could not build the tarball case (first build or tarball edit failed)"
|
||||
fi
|
||||
|
||||
# 6. Fail closed. An injected failure must stop the rule with a non-zero status
|
||||
# and leave no stamp. The failures before the compile step must also stop the
|
||||
# rule before the compiler runs.
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
# VOP pixel clock bench helpers (bfe-core1106-sdk#43)
|
||||
|
||||
Helpers for the bench proof of the CPLL 900 MHz clock plan. They run on a Warden panel
|
||||
(busybox sh), read-only except for the UI workload, and need the panel's warden-ui test
|
||||
hook (FIFO `/tmp/warden-ui.ctl`).
|
||||
|
||||
- `vopcheck.sh candidate|baseline`: reads clk_summary and the eth0 carrier. Candidate expects
|
||||
pll_cpll 900000000, dclk_vop 30000000, clk_50m_src 50000000, clk_100m_src 100000000,
|
||||
aclk_ddr_root 450000000 and clk_250m_src 225000000. Baseline expects pll_cpll 1000000000 and
|
||||
dclk_vop 31250000. Exit 0 when all rows pass.
|
||||
- `uirun.sh LABEL SECONDS`: fixed UI workload (wake, nav, two scrolls, home), one `stats` read
|
||||
after each action. Writes `/tmp/vop-ui-LABEL.csv` and `.log` on the panel.
|
||||
- `gic121.sh`: VOP frame-start count (GIC 121) in three-second windows, with INTR_EN0 and
|
||||
DSP_CTRL0 read only. `WINDOWS=n` sets the number of windows.
|
||||
- `summarize.py FILE...`: render_ms and render_max_ms statistics for each CSV
|
||||
(`python3 -I summarize.py`).
|
||||
|
||||
Run a helper with `sh /tmp/<name>.sh` after copying it to the panel. Hold the panel's bench
|
||||
lock for the whole run (`bench-lock run --class SOAK` for a workload).
|
||||
Executable
+13
@@ -0,0 +1,13 @@
|
||||
#!/bin/sh
|
||||
# gic121.sh: VOP frame-start count (GIC 121) over three 3 s windows, read-only (no UI verbs, INTR_EN0 untouched).
|
||||
cnt() { awk '/GIC-0 121 /{s=0; for(i=2;i<=NF;i++){ if($i ~ /^[0-9]+$/){s+=$i} else break }; print s; exit}' /proc/interrupts; }
|
||||
bl=$(cat /sys/class/backlight/*/bl_power 2>/dev/null | head -1); br=$(cat /sys/class/backlight/*/brightness 2>/dev/null | head -1)
|
||||
echo "backlight bl_power=$bl brightness=$br"
|
||||
echo "INTR_EN0=$(devmem 0xff990034 2>/dev/null) DSP_CTRL0=$(devmem 0xff990020 2>/dev/null)"
|
||||
i=1
|
||||
while [ $i -le ${WINDOWS:-3} ]; do
|
||||
c1=$(cnt); t1=$(cut -d' ' -f1 /proc/uptime); sleep 3; c2=$(cnt); t2=$(cut -d' ' -f1 /proc/uptime)
|
||||
echo "window $i: count=$((c2-c1)) span=$(awk -v a=$t1 -v b=$t2 'BEGIN{printf "%.3f", b-a}') s rate=$(awk -v d=$((c2-c1)) -v a=$t1 -v b=$t2 'BEGIN{printf "%.2f", d/(b-a)}')/s"
|
||||
i=$((i+1))
|
||||
done
|
||||
echo "GIC121DONE"
|
||||
Executable
+42
@@ -0,0 +1,42 @@
|
||||
"""Summarize one UI-run CSV: stats samples per action and overall (python3 -I summarize.py FILE...)."""
|
||||
import csv
|
||||
import statistics
|
||||
import sys
|
||||
|
||||
|
||||
def num(v):
|
||||
try:
|
||||
return float(v)
|
||||
except (TypeError, ValueError):
|
||||
return None
|
||||
|
||||
|
||||
def summarize(path):
|
||||
rows = list(csv.DictReader(open(path, encoding="ascii")))
|
||||
ok = [r for r in rows if num(r["render_ms"]) is not None and num(r["render_max_ms"]) is not None]
|
||||
busy = [r for r in ok if (num(r["fps"]) or 0) > 0]
|
||||
rmax = [num(r["render_max_ms"]) for r in ok]
|
||||
rms = [num(r["render_ms"]) for r in busy]
|
||||
fps = [num(r["fps"]) for r in busy]
|
||||
out = {
|
||||
"file": path,
|
||||
"samples": len(rows),
|
||||
"parsed": len(ok),
|
||||
"busy_windows": len(busy),
|
||||
"fps_mean": round(statistics.mean(fps), 2) if fps else None,
|
||||
"render_ms_mean_busy": round(statistics.mean(rms), 3) if rms else None,
|
||||
"render_ms_p95_busy": round(sorted(rms)[int(0.95 * (len(rms) - 1))], 3) if rms else None,
|
||||
"render_max_ms_max": round(max(rmax), 2) if rmax else None,
|
||||
"render_max_ms_p95": round(sorted(rmax)[int(0.95 * (len(rmax) - 1))], 2) if rmax else None,
|
||||
"render_max_ms_mean": round(statistics.mean(rmax), 3) if rmax else None,
|
||||
}
|
||||
per = {}
|
||||
for r in ok:
|
||||
per.setdefault(r["action"], []).append(num(r["render_max_ms"]))
|
||||
out["render_max_by_action"] = {a: round(max(v), 2) for a, v in per.items()}
|
||||
return out
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
for p in sys.argv[1:]:
|
||||
print(summarize(p))
|
||||
Executable
+27
@@ -0,0 +1,27 @@
|
||||
#!/bin/sh
|
||||
# uirun.sh LABEL SECONDS: fixed UI workload for SECONDS. Each action is followed by one stats read.
|
||||
LABEL=$1; DUR=$2
|
||||
OUT=/tmp/vop-ui-$LABEL.csv; LOG=/tmp/vop-ui-$LABEL.log
|
||||
ui() { rm -f /tmp/warden-ui.dbg; printf '%s\n' "$1" > /tmp/warden-ui.ctl; n=0; while [ ! -s /tmp/warden-ui.dbg ] && [ $n -lt 100 ]; do sleep 0.05; n=$((n+1)); done; cat /tmp/warden-ui.dbg 2>/dev/null; }
|
||||
key() { printf '%s\n' "$1" | awk -F': ' -v k="$2" '$1==k {print $2; exit}' | awk '{print $1}' | tr -d '%'; }
|
||||
pid0=$(pidof warden-ui 2>/dev/null); echo "start uptime=$(cut -d' ' -f1 /proc/uptime) warden-ui=$pid0" > $LOG
|
||||
dmesg | grep -i -E 'ddr|axi|vop|rga|error|fail|underflow|oops|bug|warn|timeout' | wc -l > /tmp/vop-dmesg-$LABEL.before
|
||||
echo "uptime_s,action,reply1,page,cpu,fps,render_ms,render_max_ms,idle,memavail_kb" > $OUT
|
||||
start=$(cut -d' ' -f1 /proc/uptime); cycles=0
|
||||
while :; do
|
||||
now=$(cut -d' ' -f1 /proc/uptime)
|
||||
done_=$(awk -v a=$start -v b=$now -v d=$DUR 'BEGIN{print (b-a>=d)?1:0}')
|
||||
[ "$done_" = 1 ] && break
|
||||
for act in "wake" "nav settings/system" "scroll 360 300 300" "scroll 360 300 -300" "home"; do
|
||||
r1=$(ui "$act" | head -1 | tr ',' ';')
|
||||
sleep 1.2
|
||||
s=$(ui stats)
|
||||
page=$(key "$s" page); cpu=$(key "$s" cpu); fps=$(key "$s" fps); rms=$(key "$s" render); rmax=$(key "$s" render_max); idle=$(key "$s" idle); mem=$(key "$s" memavail)
|
||||
echo "$(cut -d' ' -f1 /proc/uptime),$act,$r1,$page,$cpu,$fps,$rms,$rmax,$idle,$mem" >> $OUT
|
||||
sleep 0.3
|
||||
done
|
||||
cycles=$((cycles+1)); sleep 1
|
||||
done
|
||||
echo "end uptime=$(cut -d' ' -f1 /proc/uptime) warden-ui=$(pidof warden-ui 2>/dev/null) cycles=$cycles" >> $LOG
|
||||
dmesg | grep -i -E 'ddr|axi|vop|rga|error|fail|underflow|oops|bug|warn|timeout' | wc -l > /tmp/vop-dmesg-$LABEL.after
|
||||
echo "DONE $LABEL" >> $LOG
|
||||
Executable
+23
@@ -0,0 +1,23 @@
|
||||
#!/bin/sh
|
||||
# vopcheck.sh MODE (candidate|baseline): read-only clock plan and eth0 check on a bench panel.
|
||||
MODE=${1:-candidate}
|
||||
CS=/sys/kernel/debug/clk/clk_summary
|
||||
rate() { awk -v n="$1" '$1==n {print $5; exit}' $CS; }
|
||||
fail=0
|
||||
chk() { if [ "$3" = "$2" ]; then echo "PASS $1 = $3"; else echo "FAIL $1 = $3 (want $2)"; fail=1; fi; }
|
||||
if [ "$MODE" = candidate ]; then
|
||||
chk pll_cpll 900000000 "$(rate pll_cpll)"
|
||||
chk dclk_vop_src 30000000 "$(rate dclk_vop_src)"
|
||||
chk dclk_vop 30000000 "$(rate dclk_vop)"
|
||||
chk clk_50m_src 50000000 "$(rate clk_50m_src)"
|
||||
chk clk_100m_src 100000000 "$(rate clk_100m_src)"
|
||||
chk aclk_ddr_root 450000000 "$(rate aclk_ddr_root)"
|
||||
chk clk_250m_src 225000000 "$(rate clk_250m_src)"
|
||||
else
|
||||
chk pll_cpll 1000000000 "$(rate pll_cpll)"
|
||||
chk dclk_vop 31250000 "$(rate dclk_vop)"
|
||||
fi
|
||||
carrier=$(cat /sys/class/net/eth0/carrier 2>/dev/null)
|
||||
if [ "$carrier" = 1 ]; then echo "PASS eth0 carrier=1 speed=$(cat /sys/class/net/eth0/speed 2>/dev/null)"; else echo "FAIL eth0 carrier=$carrier"; fail=1; fi
|
||||
echo "VOPCHECK mode=$MODE release=$(sed -n 's/.*GIT_COMMIT=\([^ ]*\).*/\1/p' /etc/warden-release) rc=$fail"
|
||||
exit $fail
|
||||
Reference in New Issue
Block a user