test: unset MOUSE_DPI for the apple magic mouse

As of systemd commit f013e99e160f385a0c02793c612ef4c8a8ffc4d7, ID_BUS is now
set for all bluetooth devices, not just those with subsystem bluetooth. This
affects the Apple Magic Mouse and sets the systemd hwdb's MOUSE_DPI value.

That value is different to the test results we currently have, causing some
tests to fail because different deltas are generated (e.g.
pointer_scroll_button).

Our udev rules are prefixed 99 and thus apply after the various system rules.
So we can't easily set ID_BUS in our rule because it'll apply after
70-mouse.rules checks for the bustype. So we'd have to detect systemd version
or so, but the easy way is to simply force MOUSE_DPI to the empty value. For
our test cases it doesn't matter if the DPI is set correctly anyway.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit 4030959f35)
This commit is contained in:
Peter Hutterer 2017-03-30 12:50:13 +10:00
parent 51cc2088ab
commit c5f3939478

View file

@ -88,6 +88,24 @@ static struct input_absinfo absinfo[] = {
{ .value = -1 }
};
/* Force MOUSE_DPI to the empty string. As of systemd commit f013e99e160f
* ID_BUS=bluetooth now triggers the hwdb entry for this device. This causes
* test case failures because deltas change. Detecting old vs new systemd is
* hard, and because our rules are 99-prefixed we can't set ID_BUS ourselves
* on older systemd.
* So let's go the easy way and unset MOUSE_DPI so we can continue to use
* the current tests.
*/
static const char udev_rule[] =
"ACTION==\"remove\", GOTO=\"mouse_end\"\n"
"KERNEL!=\"event*\", GOTO=\"mouse_end\"\n"
"ENV{ID_INPUT_MOUSE}==\"\", GOTO=\"mouse_end\"\n"
"\n"
"ATTRS{name}==\"litest Apple Magic Mouse\","
" ENV{MOUSE_DPI}=\"\""
"\n"
"LABEL=\"mouse_end\"";
struct litest_test_device litest_magicmouse_device = {
.type = LITEST_MAGICMOUSE,
.features = LITEST_RELATIVE | LITEST_BUTTON | LITEST_WHEEL,
@ -99,4 +117,5 @@ struct litest_test_device litest_magicmouse_device = {
.id = &input_id,
.events = events,
.absinfo = absinfo,
.udev_rule = udev_rule,
};