[PATCH v2 libinput 06/14] quirks: use an empty dmi modalias string for the test suite
Peter Hutterer
peter.hutterer at who-t.net
Fri Jun 8 06:00:13 UTC 2018
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.hutterer at 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
More information about the wayland-devel
mailing list