-
Notifications
You must be signed in to change notification settings - Fork 807
Fix Android emulator CI test file permission error #16649
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/16649
Note: Links to docs will display an error until the docs builds have been completed. ❌ 1 New Failure, 32 Pending, 1 Unrelated FailureAs of commit 76c55b2 with merge base 8887cfd ( NEW FAILURE - The following job has failed:
FLAKY - The following job failed but was likely due to flakiness present on trunk:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
This PR needs a
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR fixes Android emulator CI test file permission errors on Android API 34 by switching from external to internal cache storage. On Android API 34, scoped storage restrictions prevent writing to external storage directories, even for app-specific ones. Internal storage (cacheDir) works reliably across all API levels without requiring permissions.
Changes:
- Modified
TestFileUtils.getTestFilePath()to usecacheDirinstead ofexternalCacheDir - Removed READ_EXTERNAL_STORAGE permission from test manifest
- Removed GrantPermissionRule and related imports from all test files
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| extension/android/executorch_android/src/androidTest/java/org/pytorch/executorch/TestFileUtils.kt | Changed from externalCacheDir to cacheDir for file path generation |
| extension/android/executorch_android/src/androidTest/AndroidManifest.xml | Removed READ_EXTERNAL_STORAGE permission declaration |
| extension/android/executorch_android/src/androidTest/java/org/pytorch/executorch/training/TrainingModuleE2ETest.kt | Removed GrantPermissionRule and related imports |
| extension/android/executorch_android/src/androidTest/java/org/pytorch/executorch/ModuleInstrumentationTest.kt | Removed GrantPermissionRule and related imports |
| extension/android/executorch_android/src/androidTest/java/org/pytorch/executorch/ModuleE2ETest.kt | Removed GrantPermissionRule and related imports |
| extension/android/executorch_android/src/androidTest/java/org/pytorch/executorch/LlmModuleInstrumentationTest.kt | Removed GrantPermissionRule and related imports |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Use internal cache directory instead of external cache directory for Android instrumentation tests. On Android API 34, scoped storage restrictions prevent writing to external storage even for app-specific directories. Internal storage (cacheDir) requires no permissions and works reliably on all API levels. - Change externalCacheDir to cacheDir in TestFileUtils - Remove unnecessary READ_EXTERNAL_STORAGE permission from manifest - Remove GrantPermissionRule from all test files
d0ad5b5 to
76c55b2
Compare
This test has been failing for a while: https://hud.pytorch.org/hud/pytorch/executorch/main/1?per_page=50&name_filter=android%20%2F%20run-emulator
Use internal cache directory instead of external cache directory for
Android instrumentation tests. On Android API 34, scoped storage
restrictions prevent writing to external storage even for app-specific
directories. Internal storage (cacheDir) requires no permissions and
works reliably on all API levels.
Test Plan:
https://github.com/pytorch/executorch/actions/runs/21071703747