Skip to content

[Android] Dinamically set test cases dir under app's specific storage - #5439

Draft
IvanBM18 wants to merge 3 commits into
masterfrom
fix/android/wrong_testcase_path
Draft

[Android] Dinamically set test cases dir under app's specific storage#5439
IvanBM18 wants to merge 3 commits into
masterfrom
fix/android/wrong_testcase_path

Conversation

@IvanBM18

@IvanBM18 IvanBM18 commented Aug 26, 2026

Copy link
Copy Markdown
Collaborator

Bug: b/545195031

Since Android API level 30(and all apps targeting android 11+), apps have scoped storage access, and we can only give it external storage permissions at runtime by a user facing dialog. To avoid this, we now copy the testcases to the app's external app-specific storage , which is always readable by our app's package.

We didn't noticed this issues because all test cases execute using am start which almost the 99% of the time returns no error codes, hence we though that the test case executed but that is not the case.

Example for chrome: Previously, if we tried to execute our test case, the app would tell us it can't find the file(because of the read external storage permissions):
TODO
But after this changes the html renders successfully!
TODO

Learn more:

Alternative

  • The other alternative is to serve the testcases html/js/css files trough a simple localhost server trough adb reverse tcp:8000 tcp:8000, this is what we usually do in regular chrome tests, clusterfuzz already support's this, but i think nevertheless we need to make this change to keep our options open.

Changes

  • Always pushes files to this directory /sdcard/Android/data/{PKG_NAME}/files/ which is always reable by the given app.
  • Dynamically calculate the Test case directory based off the app's pkg
  • Now at fuzz session setup we clean from /sdcard/Android/data/{PKG_NAME}/files/*.

Tests performed

@IvanBM18 IvanBM18 changed the title [Android] Dinamically set test cases dir from android data [Android] Dinamically set test cases dir under /sdcard/Android/data Aug 26, 2026
@IvanBM18 IvanBM18 changed the title [Android] Dinamically set test cases dir under /sdcard/Android/data [Android] Dinamically set test cases dir under app's specific storage Aug 26, 2026

def get_testcases_directory():
"""Returns the testcases directory."""
testcases_dir = environment.get_value('DEVICE_TESTCASES_DIR',

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe i should always grab the default value here, this way jobs that already define a custom test cases dir path continue to work

@IvanBM18
IvanBM18 force-pushed the fix/android/wrong_testcase_path branch from cdaab95 to c85946e Compare September 1, 2026 00:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant