Skip to content

Conversation

@mergennachin
Copy link
Contributor

@mergennachin mergennachin commented Jan 16, 2026

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.

  • Change externalCacheDir to cacheDir in TestFileUtils
  • Remove unnecessary READ_EXTERNAL_STORAGE permission from manifest
  • Remove GrantPermissionRule from all test files

Test Plan:

https://github.com/pytorch/executorch/actions/runs/21071703747

Copilot AI review requested due to automatic review settings January 16, 2026 14:59
@pytorch-bot
Copy link

pytorch-bot bot commented Jan 16, 2026

🔗 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 Failure

As of commit 76c55b2 with merge base 8887cfd (image):

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.

@meta-cla meta-cla bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Jan 16, 2026
@github-actions
Copy link

This PR needs a release notes: label

If your change should be included in the release notes (i.e. would users of this library care about this change?), please use a label starting with release notes:. This helps us keep track and include your important work in the next release notes.

To add a label, you can comment to pytorchbot, for example
@pytorchbot label "release notes: none"

For more information, see
https://github.com/pytorch/pytorch/wiki/PyTorch-AutoLabel-Bot#why-categorize-for-release-notes-and-how-does-it-work.

Copy link
Contributor

Copilot AI left a 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 use cacheDir instead of externalCacheDir
  • 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.

@mergennachin mergennachin requested a review from rascani January 16, 2026 15:05
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
@mergennachin mergennachin merged commit dd9da21 into main Jan 16, 2026
153 of 156 checks passed
@mergennachin mergennachin deleted the fix_emulator branch January 16, 2026 16:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants