Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions .github/scripts/android-js-fatal.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ FORWARD_BOUND_S=7
EXIT_BOUND_S=2

wait_for_log() {
local pattern="$1" deadline="$2"
local pattern="$1" deadline="$2" uid
for _ in $(seq 1 "$deadline"); do
if adb logcat -d | grep -qE "$pattern"; then
return 0
Expand All @@ -29,7 +29,14 @@ wait_for_log() {
done

echo "::error::timed out after ${deadline}s waiting for: $pattern"
adb logcat -d | tail -50
if ! adb shell pidof "$PACKAGE" >/dev/null 2>&1; then
echo "$PACKAGE is not running"
fi
adb logcat -d -s ActivityManager:I ActivityTaskManager:I | grep -F "$PACKAGE" | tail -20 || true
uid="$(adb shell pm list packages -U "$PACKAGE" | tr -d '\r' | sed -n "s/^package:$PACKAGE uid://p")"
if [ -n "$uid" ]; then
adb logcat -d --uid="$uid" | tail -50
fi
return 1
}

Expand All @@ -46,7 +53,8 @@ trap 'adb logcat -d -v epoch > "$LOGCAT_OUT" 2>/dev/null || true' EXIT
adb wait-for-device
adb uninstall "$PACKAGE" >/dev/null 2>&1 || true
adb install -r "$APK"
adb shell pm clear "$PACKAGE" >/dev/null
# Not pm clear, its late force-stop kills the launch. Uninstall alone can leave data on the cached emulator image.
adb shell run-as "$PACKAGE" find . -mindepth 1 -delete >/dev/null
adb logcat -c

adb shell am start -n "$ACTIVITY" >/dev/null
Expand Down
14 changes: 11 additions & 3 deletions .github/scripts/android-native-crash.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ case "$INSTALL" in
esac

wait_for_log() {
local pattern="$1" deadline="$2"
local pattern="$1" deadline="$2" uid
for _ in $(seq 1 "$deadline"); do
if adb logcat -d | grep -qE "$pattern"; then
return 0
Expand All @@ -34,7 +34,14 @@ wait_for_log() {
done

echo "::error::timed out after ${deadline}s waiting for: $pattern"
adb logcat -d | tail -50
if ! adb shell pidof "$PACKAGE" >/dev/null 2>&1; then
echo "$PACKAGE is not running"
fi
adb logcat -d -s ActivityManager:I ActivityTaskManager:I | grep -F "$PACKAGE" | tail -20 || true
uid="$(adb shell pm list packages -U "$PACKAGE" | tr -d '\r' | sed -n "s/^package:$PACKAGE uid://p")"
if [ -n "$uid" ]; then
adb logcat -d --uid="$uid" | tail -50
fi
return 1
}

Expand Down Expand Up @@ -80,7 +87,8 @@ case "$INSTALL" in
apk) install_apk ;;
split) install_split ;;
esac
adb shell pm clear "$PACKAGE" >/dev/null
# Not pm clear, its late force-stop kills the launch. Uninstall alone can leave data on the cached emulator image.
adb shell run-as "$PACKAGE" find . -mindepth 1 -delete >/dev/null
adb logcat -c
trap 'adb logcat -d > "$LOGCAT_OUT" 2>/dev/null || true; rm -rf "$WORK"' EXIT

Expand Down
Loading