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

Fully remove USB children when the parent USB device is removed #238

Closed bobhenz-jabil closed 4 weeks ago

bobhenz-jabil commented 4 months ago

Suggested fix for https://github.com/martinpitt/umockdev/issues/237

bobhenz-jabil commented 3 months ago

@martinpitt: Do these code changes look better?

martinpitt commented 3 months ago

@bobhenz-jabil sorry for the late response, it's holiday season here. The changes look good, thanks! They still need to grow some unit tests. If you want to add them, please do, otherwise I'll work on them.

But first I need to unbreak the build on Fedora, the new gcc broke vala/glib hard. I've already spent several hours on a "proper" solution, but I suppose I'll go with a quick hack for now.

martinpitt commented 3 months ago

I just fixed the last remaining build issue (#239), and took the liberty to rebase your branch, so that the tests can run again. Note that this is still blocked by adding unit tests for the remove event and child removal.

bobhenz-jabil commented 1 month ago

@martinpitt : My apologies for the lengthy delay. I have finally gotten around to adding the following commits to this PR:

  1. Tweak an existing "uevent" test as it was manually invoking uevent() after adding a device when add_device() will invoke uevent() internally anyway.
  2. Add a test for removing a single device. (verify that uevent() was called)
  3. Add a test for removing a parent device. (verify that uevent() was called for it and each of its children)

I have also rebased on the latest main. Please let me know what you think.

martinpitt commented 1 month ago

@bobhenz-jabil please ignore the debian-testing failures. It's a meson regression: https://github.com/mesonbuild/meson/issues/13461

bobhenz-jabil commented 1 month ago

@martinpitt : Fixed-up the PR per your suggestions (I believe). Let me know if I missed anything.