summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2017-03-30 12:50:13 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2017-03-30 12:56:49 +1000
commit4030959f35a3178aa395339637e357af527da0ad (patch)
treef98bb4572b2ea103de0087fab48dfe7f24a081ae /test
parent402be40ba99f3b5e018f027a51e8956a2e0b33a7 (diff)
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>
Diffstat (limited to 'test')
-rw-r--r--test/litest-device-apple-magicmouse.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/test/litest-device-apple-magicmouse.c b/test/litest-device-apple-magicmouse.c
index 29d3b98..0ba84a5 100644
--- a/test/litest-device-apple-magicmouse.c
+++ b/test/litest-device-apple-magicmouse.c
@@ -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,
};