Skip to content

Commit 0ca9114

Browse files
committed
Verbose flag
1 parent 6a6af24 commit 0ca9114

File tree

1 file changed

+52
-8
lines changed

1 file changed

+52
-8
lines changed

scripts/run-android-tests.sh

Lines changed: 52 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,12 @@
11
#!/bin/bash
2-
#
32
# Run unit tests on a local Android device.
4-
#
5-
# Prerequisites:
6-
# - Godot Engine 4.5 or later with Android export templates installed
7-
# - Android SDK with ADB (Android Debug Bridge) tools
8-
# - Android device connected and authorized for debugging
93

104
# Configuration
11-
TEST_TIMEOUT=60 # seconds
5+
TEST_TIMEOUT=120 # seconds
126
INSTALL_RETRIES=5
137
LAUNCH_RETRIES=3
148
LOCKSCREEN_RETRIES=20
9+
LOGCAT_FILTERS="Godot,godot,sentry-godot,sentry-native"
1510

1611
# Formatted output
1712
highlight() { echo -e "\033[1;34m$1\033[0m"; }
@@ -35,6 +30,51 @@ abort() {
3530
exit 1
3631
}
3732

33+
# Display usage information
34+
usage() {
35+
echo "Usage: $0 [OPTIONS]"
36+
echo ""
37+
echo "Run unit tests on a local Android device."
38+
echo ""
39+
echo "OPTIONS:"
40+
echo " -v, --verbose Enable additional output"
41+
echo " -h, --help Display this help message"
42+
echo ""
43+
echo "PREREQUISITES:"
44+
echo " - Godot Engine 4.5 or later with Android export templates installed"
45+
echo " - Android SDK with ADB (Android Debug Bridge) tools"
46+
echo " - Android device connected and authorized for debugging"
47+
echo ""
48+
echo "ENVIRONMENT VARIABLES:"
49+
echo " GODOT Path to Godot executable (if not in PATH)"
50+
}
51+
52+
# Parse command line options
53+
verbose=false
54+
55+
while [[ $# -gt 0 ]]; do
56+
case $1 in
57+
--verbose|-v)
58+
verbose=true
59+
shift
60+
;;
61+
--help|-h)
62+
usage
63+
exit 0
64+
;;
65+
-*)
66+
error "Unknown option: $1"
67+
usage
68+
exit 1
69+
;;
70+
*)
71+
error "Unexpected argument: $1"
72+
usage
73+
exit 1
74+
;;
75+
esac
76+
done
77+
3878
highlight "Exporting project..."
3979

4080
# Export project to "exports/android.apk".
@@ -61,6 +101,10 @@ for i in $(seq 1 $INSTALL_RETRIES); do
61101
fi
62102
done
63103

104+
# Enable Sentry Android output if verbose
105+
if [ "$verbose" = true ]; then
106+
LOGCAT_FILTERS="$LOGCAT_FILTERS,Sentry"
107+
fi
64108

65109
# Run tests on device
66110
run_tests() {
@@ -123,7 +167,7 @@ run_tests() {
123167
timeout 2 cat || true # Continue reading for a bit in case there are remaining logs
124168
break
125169
fi
126-
done < <(timeout $TEST_TIMEOUT adb logcat --pid=$pid -s Godot,godot,sentry-godot,sentry-native)
170+
done < <(timeout $TEST_TIMEOUT adb logcat --pid=$pid -s $LOGCAT_FILTERS)
127171

128172
# Check if never finished
129173
if [ $exit_code -eq 1 ]; then

0 commit comments

Comments
 (0)