udev: make sure the udev callout path is valid for a test run

udev requires callout binaries to sit in /lib/udev or otherwise provide an
absolute path. The test suite should work without installing everything first,
so create two rule files - one to install, one with the path to the
$builddir/test

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
This commit is contained in:
Peter Hutterer 2015-07-01 10:17:48 +10:00
parent cc59c8986f
commit 4e39443757
6 changed files with 24 additions and 3 deletions

View file

@ -184,6 +184,12 @@ AM_CONDITIONAL(HAVE_VALGRIND, [test "x$VALGRIND" != "x"])
AM_CONDITIONAL(BUILD_TESTS, [test "x$build_tests" = "xyes"])
AM_CONDITIONAL(BUILD_DOCS, [test "x$build_documentation" = "xyes"])
# Used by the udev rules so we can use callouts during testing without
# installing everything first. Default is the empty string so the installed
# rule will use udev's default path. Override is in udev/Makefile.am
AC_SUBST(UDEV_TEST_PATH, "")
AC_PATH_PROG(SED, [sed])
AC_CONFIG_FILES([Makefile
doc/Makefile
doc/libinput.doxygen
@ -192,7 +198,9 @@ AC_CONFIG_FILES([Makefile
src/libinput-version.h
test/Makefile
tools/Makefile
udev/Makefile])
udev/Makefile
udev/80-libinput-device-groups.rules
udev/90-libinput-model-quirks.rules])
AC_CONFIG_FILES([test/symbols-leak-test],
[chmod +x test/symbols-leak-test])
AC_OUTPUT

View file

@ -43,7 +43,7 @@ liblitest_la_SOURCES = \
litest.c
liblitest_la_LIBADD = $(top_builddir)/src/libinput-util.la
liblitest_la_CFLAGS = $(AM_CFLAGS) \
-DLIBINPUT_UDEV_RULES_FILE="\"$(abs_top_srcdir)/udev/90-libinput-model-quirks.rules\"" \
-DLIBINPUT_UDEV_RULES_FILE="\"$(abs_top_srcdir)/udev/90-libinput-model-quirks-litest.rules\"" \
-DLIBINPUT_UDEV_HWDB_FILE="\"$(abs_top_srcdir)/udev/90-libinput-model-quirks.hwdb\""
if HAVE_LIBUNWIND
liblitest_la_LIBADD += $(LIBUNWIND_LIBS) -ldl

1
udev/.gitignore vendored
View file

@ -1 +1,2 @@
libinput-device-group
*.rules

View file

@ -2,7 +2,7 @@ ACTION!="add|change", GOTO="libinput_device_group_end"
KERNEL!="event[0-9]*", GOTO="libinput_device_group_end"
ATTRS{phys}=="?*", \
PROGRAM="libinput-device-group %S%p", \
PROGRAM="@UDEV_TEST_PATH@libinput-device-group %S%p", \
ENV{LIBINPUT_DEVICE_GROUP}="%c"
LABEL="libinput_device_group_end"

View file

@ -1,6 +1,10 @@
udevdir=$(UDEV_DIR)
udev_PROGRAMS = libinput-device-group
litest_rules = 80-libinput-device-groups-litest.rules \
90-libinput-model-quirks-litest.rules
udev_SCRIPTS = $(litest_rules)
libinput_device_group_SOURCES = libinput-device-group.c
libinput_device_group_CFLAGS = $(LIBUDEV_CFLAGS) $(GCC_CFLAGS)
libinput_device_group_LDADD = $(LIBUDEV_LIBS)
@ -13,3 +17,11 @@ dist_udev_rules_DATA = \
udev_hwdbdir=$(UDEV_DIR)/hwdb.d
dist_udev_hwdb_DATA = \
90-libinput-model-quirks.hwdb
%-litest.rules: %.rules.in
$(SED) -e "s|\@UDEV_TEST_PATH\@|$(abs_builddir)/|" < $^ > $@
CLEANFILES = $(litest_rules)
DISTCLEANFILES = \
80-libinput-device-groups.rules \
90-libinput-model-quirks.rules