We don't want any of the test devices to match the local machine's DMI
modalias. This was a major drawback in the previous test suite, hacking the
dmi modalias string was nontrivial but a wrong string could cause false
positives or negatives.

The quirks system is internal, so rather than having some fancy API we just
hook it off the environment variable that the test suite always sets. Hacky,
but a lot easier than the other options.

Signed-off-by: Peter Hutterer <peter.hutte...@who-t.net>
---
 src/quirks.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/quirks.c b/src/quirks.c
index 7cef8a79..b88d8bc9 100644
--- a/src/quirks.c
+++ b/src/quirks.c
@@ -122,7 +122,7 @@ struct match {
        uint32_t vendor;
        uint32_t product;
 
-       char *dmi;
+       char *dmi;      /* dmi modalias with preceding "dmi:" */
 
        /* We can have more than one type set, so this is a bitfield */
        uint32_t udev_type;
@@ -337,10 +337,13 @@ init_dmi(void)
 {
        struct udev *udev;
        struct udev_device *udev_device;
-       const char *modalias;
+       const char *modalias = NULL;
        char *copy = NULL;
        const char *syspath = "/sys/devices/virtual/dmi/id";
 
+       if (getenv("LIBINPUT_RUNNING_TEST_SUITE"))
+               return safe_strdup("dmi:");
+
        udev = udev_new();
        if (!udev)
                return NULL;
-- 
2.14.4

_______________________________________________
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel

Reply via email to