浏览代码

runCombinedTest: ensure entire logcat is recorded

Start streaming logcat before tests instead of dumping it after. This avoids buffer overflow.

Additionally use xz instead of gzip, for greater compression

Signed-off-by: Álvaro Brey <alvaro.brey@nextcloud.com>
Álvaro Brey 2 年之前
父节点
当前提交
509236deaa
共有 1 个文件被更改,包括 10 次插入3 次删除
  1. 10 3
      scripts/runCombinedTest.sh

+ 10 - 3
scripts/runCombinedTest.sh

@@ -6,12 +6,13 @@ LOG_PASSWORD=$3
 DRONE_BUILD_NUMBER=$4
 
 function upload_logcat() {
-    log_filename="${DRONE_PULL_REQUEST}_logcat.txt.gz"
+    log_filename="${DRONE_PULL_REQUEST}_logcat.txt.xz"
     log_file="app/build/${log_filename}"
     upload_path="https://nextcloud.kaminsky.me/remote.php/webdav/android-logcat/$log_filename"
-    adb logcat -d | gzip > "$log_file"
+    xz logcat.txt
+    mv logcat.txt.xz "$log_file"
     curl -u "${LOG_USERNAME}:${LOG_PASSWORD}" -X PUT "$upload_path" --upload-file "$log_file"
-    echo >&2 "Uploaded logcat to https://kaminsky.me/nc-dev/android-logcat/$log_filename"
+    echo >&2 "Uploaded logcat to https://www.kaminsky.me/nc-dev/android-logcat/$log_filename"
 }
 
 scripts/deleteOldComments.sh "master" "IT" "$DRONE_PULL_REQUEST"
@@ -22,9 +23,15 @@ scripts/wait_for_emulator.sh
 
 ./gradlew installGplayDebugAndroidTest
 scripts/wait_for_server.sh "server"
+
+# clear logcat and start saving it to file
 adb logcat -c
+adb logcat > logcat.txt &
+LOGCAT_PID=$!
 ./gradlew createGplayDebugCoverageReport -Pcoverage -Pandroid.testInstrumentationRunnerArguments.notAnnotation=com.owncloud.android.utils.ScreenshotTest
 stat=$?
+# stop saving logcat
+kill $LOGCAT_PID
 
 if [ ! $stat -eq 0 ]; then
     upload_logcat