Skip to content

Commit f965520

Browse files
committed
Update run-android-tests.sh
1 parent 1be9a28 commit f965520

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

scripts/run-android-tests.sh

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ INSTALL_RETRIES=5
77
LAUNCH_RETRIES=3
88
LOCKSCREEN_RETRIES=20
99
PID_RETRIES=10
10+
PACKAGE_NAME="io.sentry.godot.project"
1011
LOGCAT_FILTERS="Godot,godot,sentry-godot,sentry-native"
1112
EXPORT_PRESET="Android CI"
1213

@@ -131,7 +132,7 @@ run_tests() {
131132

132133
highlight "Launching APK..."
133134
for i in $(seq 1 $LAUNCH_RETRIES); do
134-
adb shell am start -n io.sentry.godot.project/com.godot.game.GodotApp --es SENTRY_TEST 1 --es SENTRY_TEST_INCLUDE "$tests"
135+
adb shell am start -n $PACKAGE_NAME/com.godot.game.GodotApp -W --es SENTRY_TEST 1 --es SENTRY_TEST_INCLUDE "$tests"
135136
if [ $? -eq 0 ]; then
136137
# Success
137138
break
@@ -146,7 +147,7 @@ run_tests() {
146147
# Get PID
147148
local pid=""
148149
for i in $(seq 1 $PID_RETRIES); do
149-
pid=$(adb shell pidof io.sentry.godot.project)
150+
pid=$(adb shell pidof $PACKAGE_NAME)
150151
if [ -n "$pid" ]; then
151152
break
152153
fi
@@ -158,6 +159,8 @@ run_tests() {
158159
return 3
159160
fi
160161

162+
echo "PID: $pid"
163+
161164
# Start logcat, streaming to stdout and monitoring for completion
162165
highlight "Reading logs..."
163166
local exit_code=1 # Default general failure
@@ -167,9 +170,10 @@ run_tests() {
167170
# Function to monitor Android app process and kill logcat if it dies
168171
monitor_app() {
169172
while true; do
170-
local app_pid=$(adb shell pidof io.sentry.godot.project 2>/dev/null || echo "")
173+
local app_pid=$(adb shell pidof $PACKAGE_NAME 2>/dev/null || echo "")
171174
if [ -z "$app_pid" ]; then
172-
# App died, kill logcat
175+
sleep 10 # start a timer to kill logcat
176+
warning "App died, killing logcat"
173177
pkill --full "$logcat_cmd" 2>/dev/null || true
174178
break
175179
fi
@@ -210,13 +214,13 @@ run_tests() {
210214
wait $monitor_pid 2>/dev/null || true
211215

212216
# Check if process still running
213-
local current_pid=$(adb shell pidof io.sentry.godot.project 2>/dev/null || echo "")
217+
local current_pid=$(adb shell pidof $PACKAGE_NAME 2>/dev/null || echo "")
214218
if [ -n "$current_pid" ]; then
215219
if [ $exit_code -eq 0 ]; then
216220
exit_code=88
217221
fi
218222
error "Godot app process still running"
219-
adb shell am force-stop io.sentry.godot.project
223+
adb shell am force-stop $PACKAGE_NAME
220224
# Wait for process to quit
221225
while adb shell kill -0 "$current_pid"; do
222226
sleep 1

0 commit comments

Comments
 (0)