Re: [Tails-dev] automated tests

Delete this message

Reply to this message
Author: anonym
Date:  
To: The Tails public development discussion list
Subject: Re: [Tails-dev] automated tests
First of all, awesome work!

I've been fairly tied up with other things the past few days and and
will continue to be so until the next week. After that I will take a
real look at your work. At first glance looks very promising (my own
investigation also ended up with sikuli as the best candidate testing
backend), and I'd love to work on it in tandem with you as we discussed
some months ago. Is that still on, you think?

19/06/12 15:52, bertagaz@???:
> On Tue, Jun 19, 2012 at 01:39:17PM +0200, bertagaz@??? wrote:
>> On Tue, Jun 19, 2012 at 01:53:38AM +0200, intrigeri wrote:
>>>
>>> Have you by chance found a way to *emulate* a USB 2.0 device in
>>> software? (qemu-kvm from current Debian testing/sid supports USB 2.0
>>> passthrough, but this is quite different as far as automated tests
>>> are concerned.)
>>
>> Not really investigated in this area yet sorry. Apart from the
>> pass-through method I haven't seen anything else.
>
> Actually I just found http://www.linux-usb.org/gadget/ after a quick
> search. I haven't yet really understood all of this project, but it seems
> it has the feature to emulate USB at the kernel level without any
> hardware. At least if you look at [1], it says:
>
> /*
> 17 * This exposes a device side "USB gadget" API, driven by requests to a
> 18 * Linux-USB host controller driver. USB traffic is simulated; there's
> 19 * no need for USB hardware. Use this with two other drivers:
> 20 *
> 21 * - Gadget driver, responding to requests (slave);
> 22 * - Host-side device driver, as already familiar in Linux.
> 23 *
> 24 * Having this all in one kernel can help some stages of development,
> 25 * bypassing some hardware (and driver) issues. UML could help too.
> 26 */
>
> It requires USB_DUMMY_HCD to be configured in the kernel config, which
> isn't in Debian kernel AFAIK.
>
> Maybe I misunderstood the features, but might deserve some more digging
> still.


Just so no one wastes time examining this, I just want to point out that
this is exactly what we need; I played with the dummy_hcd and
g_file_storage (which also is needed) modules some weeks ago with this
exact use case in mind. For instance, here's how to emulate a 2 GiB USB
storage device:

    dd if=/dev/zero of=usb_drive bs=1M count=2048
    modprobe dummy_hcd
    modprobe g_file_storage file=$PWD/usb_drive


Works like a charm.

Cheers!