From 509236deaae9ef77072a8c03be16446cd91acf0a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Brey?= Date: Mon, 18 Jul 2022 12:01:40 +0200 Subject: [PATCH] runCombinedTest: ensure entire logcat is recorded MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- scripts/runCombinedTest.sh | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/scripts/runCombinedTest.sh b/scripts/runCombinedTest.sh index 426c10f925..2575bdadb5 100755 --- a/scripts/runCombinedTest.sh +++ b/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