Open Degoah opened 4 months ago
Right, umockdev doesn't do mass storage. That's too complicated to emulate, you are better off with using scsi_debug
, loop devices, etc. If you don't actually need to mount it, just get information, then it should be possible though -- contributions appreciated! (I won't work on this myself).
I've spent several hours trying to achieve this with umockdev. Based on your response, it seems like updating the documentation to explicitly mention that mass storage devices are not currently supported would be helpful for future users.
I see, loop device could be used...Yes, I don't need to mount the devices for my integration/unit tests. But right now I'm unsure, how to achieve this with loop devices. Am I right, that I need to create an image file, format it for example with ext4 and map it onto a loop device to get the filesystem information (label, model serial no.) for example with the "blkid" library?
What is the easiest solution probably depends a lot on what you need. One could:
Those are just a few ideas, I am sure there are other possible solutions. What makes sense for you likely depends a lot on what exactly you need to test.
Description:
I am trying to use
umockdev-record
to capture the behavior of my application that interacts with a USB mass storage device. My trivial application, namedget_usb_stick_info
, uses theioctl
system call with theSG_IO
command to retrieve information from the device.The application code is provided below:
However, when I record the interaction using the following command:
The generated file
usb_stick.ioctl
file only contains the line@dev /dev/sda
.It seems that
umockdev-record
is not capturing the actual ioctl system calls being made by my application.Expected Behavior:
The
usb_stick.ioctl
file should contain the details of the ioctl system call. This would allow me to replay the interaction with the USB device in a mock environment.System Information: