[Android] Dinamically set test cases dir under app's specific storage - #5439
Conversation
|
|
||
| def get_testcases_directory(): | ||
| """Returns the testcases directory.""" | ||
| testcases_dir = environment.get_value('DEVICE_TESTCASES_DIR', |
There was a problem hiding this comment.
Maybe i should always grab the default value here, this way jobs that already define a custom test cases dir path continue to work
There was a problem hiding this comment.
wait, but if jobs define a custom device testcase dir they will still continue to fail silently(i.e. the file is not readable by the app)
There was a problem hiding this comment.
Removed the ability to override the DEVICE_TESTCASES_DIR
c15c41d to
293cf3b
Compare
letitz
left a comment
There was a problem hiding this comment.
LGTM % small changes. Thanks for sending this and sorry for the wait!
decoNR
left a comment
There was a problem hiding this comment.
Although I do not have much context on this, the changes are specific to Android and do not affect other parts. Additionally, as noted in the description, they have been tested. LGTM.
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 startwhich 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):

But after this changes the html renders successfully!

Learn more:
Alternative
adb reverse tcp:8000 tcp:8000, this is what we usually do in regular chrome tests, clusterfuzz already support's this, and this is controlled by the fuzzer, not by the job, if the fuzzer testcases have the 'http' word in the filename then clusterfuzz will serve them trough http, but i think nevertheless we need to make this change to keep our options open for any case we don't want to serve them trough http.Changes
/sdcard/Android/data/{PKG_NAME}/files/which is always reable by the given app./sdcard/Android/data/{PKG_NAME}/files/*.