From: Peter Hutterer Date: Wed, 17 Sep 2014 00:30:45 +0000 (+1000) Subject: test: print strerror() if uinput device creation fails X-Git-Tag: 0.7.0~151 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=87c8d82ac5d5297a38af3dc0bc3f7af6dfcbec54;p=platform%2Fupstream%2Flibinput.git 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 --- diff --git a/test/litest.c b/test/litest.c index dbbf0543..f99d145a 100644 --- a/test/litest.c +++ b/test/litest.c @@ -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);