martinpitt / umockdev

Mock hardware devices for creating unit tests and bug reporting
https://launchpad.net/umockdev
GNU Lesser General Public License v2.1
308 stars 54 forks source link

Is it possible to record "remove" udev actions? #212

Closed Degoah closed 1 year ago

Degoah commented 1 year ago

Hi,

I was studying the toolsuite but couldn't find any information if it is possible to record and replay the effects of removing a hot-plugged USB device, i.e. is it possible to start "umockdev-run" and make it record the udev-events when the USB device is removed from the USB port?

Any hints or suggestion, how to test that are very appreciated!

Degoah commented 1 year ago

I have figured it out: It is possible to simulate the sending of "add" and "remove" etc. udev-specific actions by programmatically using the "umockdev" library, i.e. by including "umockdev" and linking againgst the shared umockdev library. For concrete examples just refer to the battery-example provided here, or by taking a look at the unit-test here.