[PATCH libinput 5/6] test: reduce the time we're holding the udev lock

Peter Hutterer peter.hutterer at who-t.net
Tue Jul 19 03:18:56 UTC 2016


Once we have the device and an open fd we can drop the lock, it's not going to
change anymore now. libevdev inits from the open fd and we can do the other
checks afterwards.

Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
 test/litest.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/test/litest.c b/test/litest.c
index 9a274fa..56b9364 100644
--- a/test/litest.c
+++ b/test/litest.c
@@ -1245,14 +1245,16 @@ litest_add_device_with_overrides(struct libinput *libinput,
 
 	path = libevdev_uinput_get_devnode(d->uinput);
 	litest_assert(path != NULL);
+	d->libinput = libinput;
+	d->libinput_device = libinput_path_add_device(d->libinput, path);
 	fd = open(path, O_RDWR|O_NONBLOCK);
 	litest_assert_int_ne(fd, -1);
 
+	delete_udev_lock_file(lfd);
+
 	rc = libevdev_new_from_fd(fd, &d->evdev);
 	litest_assert_int_eq(rc, 0);
 
-	d->libinput = libinput;
-	d->libinput_device = libinput_path_add_device(d->libinput, path);
 	litest_assert(d->libinput_device != NULL);
 	libinput_device_ref(d->libinput_device);
 
@@ -1263,8 +1265,6 @@ litest_add_device_with_overrides(struct libinput *libinput,
 		d->interface->max[ABS_Y] = libevdev_get_abs_maximum(d->evdev, ABS_Y);
 	}
 
-	delete_udev_lock_file(lfd);
-
 	return d;
 }
 
-- 
2.7.4



More information about the wayland-devel mailing list