Skip to content

Commit

Permalink
Collect app data on android
Browse files Browse the repository at this point in the history
  • Loading branch information
blaugold committed May 2, 2023
1 parent 08d4d98 commit 2aeec52
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
7 changes: 7 additions & 0 deletions tools/android-emulator.sh
Expand Up @@ -22,6 +22,7 @@ fi
emulatorName="cbl-dart"
emulatorPort=5554
serialName="emulator-$emulatorPort"
appBundleId="com.terwesten.gabriel.cbl_e2e_tests_flutter"

# === Usage ===================================================================

Expand Down Expand Up @@ -148,6 +149,11 @@ function bugreport() {
echo "Created bugreport"
}

function copyAppData() {
"$ANDROID_HOME/platform-tools/adb" shell "run-as $appBundleId cp -r /data/data/$appBundleId /mnt/sdcard"
"$ANDROID_HOME/platform-tools/adb" pull "/mnt/sdcard/$appBundleId" "appData"
}

# === Parse command ===========================================================

if [[ $# -eq 0 ]]; then
Expand All @@ -158,6 +164,7 @@ commands=(
createAndStart
setupReversePort
bugreport
copyAppData
)

if [[ ! " ${commands[*]} " =~ " $1 " ]]; then
Expand Down
8 changes: 7 additions & 1 deletion tools/ci-steps.sh
Expand Up @@ -293,6 +293,12 @@ function _collectCblLogsMacOS() {
echo "Copied files"
}

function _collectCblLogsAndroid() {
./tools/android-emulator.sh copyAppData
zip -r appData.zip appData
mv appData.zip "$testResultsDir"
}

function _collectCblLogsLinux() {
echo "Collecting Couchbase Lite logs"

Expand Down Expand Up @@ -349,7 +355,7 @@ function collectTestResults() {
;;
Android)
_collectCrashReportsAndroid
# TODO(blaugold): get cbl logs from device
_collectCblLogsAndroid
;;
Ubuntu)
_collectCrashReportsLinuxFlutter
Expand Down

0 comments on commit 2aeec52

Please sign in to comment.