diff options
| author | David Göransson <david.goransson@mullvad.net> | 2025-03-31 14:39:22 +0200 |
|---|---|---|
| committer | David Göransson <david.goransson@mullvad.net> | 2025-04-03 16:00:27 +0200 |
| commit | 352bbd95bed4d3925be1215b36167c375e288e6c (patch) | |
| tree | 44e40be05fb158bc46b6405db52c4e0bcfa7a1c1 /android/scripts | |
| parent | dc1d34a93a8a9cbb9387517be958de3a5dde7798 (diff) | |
| download | mullvadvpn-352bbd95bed4d3925be1215b36167c375e288e6c.tar.xz mullvadvpn-352bbd95bed4d3925be1215b36167c375e288e6c.zip | |
Fix android logs not working correct with e2e tests
Currently we use `logcat -d` this will dump the current logs however
this relies on the buffer of app logs being long enough which didn't end
up being the case. Now we starting logging in the begging of the test
and stop once all tests are complete.
Diffstat (limited to 'android/scripts')
| -rwxr-xr-x | android/scripts/run-instrumented-tests.sh | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/android/scripts/run-instrumented-tests.sh b/android/scripts/run-instrumented-tests.sh index 99a3355cee..9ca30fc615 100755 --- a/android/scripts/run-instrumented-tests.sh +++ b/android/scripts/run-instrumented-tests.sh @@ -162,7 +162,6 @@ DEVICE_TEST_ATTACHMENTS_PATH="/sdcard/Download/test-attachments" echo "" echo "### Ensure clean report structure ###" rm -rf "${REPORT_DIR:?}/*" -adb logcat --clear adb shell rm -rf "$DEVICE_SCREENSHOT_PATH" adb shell rm -rf "$DEVICE_TEST_ATTACHMENTS_PATH" echo "" @@ -209,6 +208,11 @@ if [[ "$USE_ORCHESTRATOR" == "true" ]]; then fi echo "" +echo "### Start logging ###" +adb logcat --clear +adb logcat > "$LOGCAT_FILE_PATH" & +running_pid=$! + echo "### Run instrumented test command ###" if [[ "$USE_ORCHESTRATOR" == "true" ]]; then INSTRUMENTATION_COMMAND="\ @@ -228,6 +232,9 @@ fi adb shell "$GRADLE_ENVIRONMENT_VARIABLES $INSTRUMENTATION_COMMAND" | tee "$INSTRUMENTATION_LOG_FILE_PATH" echo "" +echo "### Stop logging ###" +kill $running_pid + echo "### Ensure that packages are uninstalled ###" adb uninstall "$PACKAGE_NAME" || echo "App package not installed" adb uninstall "$TEST_PACKAGE_NAME" || echo "Test package not installed" @@ -243,7 +250,6 @@ else echo "Collecting report..." adb pull "$DEVICE_SCREENSHOT_PATH" "$LOCAL_SCREENSHOT_PATH" || echo "No screenshots" adb pull "$DEVICE_TEST_ATTACHMENTS_PATH" "$LOCAL_TEST_ATTACHMENTS_PATH" || echo "No test attachments" - adb logcat -d > "$LOGCAT_FILE_PATH" exit 1 fi |
