Repository Public License
1#!/usr/bin/env bash2# ORIX Alarm3# File: Scripts/probe-alarmkit.sh4# Description: Runs the real-AlarmKit simulator validation (UITests/AlarmKitProbeUITests) and captures host screenshots on request. usage: probe-alarmkit.sh [testName]5# Evidence lands in /tmp/orix-alarm-probe (probe.log, *.png). About two to four minutes per test.6#7# Author: Simon-Pierre Boucher8# Contact: contact@spboucher.ai9set -uo pipefail10cd "$(dirname "$0")/.."11SIM="${ORIX_SIM:-ORIXAlarm iPhone}"12DIR=/tmp/orix-alarm-probe13mkdir -p "$DIR"; rm -f "$DIR"/capture-* "$DIR"/probe.log; touch "$DIR/enabled"14# XCTest cannot take screenshots while the system alarm alert is displayed: the test drops capture-<name> files instead.15( while [[ -f "$DIR/enabled" ]]; do16 for f in "$DIR"/capture-*; do [[ -e "$f" ]] || continue; n="${f##*/capture-}"; xcrun simctl io "$SIM" screenshot "$DIR/$n.png" >/dev/null 2>&1; rm -f "$f"; done17 sleep 118 done ) &19watcher=$!20only="-only-testing:ORIXAlarmUITests/AlarmKitProbeUITests${1:+/$1}"21ORIX_SIM="$SIM" Scripts/build.sh uitest "$only"; status=$?22rm -f "$DIR/enabled"; wait "$watcher" 2>/dev/null23grep -E "Test Case .*(passed|failed)|error:" build/logs/uitest.log | sort -u | head -2024exit $status25