Closed Bug 1182086 Opened 8 years ago Closed 8 years ago

[Aries] navigator.getDeviceStorage('sdCard') doesn't return the same sdCard we have in the Flame

Categories

(Firefox OS Graveyard :: Gaia::UI Tests, defect)

ARM
Gonk (Firefox OS)
defect
Not set
normal

Tracking

(b2g-master affected)

RESOLVED FIXED
Tracking Status
b2g-master --- affected

People

(Reporter: jlorenzo, Assigned: martijn.martijn)

References

Details

Attachments

(3 files)

This makes some tests fail this way:
> TEST-UNEXPECTED-FAIL | test_browser_save_image.py TestBrowserSaveImage.test_browser_save_image | AssertionError: 0 != 5
>
> Traceback (most recent call last):
>   File "/home/jlorenzo/git/gaia/tests/python/gaia-ui-tests/.env/lib/python2.7/site-packages/marionette_client-0.16-py2.7.egg/marionette/marionette_test.py", line 296, in run
>     testMethod()
>   File "/home/jlorenzo/git/gaia/tests/python/gaia-ui-tests/gaiatest/tests/functional/browser/test_browser_save_image.py", line 27, in test_browser_save_image
>     self.assertEqual(0, len(self.data_layer.sdcard_files('.jpeg')))
> TEST-INFO took 38927ms



We need to change getDeviceStorage to getDeviceStorages() and get the right one, here: https://github.com/mozilla-b2g/gaia/blob/master/tests/atoms/gaia_data_layer.js#L478
See Also: → 1182093
Assignee: nobody → jlorenzo
It turns out that the gallery tests pass on the latest build[1]. Here's a job showing it[2].

[1] Build ID               20150825021113
Gaia Revision          b441bde54293bea5254dc340845effe951fa3906
Gaia Date              2015-08-24 17:47:19
Gecko Revision         https://hg.mozilla.org/mozilla-central/rev/04b8c412d9f58fb6194c58dcaa66bf278bbd53cf
Gecko Version          43.0a1
Device Name            aries
Firmware(Release)      4.4.2
Firmware(Incremental)  eng.worker.20150825.013149
Firmware Date          Tue Aug 25 01:31:57 UTC 2015
Bootloader             s1

[2] http://jenkins1.qa.scl3.mozilla.com/job/aries.mozilla-central.nightly.ui.functional.smoke/67/console
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → WORKSFORME
Scratch the link [2] in the previous comment. We can't have a correct build with Jenkins today. It fails to download the pip dependencies.

John, could you tell me if the test also passes on your Aries? If so, let's close this bug as Works for me.
Status: RESOLVED → REOPENED
Flags: needinfo?(jdorlus)
Resolution: WORKSFORME → ---
I just tested out test_browser_save_image.py here on my Aries device and it passes for me locally as well. So marking wfm.
Status: REOPENED → RESOLVED
Closed: 8 years ago8 years ago
Flags: needinfo?(jdorlus)
Resolution: --- → WORKSFORME
Oh, this is also about the gallery tests? 
There are a whole bunch of them failing on my Aries device:
test_gallery_view.py test_gallery_view.TestGallery.test_gallery_view
test_gallery_empty.py test_gallery_empty.TestGalleryEmpty.test_empty_gallery
test_gallery_flick.py test_gallery_flick.TestGallery.test_gallery_full_screen_image_flicks
test_gallery_delete_image.py test_gallery_delete_image.TestGalleryDelete.test_gallery_delete_image
test_gallery_delete_multiple_images.py test_gallery_delete_multiple_images.TestGalleryMultiDelete.test_gallery_delete_image
test_gallery_crop_photo.py test_gallery_crop_photo.TestGalleryCropPhoto.test_gallery_crop_photo
test_gallery_handle_invalid_file.py test_gallery_handle_invalid_file.TestGalleryHandleInvalidPhoto.test_gallery_handle_load_corrupt_file_text_file
test_gallery_handle_invalid_file.py test_gallery_handle_invalid_file.TestGalleryHandleInvalidPhoto.test_gallery_handle_load_corrupt_file_truncated_bmp
test_gallery_handle_invalid_file.py test_gallery_handle_invalid_file.TestGalleryHandleInvalidPhoto.test_gallery_handle_load_corrupt_file_truncated_gif
test_gallery_handle_invalid_file.py test_gallery_handle_invalid_file.TestGalleryHandleInvalidPhoto.test_gallery_handle_load_corrupt_file_truncated_jpg
test_gallery_handle_invalid_file.py test_gallery_handle_invalid_file.TestGalleryHandleInvalidPhoto.test_gallery_handle_load_corrupt_file_truncated_png
test_gallery_handle_invalid_file.py test_gallery_handle_invalid_file.TestGalleryHandleInvalidPhoto.test_gallery_handle_load_corrupt_file_zero_length_file
test_gallery_switch_to_camera_main_view.py test_gallery_switch_to_camera_main_view.TestGallery.test_gallery_view


