[PATCH 3/4] Fix tests

Peter Hutterer peter.hutterer at who-t.net
Tue Sep 10 16:24:27 PDT 2013


On Tue, Sep 10, 2013 at 01:08:44PM +0200, David Herrmann wrote:
> On Sat, Sep 7, 2013 at 7:52 AM, Martin Minarik
> <minarik11 at student.fiit.stuba.sk> wrote:
> > This fixes some weird issues from the tests.
> >
> > Signed-off-by: Martin Minarik <minarik11 at student.fiit.stuba.sk>
> >
> > ---
> >  test/test-libevdev-init.c |    5 ++++-
> >  test/test-uinput.c        |    4 ++++
> >  2 files changed, 8 insertions(+), 1 deletion(-)
> >
> > diff --git a/test/test-libevdev-init.c b/test/test-libevdev-init.c
> > index 02dfa8b..0bf30ea 100644
> > --- a/test/test-libevdev-init.c
> > +++ b/test/test-libevdev-init.c
> > @@ -80,7 +80,10 @@ START_TEST(test_init_and_change_fd)
> >                                            EV_KEY, BTN_RIGHT,
> >                                            -1);
> >         ck_assert_msg(rc == 0, "Failed to create uinput device: %s", strerror(-rc));
> > -       ck_assert_int_eq(libevdev_set_fd(dev, uinput_device_get_fd(uidev)), 0);
> > +
> > +       int done = libevdev_set_fd(dev, uinput_device_get_fd(uidev));
> > +
> > +       ck_assert_int_eq(done, 0);
> 
> There is no obvious functional change here. Could you explain why this
> is needed? Does ck_assert_*() do multiple argument evaluations?

looks like it: http://sourceforge.net/p/check/bugs/80/
commit: http://sourceforge.net/p/check/code/596/

having said that, Martin, please add a note in the commit message to what a
failure is. If you couldn't figure it out and it just misbehaves describing
the symptoms may trigger enough recognition that someone else can identify
the source of the issue.

Here's a proposed patch:

>From ce373babab509aaa412f3d474da237d1c905ff6f Mon Sep 17 00:00:00 2001
From: Peter Hutterer <peter.hutterer at who-t.net>
Date: Wed, 11 Sep 2013 09:21:32 +1000
Subject: [PATCH libevdev] Require check 0.9.9

0.9.9 is the first released version with fixed ck_assert_* macros that
don't do multiple expansion.

http://sourceforge.net/p/check/code/596/

Reported-by: Martin Minarik <minarik11 at student.fiit.stuba.sk>
Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
 configure.ac | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/configure.ac b/configure.ac
index d9f9dc9..8e56f42 100644
--- a/configure.ac
+++ b/configure.ac
@@ -39,7 +39,7 @@ if test "x$lt_cv_prog_gnu_ld" = "xyes"; then
 fi
 
 PKG_PROG_PKG_CONFIG()
-PKG_CHECK_MODULES(CHECK, [check], [HAVE_CHECK="yes"], [HAVE_CHECK="no"])
+PKG_CHECK_MODULES(CHECK, [check >= 0.9.9], [HAVE_CHECK="yes"], [HAVE_CHECK="no"])
 if test "x$HAVE_CHECK" != "xyes"; then
        AC_MSG_WARN([check not found - skipping building unit tests])
 fi
-- 
1.8.3.1

Cheers,
   Peter


> >         ck_assert_int_eq(libevdev_set_fd(dev, 0), -EBADF);
> >
> >         ck_assert_int_eq(libevdev_get_fd(dev), uinput_device_get_fd(uidev));
> > diff --git a/test/test-uinput.c b/test/test-uinput.c
> > index 2e9d3cd..0bbc7c8 100644
> > --- a/test/test-uinput.c
> > +++ b/test/test-uinput.c
> > @@ -28,6 +28,10 @@
> >  #include <fcntl.h>
> >  #include <libevdev/libevdev-uinput.h>
> >
> > +#ifndef ck_assert_int_gt
> > +#define ck_assert_int_gt(X, Y) _ck_assert_int(X, >, Y)
> > +#endif
> > +
> 
> That's not how we fix missing declarations. If we depend on a given
> version of "check", we need to define this in configure.ac. If this
> macro isn't available in an older version but you want "make check"
> support, then don't use the macro. We shouldn't paper over it.
> 
> Thanks
> David
> 
> >  #include "test-common.h"
> >  #define UINPUT_NODE "/dev/uinput"
> >
> > --
> > 1.7.10.4


More information about the Input-tools mailing list