| commit | 44d8e6c2aa80dbeb2afc1e4471dc1b66bf47779a | [log] [tgz] |
|---|---|---|
| author | Huy Do <huydhn@gmail.com> | Thu Mar 09 00:09:10 2023 +0000 |
| committer | PyTorch MergeBot <pytorchmergebot@users.noreply.github.com> | Thu Mar 09 00:09:10 2023 +0000 |
| tree | 5dd3e783dd5e2b83bdffe2ce9dc629be2c0021c4 | |
| parent | df0ff34bcb419d158cfa95d8abb190cdaf0f751a [diff] |
Retry CI Android emulator test (#96163) This is not the first time I spot Android test flakiness such as https://hud.pytorch.org/pytorch/pytorch/commit/893aa5df3f2a475c91ea8eadb1353812e52fb227. From some StackOverflow results, it looks like the failure `Unknown failure: Error: Could not access the Package Manager. Is the system running?` could be fixed by waiting a bit for the emulator to start fully https://stackoverflow.com/questions/15524185/could-not-access-the-package-manager-is-the-system-running-while-installing-and So, I'm adding retry capability here to give the test another chance. Pull Request resolved: https://github.com/pytorch/pytorch/pull/96163 Approved by: https://github.com/ZainRizvi
diff --git a/android/common.sh b/android/common.sh index 1fee30b..c7c508e 100644 --- a/android/common.sh +++ b/android/common.sh
@@ -10,6 +10,10 @@ exit 1 fi +retry () { + "$@" || (sleep 10 && "$@") || (sleep 20 && "$@") || (sleep 40 && "$@") +} + check_android_sdk() { if [ -z "$ANDROID_HOME" ]; then echo "ANDROID_HOME not set; please set it to Android sdk directory"
diff --git a/android/run_tests.sh b/android/run_tests.sh index 839ee20..c8c8977 100755 --- a/android/run_tests.sh +++ b/android/run_tests.sh
@@ -49,7 +49,8 @@ $ADB_PATH wait-for-device shell 'while [[ -z $(getprop sys.boot_completed) ]]; do sleep 1; done;' { - $GRADLE_PATH -PABI_FILTERS=x86 -p $PYTORCH_ANDROID_DIR connectedAndroidTest + # The test currently takes about 10 minutes + retry $GRADLE_PATH -PABI_FILTERS=x86 -p $PYTORCH_ANDROID_DIR connectedAndroidTest } || { echo "::error::Check https://github.com/pytorch/pytorch/tree/master/test/mobile/model_test to see how to fix the failed mobile test" exit 1