[PATCH libinput 2/2] test: add another wait loop for udev

Peter Hutterer peter.hutterer at who-t.net
Thu May 28 15:21:36 PDT 2015


Wait after deleting a device so udev can catch up with everything and the
various hooks to make sure it's happy with any newly created devices after
this.

The sleep is in the delete path to also cover the tests where we manually
create uinput devices rather than using the litest hooks.

Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
This is me giving up. I tried to work around this by waiting for remove
and add signals from udev monitor but to no avail. What exactly happens I'm
not sure, but the most common test case failure was that after creating a
keyboard uinput device we got a udev device that still had ID_INPUT_TOUCHPAD
set. a race condition, but one I'm not sure how to work around because the
only thing uinput gives us is the event node and that's going to be the same
as the one from the device we just deleted. and that's the only thing we can
hand to udev to give us a udev_device and that's where the race condition
kicks in.

 test/litest.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/test/litest.c b/test/litest.c
index 53c441b..349eca0 100644
--- a/test/litest.c
+++ b/test/litest.c
@@ -1122,6 +1122,11 @@ litest_delete_device(struct litest_device *d)
 	free(d->private);
 	memset(d,0, sizeof(*d));
 	free(d);
+
+	/* zzz so udev can catch up with things, so we don't accidentally open
+	 * an old device in the next test and then get all upset when things blow
+	 * up */
+	msleep(10);
 }
 
 void
-- 
2.4.1



More information about the wayland-devel mailing list