Autopilot tests for SDCard support
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:/
Basically the test cases should be something like:
- Existing SDCard that is mounted under /mount/$USER (for example /mount/
- Mounting SDCard under /mount/$USER (for example /mount/
- Unmounting SDCard from /mount/$USER (for example /mount/
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
Changed in ubuntu-filemanager-app: | |
importance: | Undecided → High |
description: | updated |
Changed in ubuntu-filemanager-app: | |
assignee: | nobody → Carla Sella (carla-sella) |
tags: | added: needs-autopilot-test |
tags: |
added: needs-autopilot-tests removed: needs-autopilot-test |
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.freedeskto p.org/udisks/ tree/src/ tests/integrati on-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).