Autopilot tests for SDCard support

Bug #1406988 reported by Arto Jalkanen
14
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Ubuntu File Manager App
New
High
Carla Sella

Bug Description

Autopilot tests are needed for merge proposal (after it has been approved at least):

https://code.launchpad.net/~ajalkane/ubuntu-filemanager-app/sdcard-support/+merge/245483

Basically the test cases should be something like:

 - Existing SDCard that is mounted under /mount/$USER (for example /mount/$USER/SDCard) will be displayed in Places when FileManager is started.
 - Mounting SDCard under /mount/$USER (for example /mount/$USER/SDCard) will be displayed in Places when FileManager is running.
 - Unmounting SDCard from /mount/$USER (for example /mount/$USER/SDCard) will be displayed in Places

Optional (as I'm not sure how easily these can be done):
 - If no full access (ie. PIN/password required to view all files), then files inside the SDCard directory can not be seen before unlocking full access.
 - If no full access required, then files inside the SDCard directory can be seen.

If doing real SDCard mounting is not possible, tests can perhaps be written to simulate it for example by mounting and unmounting some directory to the correct path:

# fakesdcarddev and SDCard directories must exist
sudo mount --bind /tmp/fakesdcarddev /media/$USER/SDCard
# Unmounting:
sudo umount /media/$USER/SDCard

Arto Jalkanen (ajalkane)
Changed in ubuntu-filemanager-app:
importance: Undecided → High
Arto Jalkanen (ajalkane)
description: updated
Changed in ubuntu-filemanager-app:
assignee: nobody → Carla Sella (carla-sella)
tags: added: needs-autopilot-test
Revision history for this message
Martin Pitt (pitti) wrote :

Note that umockdev isn't good enough for simulating the actual behaviour of storage devices, the SCSI/mount/etc. actions are just too complex. If you merely want to *detect* the appearance/disappearance of storage devices (i. e. the /sys/block/*) bits, it's fine of course, but you could never mount it.

The best tool that we currently have to simulate storage devices is the "scsi_debug" kernel module. Loading it will give you a RAM backed /dev/sdb (or whatever) block device which by and large looks like a normal SCSI disk. There are options to set different sizes, SCSI types (https://en.wikipedia.org/wiki/SCSI_Peripheral_Device_Type), failure modes etc., just unfortunately there is no particular SCSI type for "SD card".

udisks' integration tests use that, so you can see how it looks like in setup_vdev() here: http://cgit.freedesktop.org/udisks/tree/src/tests/integration-test#n365

This also shows how to write a temporary udev rule in /run/udev/rules.d that matches on the scsi_debug block device and thus can set arbitrary udev properties on it. That might be useful to fake the SD card harder; I don't know what filemanager-app uses to detect the device type, but on the standard Ubuntu desktop we use udev rule to flag those with ENV{ID_DRIVE_FLASH_SD}="1" (which you could set in above udev rule), udisks2 picks that up and exports that as "block device type" to the desktop (usually via gvfs, but I suppose we don't use that on the phone).

Revision history for this message
Carla Sella (carla-sella) wrote :

I reported this bug: https://bugs.launchpad.net/autopilot/+bug/1423342 as SDCard fake is needed for SDCard autopilot tests for filemanager.

tags: added: needs-autopilot-tests
removed: needs-autopilot-test
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.