test: print strerror() if uinput device creation fails

The most common error running the test suite is not running as root, but the
error message is hard to interpret. Make it more explicit when it failed,
printing the strerror of the errno.

Note that libevdev 1.3 is needed to get EACCES instead of EBADF
http://cgit.freedesktop.org/libevdev/commit/?id=debe9b030c8069cdf78307888ef3b65830b25122
A workaround is put in place for now until libevdev 1.3 is commonplace.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
Peter Hutterer 2014-09-17 10:30:45 +10:00
parent b9093ca2b1
commit 87c8d82ac5

View file

@ -958,7 +958,11 @@ litest_create_uinput_device_from_description(const char *name,
rc = libevdev_uinput_create_from_device(dev,
LIBEVDEV_UINPUT_OPEN_MANAGED,
&uinput);
ck_assert_int_eq(rc, 0);
/* workaround for a bug in libevdev pre-1.3
http://cgit.freedesktop.org/libevdev/commit/?id=debe9b030c8069cdf78307888ef3b65830b25122 */
if (rc == -EBADF)
rc = -EACCES;
ck_assert_msg(rc == 0, "Failed to create uinput device: %s", strerror(-rc));
libevdev_free(dev);