diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2020-02-12 18:04:41 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2020-02-12 21:22:01 +1000 |
commit | 0dcb02d369fd58b01d2737ae989468d05467ed8b (patch) | |
tree | f8b55c0c0dcc2245d5151d6d0d26d382858f8c9a /test/litest.c | |
parent | 5a51add5f368dce6add5da7e021b0112144b55cd (diff) |
test: add a test case for checking EVDEV_ABS overrides
Problem: it's still not a 100% check because the way real udev handles the
EVDEV_ABS overrides ignores any that are set through udev properties only. So
we manually have to trigger the keyboard builtin for our test device which
can give us false positives (e.g. it wouldn't have detected #424). But still,
it'll alert us if the actual overridden values are different to what we
expect.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'test/litest.c')
-rw-r--r-- | test/litest.c | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/test/litest.c b/test/litest.c index 8d7875c2..783c1380 100644 --- a/test/litest.c +++ b/test/litest.c @@ -692,6 +692,7 @@ litest_init_device_udev_rules(struct litest_test_device *dev, FILE *f) { const struct key_value_str *kv; static int count; + bool need_keyboard_builtin = false; if (dev->udev_properties[0].key == NULL) return; @@ -707,10 +708,27 @@ litest_init_device_udev_rules(struct litest_test_device *dev, FILE *f) kv = dev->udev_properties; while (kv->key) { fprintf(f, ", \\\n\tENV{%s}=\"%s\"", kv->key, kv->value); + if (strneq(kv->key, "EVDEV_ABS_", 10)) + need_keyboard_builtin = true; kv++; } - fprintf(f, "\n"); + + /* Special case: the udev keyboard builtin is only run for hwdb + * matches but we don't set any up in litest. So instead scan the + * device's udev properties for any EVDEV_ABS properties and where + * they exist, force a (re-)run of the keyboard builtin to set up + * the evdev device correctly. + * This needs to be done as separate rule apparently, otherwise the + * ENV variables aren't set yet by the time the builtin runs. + */ + if (need_keyboard_builtin) { + fprintf(f, "" + "ATTRS{name}==\"litest %s*\"," + " IMPORT{builtin}+=\"keyboard\"\n", + dev->name); + } + fprintf(f, "LABEL=\"rule%d_end\"\n\n", count);; } |