test(phase3): fix TEST 2 missed count extraction for duplicate boot recovery

Boot recovery runs twice on Android (both LOCKED_BOOT_COMPLETED and
BOOT_COMPLETED fire). The first run marks missed alarms (missed=1), while
the second run only reschedules future alarms (missed=0).

TEST 2 was incorrectly extracting the last entry (missed=0) instead of
the first entry (missed=1), causing false test failures.

Changes:
- Extract first missed count using head -n1 instead of tail -n1
- Add comment explaining why first entry is needed
- Test now correctly validates missed alarm detection

Fixes test validation for past alarm detection during boot recovery.
This commit is contained in:
Matthew Raymer
2025-12-08 10:40:42 +00:00
parent 3501cc4b6f
commit 8c75b964a6

View File

@@ -164,7 +164,10 @@ test2_boot_past_alarms() {
echo "$logs" echo "$logs"
local missed rescheduled verified errors scenario local missed rescheduled verified errors scenario
missed="$(extract_field_from_logs "$logs" "missed")" # For TEST 2, we need the FIRST entry (which has missed count) not the last
# Boot recovery runs twice (LOCKED_BOOT_COMPLETED and BOOT_COMPLETED)
# First run marks missed alarms, second run only reschedules (missed=0)
missed="$(echo "$logs" | grep -E "missed=" | sed -E "s/.*missed=([0-9]+).*/\1/" | head -n1 || echo "0")"
rescheduled="$(extract_field_from_logs "$logs" "rescheduled")" rescheduled="$(extract_field_from_logs "$logs" "rescheduled")"
verified="$(extract_field_from_logs "$logs" "verified")" verified="$(extract_field_from_logs "$logs" "verified")"
errors="$(extract_field_from_logs "$logs" "errors")" errors="$(extract_field_from_logs "$logs" "errors")"