test(wake): I14 blank-reset assertion BusyBox-grep-portable (grep -z unsupported on Alpine CI) + portability sweep
All checks were successful
ci/woodpecker/pr/ci Pipeline was successful
All checks were successful
ci/woodpecker/pr/ci Pipeline was successful
#931 CI (node:24-alpine, musl/BusyBox) went RED: the I14 blank-reset assertion used `grep -qz` (NUL-data), a GNU-only extension BusyBox grep does NOT support (its option list is -HhnlLoqvsrRiwFE -m -A -B -C -e -f — no -z). BusyBox grep printed usage + exited non-zero, tripping `|| fail_msg`. Passed locally only because GNU grep has -z. Toolchain-divergence class (cf. #912, BusyBox sed). Fix (test-only; product drop-in is correct, verify-single already proves exactly-one): assert the blank-reset FORM portably — `grep -A1 '^OnUnitActiveSec=$' | grep -qx 'OnUnitActiveSec=30min'` still requires the empty reset line IMMEDIATELY followed by the value, and still catches the negative control. Also simplified a sibling `grep -qi 'EXACTLY ONE\|exactly one'` to `grep -qi 'exactly one'` (drop the BRE alternation; -i already covers case). Sweep of all packages/mosaic/framework/tools/wake/test-*.sh for BusyBox- incompatible constructs (grep -z/-P, sed \xNN/\b/-i, gawk-isms, date -d/%N): the only #931-introduced defect was this one. Verified in the real Alpine image (node:24-alpine, BusyBox v1.37.0): all 9 wake harnesses + full test:framework- shell green under BusyBox with CI=woodpecker (openssl present, I8 HMAC leg runs). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0158NZqN2n2ymKFeJAZ4GUCb
This commit is contained in:
@@ -411,9 +411,13 @@ echo "== I14: per-class fallback cadence — blank-reset yields EXACTLY ONE OnUn
|
|||||||
# write-fallback-cadence writes the per-class cadence in BLANK-RESET form.
|
# write-fallback-cadence writes the per-class cadence in BLANK-RESET form.
|
||||||
out="$(bash "$WI" write-fallback-cadence 30min 2>&1)"; rc=$?
|
out="$(bash "$WI" write-fallback-cadence 30min 2>&1)"; rc=$?
|
||||||
[ "$rc" -eq 0 ] || fail_msg "I14: write-fallback-cadence must succeed + verify single (rc=$rc) [$out]"
|
[ "$rc" -eq 0 ] || fail_msg "I14: write-fallback-cadence must succeed + verify single (rc=$rc) [$out]"
|
||||||
echo "$out" | grep -qi 'EXACTLY ONE\|exactly one' || fail_msg "I14: the cadence write must confirm exactly-one OnUnitActiveUSec [$out]"
|
echo "$out" | grep -qi 'exactly one' || fail_msg "I14: the cadence write must confirm exactly-one OnUnitActiveUSec [$out]"
|
||||||
[ -f "$UD/$TIMER.d/cadence.conf" ] || fail_msg "I14: the per-class cadence drop-in must be written under <timer>.d/"
|
[ -f "$UD/$TIMER.d/cadence.conf" ] || fail_msg "I14: the per-class cadence drop-in must be written under <timer>.d/"
|
||||||
grep -qz $'OnUnitActiveSec=\nOnUnitActiveSec=30min' "$UD/$TIMER.d/cadence.conf" \
|
# Assert the blank-reset FORM: an empty `OnUnitActiveSec=` reset line IMMEDIATELY
|
||||||
|
# FOLLOWED by the new value. Portable across GNU and BusyBox grep (Alpine CI) —
|
||||||
|
# `grep -z` (NUL-data) is a GNU-only extension BusyBox grep does NOT support, so
|
||||||
|
# match the reset line and require the value on the very next line (-A1) instead.
|
||||||
|
grep -A1 '^OnUnitActiveSec=$' "$UD/$TIMER.d/cadence.conf" | grep -qx 'OnUnitActiveSec=30min' \
|
||||||
|| fail_msg "I14: the drop-in must use the blank-reset form (empty reset line, then the value)"
|
|| fail_msg "I14: the drop-in must use the blank-reset form (empty reset line, then the value)"
|
||||||
bash "$WI" verify-single "$TIMER" >/dev/null 2>&1 || fail_msg "I14: base(1h)+blank-reset(30min) must resolve exactly one OnUnitActiveUSec"
|
bash "$WI" verify-single "$TIMER" >/dev/null 2>&1 || fail_msg "I14: base(1h)+blank-reset(30min) must resolve exactly one OnUnitActiveUSec"
|
||||||
# NEGATIVE CONTROL: a drop-in WITHOUT the reset line appends -> base 1h + 30min -> two -> fail.
|
# NEGATIVE CONTROL: a drop-in WITHOUT the reset line appends -> base 1h + 30min -> two -> fail.
|
||||||
|
|||||||
Reference in New Issue
Block a user