目前,我正尝试使用Bitbucket Pipelines为我们的应用程序运行测试。但是,当尝试将apk安装到模拟器中时,管道在以下行挂起/冻结:
execute: running pm install -r -t -d -t "/data/local/tmp/app-debug.apk"
并最终抛出ShellCommandUnresponsiveException
。
我试图将运行adb命令的时间增加到20分钟,但这不能解决问题。
我也尝试过使用-debug
运行完全相同的命令,我可以观察到的是,在某个点之后,它会重复输出一堆非常相似的日志,但似乎没有效果:< / p>
14:25:27.747 [DEBUG] [org.gradle.process.internal.health.memory.MemoryManager] Emitting OS memory status event {Total: 32894566400, Free: 15448174592}
14:25:27.747 [DEBUG] [org.gradle.launcher.daemon.server.health.LowMemoryDaemonExpirationStrategy] Received memory status update: {Total: 32894566400, Free: 15448174592}
14:25:27.747 [DEBUG] [org.gradle.process.internal.health.memory.MemoryManager] Emitting JVM memory status event {Maximum: 1431830528, Committed: 1113063424}
14:25:32.747 [DEBUG] [org.gradle.process.internal.health.memory.MemoryManager] Emitting OS memory status event {Total: 32894566400, Free: 15404277760}
14:25:32.747 [DEBUG] [org.gradle.launcher.daemon.server.health.LowMemoryDaemonExpirationStrategy] Received memory status update: {Total: 32894566400, Free: 15404277760}
14:25:32.747 [DEBUG] [org.gradle.process.internal.health.memory.MemoryManager] Emitting JVM memory status event {Maximum: 1431830528, Committed: 1113063424}
14:25:34.411 [DEBUG] [org.gradle.launcher.daemon.server.Daemon] DaemonExpirationPeriodicCheck running
14:25:34.411 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Waiting to acquire shared lock on daemon addresses registry.
14:25:34.411 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Lock acquired on daemon addresses registry.
14:25:34.411 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Releasing lock on daemon addresses registry.
14:25:34.411 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Waiting to acquire shared lock on daemon addresses registry.
14:25:34.411 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Lock acquired on daemon addresses registry.
14:25:34.411 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Releasing lock on daemon addresses registry.
14:25:37.747 [DEBUG] [org.gradle.process.internal.health.memory.MemoryManager] Emitting OS memory status event {Total: 32894566400, Free: 15367606272}
14:25:37.747 [DEBUG] [org.gradle.launcher.daemon.server.health.LowMemoryDaemonExpirationStrategy] Received memory status update: {Total: 32894566400, Free: 15367606272}
14:25:37.747 [DEBUG] [org.gradle.process.internal.health.memory.MemoryManager] Emitting JVM memory status event {Maximum: 1431830528, Committed: 1113063424}
14:25:42.747 [DEBUG] [org.gradle.process.internal.health.memory.MemoryManager] Emitting OS memory status event {Total: 32894566400, Free: 15328276480}
14:25:42.747 [DEBUG] [org.gradle.launcher.daemon.server.health.LowMemoryDaemonExpirationStrategy] Received memory status update: {Total: 32894566400, Free: 15328276480}
14:25:42.747 [DEBUG] [org.gradle.process.internal.health.memory.MemoryManager] Emitting JVM memory status event {Maximum: 1431830528, Committed: 1113063424}
我尝试在桌面上的docker上运行相同的命令,该任务运行良好,并在2分钟内完成。以下是管道的脚本:
image: mingc/android-build-box:latest
options:
size: 2x # just to make sure we have enough resources
pipelines:
default:
- step:
caches:
- gradle
script:
# set up necessities
- sdkmanager "system-images;android-25;google_apis;armeabi-v7a"
- sdkmanager --update
- sdkmanager --licenses
- echo no | avdmanager create avd --force --name test_device --package "system-images;android-25;google_apis;armeabi-v7a" -c 100M
- $ANDROID_HOME/emulator/emulator -no-window -no-audio -avd test_device -no-snapshot-load -no-snapshot-save &
# build while waiting for device to be completely started
- bash ./gradlew build
- bash ./gradlew assembleDebug
# make sure the device is completely started before proceed
- while [ "`adb shell getprop init.svc.bootanim | tr -d '\r' `" != "stopped" ] ; do sleep 1 && adb shell getprop init.svc.bootanim | tr -d '\r' ; done
# unlocking the screen
- adb shell input keyevent 82
- bash ./gradlew connectedAndroidTest
- bash ./gradlew assembleRelease
摘要:
预期: Bitbucket管道应同时运行单元测试和仪器测试
实际结果: 尝试安装apk时,管道挂在connectedAndroidTest
上,无法继续
问题: 如果我在本地docker上运行,则完全相同的任务正在工作,那么在Bitbucket Pipelines上安装apk时需要做什么?