Most of them failing in gallery.wait_for_files_to_load or while using self.data_layer.picture_files.
Status: RESOLVED → REOPENED
Resolution: WORKSFORME → ---
test_gallery_switch_to_camera.py works if I remove all the pictures before I run the test. 
I guess for some reason pictures are not deleted very well.
When I run the test again, it fails again.
It looks like the pictures that were taken by the camera are not deleted between runs.
An image that is taken by the camera is stored here: /mnt/sdcard/DCIM/100MZLLA/IMG_0001.jpg on the Aries device.
When I add '/mnt/sdcard/DCIM/' to the list of storage_paths: http://mxr.mozilla.org/gaia/source/tests/python/gaia-ui-tests/gaiatest/gaia_test.py#938
Then the test is passing when repeating it.
Attached patch all.diffSplinter Review
Some printing statements I added. While running the test, I get:
('storage_path: %s', '/storage/sdcard0/tests')
Removing: /cache/*
Removing: /data/b2g/mozilla
Removing: /data/local/debug_info_trigger
Removing: /data/local/indexedDB
Removing: /data/local/OfflineCache
Removing: /data/local/permissions.sqlite
Removing: /data/local/storage/permanent
Removing: /data/local/storage/persistent
Removing: /data/local/storage/default
Removing: /data/misc/wifi/wpa_supplicant.conf
storage_paths: ['/storage/sdcard0/tests', '/mnt/sdcard', '/mnt/extsdcard', '/storage/sdcard', '/storage/sdcard0', '/storage/sdcard1']
['IMG_0001.jpg']
Removing: /storage/sdcard0/tests/IMG_0001.jpg
[]
[]
[]

It looks like it can't find the directory DCIM in /mnt/sdcard/ at all. Also, the hidden '.gallery' directly is not found on the Aries device.

On the Flame device, the DCIM directory is found just fine and then subsequently removed.

I wonder if the '.gallery' directoy on the Aries device is causing this.
Attached patch dcim.diffSplinter Review
Like I said, this fixes it. But it would be better if we would fix the underlying issue here.
Dave, do you know why self.device.file_manager.list_items('/mnt/sdcard') can't find the '.gallery' and 'DCIM' directories for Aries devices?

It think that listFiles method is taking care of this, right?
http://mxr.mozilla.org/mozilla-central/source/testing/mozbase/mozdevice/mozdevice/devicemanagerADB.py#294
Flags: needinfo?(dave.hunt)
(In reply to Martijn Wargers [:mwargers] (QA) from comment #9)
> Dave, do you know why self.device.file_manager.list_items('/mnt/sdcard')
> can't find the '.gallery' and 'DCIM' directories for Aries devices?
> 
> It think that listFiles method is taking care of this, right?
> http://mxr.mozilla.org/mozilla-central/source/testing/mozbase/mozdevice/
> mozdevice/devicemanagerADB.py#294

Yes, list_items calls down to mozdevice when running against a device. This is just running shell on the device via ADB so you should be able to reproduce any strange behaviour manually to determine if it's a mozdevice bug at all.

I think the solution here to fix bug 1018079, and the workaround is to add the new storage path to the hardcoded list.
Flags: needinfo?(dave.hunt)
Oh, what I noticed the difference when I do this on the Aries device:
(test3)mwargers:gaia_clean mwargers$ adb shell ls -a /sdcard
/sdcard
(test3)mwargers:gaia_clean mwargers$ adb shell ls -a /sdcard/
.gallery
DCIM
tests
Comment on attachment 8654080 [details] [review]
[gaia] mwargers:1182086 > mozilla-b2g:master

This makes test_gallery_switch_to_camera.py pass when I run it repeatedly.

Flame has the same behavior as Aries, but not in the storage directory, for some reason:
(test3)mwargers:gaia_clean mwargers$ adb shell ls -a /sdcard
/sdcard
(test3)mwargers:gaia_clean mwargers$ adb shell ls -a /sdcard/
DCIM
(test3)mwargers:gaia_clean mwargers$ adb shell ls -a /storage/sdcard
DCIM
(test3)mwargers:gaia_clean mwargers$ adb shell ls -a /storage/sdcard/
DCIM

So for that reason, it wasn't an issue for Flame.
Attachment #8654080 - Flags: review?(dave.hunt)
Comment on attachment 8654080 [details] [review]
[gaia] mwargers:1182086 > mozilla-b2g:master

On Aries, /sdcard doesn't point to /storage/sdcard:
> adb shell ls -al /sdcard
> lrwxrwxrwx root     root              1970-06-23 01:19 sdcard -> /storage/emulated/legacy

> adb shell ls -al /storage/emulated/legacy
> lrwxrwxrwx root     root              1970-06-23 01:19 legacy -> /mnt/shell/emulated/0

> adb shell ls -al /mnt/shell/emulated/0   
> drwxrwx--- root     sdcard_r          2015-08-25 17:03 tests

That might be due to the emulation.

I checked the following against test_gallery_flick.py:
1. Without your patch, run the test twice => Both runs passed
2. Without your patch, take a picture and run the test again => It failed, the photo I took was still present
3. With your patch and the photo remaining, run the test => It passed

The patch looks simple enough to me. Thanks for looking into it, Martijn!
Attachment #8654080 - Flags: review+
Comment on attachment 8654080 [details] [review]
[gaia] mwargers:1182086 > mozilla-b2g:master

Looks okay, but deferring to those closer to the project for review.
Attachment #8654080 - Flags: review?(dave.hunt)
Attachment #8654080 - Flags: review?(jdorlus)
Assignee: jlorenzo → martijn.martijn
Attachment #8654080 - Flags: review?(jdorlus) → review+
Merged: https://github.com/mozilla-b2g/gaia/commit/756d72f3023d5e77b4c1143f14eb80fb74ba67a5
Status: REOPENED → RESOLVED
Closed: 8 years ago8 years ago
Resolution: --- → FIXED
Depends on: 1212375
You need to log in before you can comment on or make changes to this bug.