diff options
| author | Albin <albin@mullvad.net> | 2022-06-14 06:18:57 +0200 |
|---|---|---|
| committer | Albin <albin@mullvad.net> | 2022-06-14 07:44:20 +0200 |
| commit | 3f2417b4436a744463836a562ced84fc2ff60af8 (patch) | |
| tree | 74caf103096f9d66d87d573c22159e2bf4a20cd3 | |
| parent | 92fa1004440957aa78abc9ca10bfa38a96ce759e (diff) | |
| download | mullvadvpn-3f2417b4436a744463836a562ced84fc2ff60af8.tar.xz mullvadvpn-3f2417b4436a744463836a562ced84fc2ff60af8.zip | |
Fix always passing instrumented test script
Adb will not return an error code once the tests fail, so therefore this
needs to be handled by parsing logs.
| -rwxr-xr-x | ci/run-android-instrumented-tests.sh | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/ci/run-android-instrumented-tests.sh b/ci/run-android-instrumented-tests.sh index 54230ac801..a69cd29d69 100755 --- a/ci/run-android-instrumented-tests.sh +++ b/ci/run-android-instrumented-tests.sh @@ -1,6 +1,17 @@ #!/usr/bin/env bash APK_BASE_DIR=$1 -adb install "$APK_BASE_DIR/debug/app-debug.apk" +LOG_FILE_NAME="mullvad.instrumentation_data_proto" +LOG_FILE_PATH="/sdcard/$LOG_FILE_NAME" +LOG_FAILURE_MESSAGE="FAILURES\!\!\!" + +adb install -r -t "$APK_BASE_DIR/debug/app-debug.apk" adb install "$APK_BASE_DIR/androidTest/debug/app-debug-androidTest.apk" -adb shell am instrument -w net.mullvad.mullvadvpn.test/androidx.test.runner.AndroidJUnitRunner +adb shell am instrument -w -f "$LOG_FILE_NAME" net.mullvad.mullvadvpn.test/androidx.test.runner.AndroidJUnitRunner + +# Print log so that it shows as part of GitHub Actions logs etc +adb shell cat "$LOG_FILE_PATH" + +if adb shell grep -q "$LOG_FAILURE_MESSAGE" "$LOG_FILE_PATH"; then + exit 1 +fi |
