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>
This commit is contained in:
Álvaro Brey 2022-07-18 12:01:40 +02:00
parent eaef5fc48a
commit 509236deaa
No known key found for this signature in database
GPG Key ID: 2585783189A62105
1 changed files with 10 additions and 3 deletions

View File

@ -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