adbd gate: stamp covers the android-tools source tarballs (bfe-core1106-sdk#49) [skip ci]
ADBD_INPUTS hashed the Makefile, adbd-current.sh and the android-tools patch set. The rule also extracts both adbd source tarballs and builds adbd from them, so a tarball change alone matched the stamp and a warm SDK tree kept an adbd built from the old source. This is the failure class of bfe-core1106-sdk#44. ADBD_INPUTS now also hashes the .orig.tar.xz and the debian tarball. test-adbd-no-tcp.sh checks the new formula and that a changed debian tarball rebuilds adbd. adbd-no-tcp-cases.sh gains a mutant that drops the tarballs, which must fail on the formula. The README and the 0015 description match. The patched adbd source is unchanged: with the old and the new board patch the android-tools rule produces identical source trees (build output excluded), and the top-level Makefile differs only in the gate comment and ADBD_INPUTS. The adbd binary proven on bench panel 10.255.1.53 (md5 970416893fa96430a5885c9297719482) therefore still holds for this head. Fixes #49 Refs #44, #45, #46, flare-edge#3129 Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01B1W6qGNpGNtFT7nhShpH56
This commit is contained in:
co-authored by
Claude Haiku 5.5
parent
d1011ce9d8
commit
3baa28a20e
@@ -109,7 +109,8 @@ 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
|
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
|
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
|
fail-closed behaviour (bfe-core1106-sdk#45) and the adbd rebuild gate as the
|
||||||
Makefile evaluates it (bfe-core1106-sdk#44, #46). `BASE_DIR` is the luckfox base
|
Makefile evaluates it, including a changed source tarball (bfe-core1106-sdk#44,
|
||||||
|
#46, #49). `BASE_DIR` is the luckfox base
|
||||||
commit 824b817f8, `sysdrv/tools/board/android-tools` only:
|
commit 824b817f8, `sysdrv/tools/board/android-tools` only:
|
||||||
|
|
||||||
git -C <luckfox-sdk> archive 824b817f8 sysdrv/tools/board/android-tools | tar -C BASE_DIR -xf -
|
git -C <luckfox-sdk> archive 824b817f8 sysdrv/tools/board/android-tools | tar -C BASE_DIR -xf -
|
||||||
@@ -119,7 +120,7 @@ commit 824b817f8, `sysdrv/tools/board/android-tools` only:
|
|||||||
The toolchain is a stub: the compiler stub only creates its output file, so
|
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
|
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
|
fail. `adbd-no-tcp-cases.sh` runs the real patch (must pass), the unpatched base
|
||||||
and three mutants of the patch (each must fail for the reason it names).
|
and four mutants of the patch (each must fail for the reason it names).
|
||||||
|
|
||||||
## Completeness check
|
## Completeness check
|
||||||
|
|
||||||
@@ -326,8 +327,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`
|
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
|
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
|
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 and the patch
|
`out/.adbd-inputs` with a hash of the Makefile, the gate script, the patch set
|
||||||
set, and the build writes that stamp.
|
and the two adbd source tarballs, and the build writes that stamp.
|
||||||
|
|
||||||
The rule now stops at the first failed step (a debian series entry, an
|
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
|
`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
|
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
|
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
|
gates adbd on adbd-current.sh: the build writes a stamp holding a hash of the
|
||||||
Makefile, the gate script and the patch set, and a missing or stale stamp
|
Makefile, the gate script, the patch set and the two adbd source tarballs, and
|
||||||
rebuilds adbd.
|
a missing or stale stamp rebuilds adbd (bfe-core1106-sdk#49).
|
||||||
|
|
||||||
The rule stops at the first failed step: a debian series entry, an
|
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
|
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
|
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
|
under make with stub toolchains. It checks the listeners, the fail-closed
|
||||||
cases, the stamp and the gate that the Makefile evaluates (bfe-core1106-sdk#46).
|
cases, the stamp, a source tarball change and the gate that the Makefile
|
||||||
tests/adbd-no-tcp-cases.sh runs the real patch, the unpatched base and mutants
|
evaluates (bfe-core1106-sdk#46, #49). tests/adbd-no-tcp-cases.sh runs the real
|
||||||
that must fail.
|
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
|
diff --git a/sysdrv/tools/board/android-tools/Makefile b/sysdrv/tools/board/android-tools/Makefile
|
||||||
index bb72255..889e983 100644
|
index bb72255..5f425ec 100644
|
||||||
--- a/sysdrv/tools/board/android-tools/Makefile
|
--- a/sysdrv/tools/board/android-tools/Makefile
|
||||||
+++ b/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
|
@@ -23,6 +23,15 @@ PKG_TARBALL_DEBIAN := android-tools_4.2.2+git20130218-3ubuntu41.debian.tar.gz
|
||||||
@@ -38,13 +38,13 @@ index bb72255..889e983 100644
|
|||||||
PKG_INSTALL_BIN_DIR := $(CURRENT_DIR)/$(PKG_BIN)/usr/bin
|
PKG_INSTALL_BIN_DIR := $(CURRENT_DIR)/$(PKG_BIN)/usr/bin
|
||||||
|
|
||||||
+# flare-edge#3129: adbd is rebuilt whenever its inputs change. The stamp holds
|
+# flare-edge#3129: adbd is rebuilt whenever its inputs change. The stamp holds
|
||||||
+# the hash of this Makefile, adbd-current.sh and the android-tools patch set.
|
+# the hash of this Makefile, adbd-current.sh, the android-tools patch set and
|
||||||
+# An adbd without a matching stamp (left in out/ by a build from other patches)
|
+# the two adbd source tarballs. An adbd without a matching stamp (left in out/
|
||||||
+# is built again from the regenerated source. Every step below stops the rule
|
+# by a build from other inputs) is built again from the regenerated source.
|
||||||
+# when it fails, and the stamp is written last, so no binary that was not built
|
+# Every step below stops the rule when it fails; the stamp is written last, so
|
||||||
+# from the patch set gets one (bfe-core1106-sdk#45).
|
+# no binary that was not built from these inputs gets one (bfe-core1106-sdk#45).
|
||||||
+ADBD_STAMP := $(CURRENT_DIR)/$(PKG_BIN)/.adbd-inputs
|
+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)/* | sha256sum | cut -d' ' -f1)
|
+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)
|
||||||
+
|
+
|
||||||
PKG_DEP_OPENSSL := $(CURRENT_DIR)/../toolkits/openssl
|
PKG_DEP_OPENSSL := $(CURRENT_DIR)/../toolkits/openssl
|
||||||
PKG_DEP_ZLIB := $(CURRENT_DIR)/../toolkits/zlib
|
PKG_DEP_ZLIB := $(CURRENT_DIR)/../toolkits/zlib
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
# adbd-no-tcp-cases.sh BASE_DIR PATCH_FILE
|
# 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
|
# Runs test-adbd-no-tcp.sh on the real patch (must PASS), on the unpatched base
|
||||||
# (must FAIL), and on three mutants of the patch. Each mutant must FAIL, and its
|
# (must FAIL), and on four mutants of the patch. Each mutant must FAIL, and its
|
||||||
# FAIL line must name the reason given here:
|
# FAIL line must name the reason given here:
|
||||||
# gate-makefile-only ADBD_INPUTS hashes only the Makefile; the patch set and
|
# gate-makefile-only ADBD_INPUTS hashes only the Makefile; the patch set and
|
||||||
# the gate script are dropped (bfe-core1106-sdk#46)
|
# the gate script are dropped (bfe-core1106-sdk#46)
|
||||||
@@ -10,6 +10,8 @@
|
|||||||
# so a failed 0017 hunk still stamps adbd (bfe-core1106-sdk#45)
|
# 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-unchecked only the copy into out/usr/bin is unchecked, so a failed
|
||||||
# copy still writes the stamp (bfe-core1106-sdk#45)
|
# 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.
|
# Usage and layout: see test-adbd-no-tcp.sh.
|
||||||
# Exit 0 when every case behaves as expected, 1 otherwise, 2 on usage.
|
# Exit 0 when every case behaves as expected, 1 otherwise, 2 on usage.
|
||||||
set -u
|
set -u
|
||||||
@@ -74,6 +76,10 @@ cat > "$WORK/copy-unchecked.sed" <<'SEDEOF'
|
|||||||
}
|
}
|
||||||
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 0 "real patch" "$PATCH"
|
||||||
expect 1 "unpatched base" none
|
expect 1 "unpatched base" none
|
||||||
if mutant gate-makefile-only; then
|
if mutant gate-makefile-only; then
|
||||||
@@ -92,6 +98,12 @@ else
|
|||||||
bad "mutant copy-unchecked does not change the patch"
|
bad "mutant copy-unchecked does not change the patch"
|
||||||
fi
|
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
|
if [ "$fail" = 0 ]; then
|
||||||
echo "RESULT PASS"
|
echo "RESULT PASS"
|
||||||
exit 0
|
exit 0
|
||||||
|
|||||||
@@ -5,7 +5,8 @@
|
|||||||
# 127.0.0.1:5037), bfe-core1106-sdk#44 (a change to the adbd patch set never
|
# 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
|
# 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
|
# stamped adbd current) and bfe-core1106-sdk#46 (the gate was tested by a copy
|
||||||
# of its formula instead of by the Makefile).
|
# of its formula instead of by the Makefile) and bfe-core1106-sdk#49 (a changed
|
||||||
|
# source tarball did not rebuild adbd).
|
||||||
#
|
#
|
||||||
# BASE_DIR holds sysdrv/tools/board/android-tools at the luckfox base commit
|
# BASE_DIR holds sysdrv/tools/board/android-tools at the luckfox base commit
|
||||||
# 824b817f8, as in the vendor checkout:
|
# 824b817f8, as in the vendor checkout:
|
||||||
@@ -154,16 +155,16 @@ else
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# 4. The gate, as the Makefile evaluates it: ADBD_INPUTS must be the sha256 of
|
# 4. The gate, as the Makefile evaluates it: ADBD_INPUTS must be the sha256 of
|
||||||
# the Makefile, adbd-current.sh and the patch set, the three inputs that the
|
# the Makefile, adbd-current.sh, the patch set and the two adbd source
|
||||||
# stamp must match.
|
# tarballs, the five inputs that the stamp must match.
|
||||||
# shellcheck disable=SC2016 # the make text must reach make unexpanded
|
# shellcheck disable=SC2016 # the make text must reach make unexpanded
|
||||||
printf '%s\n' '$(info ADBD_INPUTS=$(ADBD_INPUTS))' > "$WORK/probe.mk" || exit 2
|
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')
|
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/* 2>/dev/null | sha256sum | cut -d' ' -f1)
|
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)
|
||||||
if [ -n "$probe" ] && [ "$probe" = "$want" ]; then
|
if [ -n "$probe" ] && [ "$probe" = "$want" ]; then
|
||||||
pass "ADBD_INPUTS is the sha256 of Makefile, adbd-current.sh and the patch set"
|
pass "ADBD_INPUTS is the sha256 of Makefile, adbd-current.sh, the patch set and the source tarballs"
|
||||||
else
|
else
|
||||||
bad "ADBD_INPUTS is '$probe', want '$want' (sha256 of Makefile, adbd-current.sh and the patch set)"
|
bad "ADBD_INPUTS is '$probe', want '$want' (sha256 of Makefile, adbd-current.sh, the patch set and the source tarballs)"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# 5. The rule itself: a matching stamp with adbd present skips the build, and a
|
# 5. The rule itself: a matching stamp with adbd present skips the build, and a
|
||||||
@@ -194,6 +195,26 @@ else
|
|||||||
bad "rule did not rebuild adbd without a stamp (rc $RC, compiler runs $CC_RUNS)"
|
bad "rule did not rebuild adbd without a stamp (rc $RC, compiler runs $CC_RUNS)"
|
||||||
fi
|
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
|
# 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
|
# and leave no stamp. The failures before the compile step must also stop the
|
||||||
# rule before the compiler runs.
|
# rule before the compiler runs.
|
||||||
|
|||||||
Reference in New Issue
Block a user