diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2016-07-22 13:30:20 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2016-08-02 10:19:38 +1000 |
commit | 68841bfd52904794f4f99aa7eb6af2206ab85025 (patch) | |
tree | d07e2272c2039adc0c1b645ca9732b696557c94a | |
parent | 51fb42cb602ed08f14b49121e02dbf0c5c5e1877 (diff) |
Revert "test: create a lock file to avoid parallel udev reloads during device add"
Not needed anymore, we only have one process creating the udev rules.
This reverts commit 030ec053fbbc17f9bd0a3a8c6003318864986de7.
-rw-r--r-- | configure.ac | 3 | ||||
-rw-r--r-- | test/litest.c | 63 |
2 files changed, 0 insertions, 66 deletions
diff --git a/configure.ac b/configure.ac index 9e238b46..776b98f4 100644 --- a/configure.ac +++ b/configure.ac @@ -194,9 +194,6 @@ if test "x$build_tests" = "xyes"; then AC_DEFINE_UNQUOTED(HAVE_ADDR2LINE, 1, [addr2line found]) AC_DEFINE_UNQUOTED(ADDR2LINE, ["$ADDR2LINE"], [Path to addr2line]) fi - - AC_DEFINE(LITEST_UDEV_LOCKFILE, ["/tmp/litest-udev.lock"], - [Lock file used to restrict udev reloads during tests]) fi AM_CONDITIONAL(HAVE_LIBUNWIND, [test "x$HAVE_LIBUNWIND" = xyes]) diff --git a/test/litest.c b/test/litest.c index 2adec941..0d2d21b2 100644 --- a/test/litest.c +++ b/test/litest.c @@ -1203,58 +1203,6 @@ litest_restore_log_handler(struct libinput *libinput) libinput_log_set_handler(libinput, litest_log_handler); } -static inline int -create_udev_lock_file(void) -{ - int lfd; - - /* Running the multiple tests in parallel usually trips over udev - * not being up-to-date. We change the udev rules for every device - * created, sometimes this means we end up getting the wrong udev - * device, or having wrong properties applied. - * - * litests use the path interface and there is a window between - * creating the device (which triggers udev reloads) and adding the - * device to the libinput context where another udev reload may - * upset things. - * - * To avoid this, create a lockfile on device add and device delete - * to make sure that we have exclusive access to udev while - * the udev rules are reloaded. - */ - do { - lfd = open(LITEST_UDEV_LOCKFILE, O_CREAT|O_EXCL, O_RDWR); - - if (lfd == -1) { - struct stat st; - time_t now = time(NULL); - - litest_assert_int_eq(errno, EEXIST); - msleep(10); - - /* If the lock file is older than 10s, it's a - leftover from some aborted test */ - if (stat(LITEST_UDEV_LOCKFILE, &st) != -1) { - if (st.st_mtime < now - 10) { - fprintf(stderr, - "Removing stale lock file %s.\n", - LITEST_UDEV_LOCKFILE); - unlink(LITEST_UDEV_LOCKFILE); - } - } - } - } while (lfd < 0); - - return lfd; -} - -static inline void -delete_udev_lock_file(int lfd) -{ - close(lfd); - unlink(LITEST_UDEV_LOCKFILE); -} - struct litest_device * litest_add_device_with_overrides(struct libinput *libinput, enum litest_device_type which, @@ -1268,8 +1216,6 @@ litest_add_device_with_overrides(struct libinput *libinput, int rc; const char *path; - int lfd = create_udev_lock_file(); - d = litest_create(which, name_override, id_override, @@ -1295,9 +1241,6 @@ litest_add_device_with_overrides(struct libinput *libinput, d->interface->min[ABS_Y] = libevdev_get_abs_minimum(d->evdev, ABS_Y); d->interface->max[ABS_Y] = libevdev_get_abs_maximum(d->evdev, ABS_Y); } - - delete_udev_lock_file(lfd); - return d; } @@ -1354,13 +1297,9 @@ litest_handle_events(struct litest_device *d) void litest_delete_device(struct litest_device *d) { - int lfd; - if (!d) return; - lfd = create_udev_lock_file(); - libinput_device_unref(d->libinput_device); libinput_path_remove_device(d->libinput_device); if (d->owns_context) @@ -1371,8 +1310,6 @@ litest_delete_device(struct litest_device *d) free(d->private); memset(d,0, sizeof(*d)); free(d); - - delete_udev_lock_file(lfd); } void |