android-ci: fix the cuprate marker gate failing its own green build
Run 406 built the APK successfully (BUILD SUCCESSFUL in 44m 7s) and the gate then
reported "the cuprate-daemon feature is NOT in this APK" while the line above it
printed `target_max_memory` **5** times. The bug is the classic one:
strings -a x.so | grep -q pattern # under `set -o pipefail`
`grep -q` exits at the first match and closes the pipe; `strings` takes SIGPIPE
(141) and pipefail makes the pipeline status non-zero, so `if ! ...` ran. The count
is captured into a variable now (grep -c reads the whole stream, no SIGPIPE) and the
gate fails on `< 1`, which is what it always meant.
This commit is contained in:
parent
adcf52b8e4
commit
9afa22a0bf
1 changed files with 7 additions and 2 deletions
|
|
@ -184,8 +184,13 @@ jobs:
|
||||||
# claims to. A missing marker fails the job: an APK whose on-device node
|
# claims to. A missing marker fails the job: an APK whose on-device node
|
||||||
# can only fail is the regression this gate exists to catch.
|
# can only fail is the regression this gate exists to catch.
|
||||||
unzip -p "$apk" "lib/$abi/libonionwire_sdk.so" > /tmp/libonionwire_sdk.so
|
unzip -p "$apk" "lib/$abi/libonionwire_sdk.so" > /tmp/libonionwire_sdk.so
|
||||||
strings -a /tmp/libonionwire_sdk.so | grep -c 'target_max_memory' || true
|
# `grep -c`, deliberately not `grep -q`: under `set -o pipefail` a `-q`
|
||||||
if ! strings -a /tmp/libonionwire_sdk.so | grep -q 'target_max_memory'; then
|
# match closes the pipe early, `strings` dies on SIGPIPE (141), and the
|
||||||
|
# pipeline then reports failure even though the marker was there — this
|
||||||
|
# gate failed its own green build once that way.
|
||||||
|
marker="$(strings -a /tmp/libonionwire_sdk.so | grep -c 'target_max_memory' || true)"
|
||||||
|
echo "target_max_memory occurrences: ${marker:-0}"
|
||||||
|
if [ "${marker:-0}" -lt 1 ]; then
|
||||||
echo "lib/$abi/libonionwire_sdk.so carries no cuprated config string: the cuprate-daemon feature is NOT in this APK" >&2
|
echo "lib/$abi/libonionwire_sdk.so carries no cuprated config string: the cuprate-daemon feature is NOT in this APK" >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue