Lines Matching +full:test +full:- +full:rules
2 # SPDX-License-Identifier: GPL-2.0
3 # -*- coding: utf-8 -*-
21 logger = logging.getLogger("hidtools.test.base")
142 name = f"uhid test {self.__class__.__name__}"
143 if not name.startswith("uhid test "):
144 name = "uhid test " + self.name
156 # List of kernel modules to load before starting the test
157 # if any module is not available (not compiled), the test will skip.
159 # for example ("playstation", "hid-playstation")
162 # List of in kernel HID-BPF object files to load
163 # before starting the test
164 # Any existing pre-loaded HID-BPF module will be removed
167 # for example '("xppen-ArtistPro16Gen2.bpf.o", True)'
168 # If 'rdesc_fixup_present' is True, the test needs to wait
225 sysfs_path = Path("/sys/module") / kernel_module.replace("-", "_")
230 f"module {kernel_module} could not be loaded, skipping the test"
244 udev_hid_bpf = shutil.which("udev-hid-bpf")
246 pytest.skip("udev-hid-bpf not found in $PATH, skipping")
254 # We need to start `udev-hid-bpf` in the background
259 "udev-hid-bpf",
260 "--verbose",
271 f"Couldn't insert hid-bpf program '{hid_bpf}', marking the test as failed"
275 # the HID-BPF program exports a rdesc fixup, so it needs to be
278 # uhid loading, and then the reload from HID-BPF)
280 while self.uhdev.kernel_ready_count < 2 and time.time() - now < 2:
285 f"Couldn't insert hid-bpf programs, marking the test as failed"
290 ["udev-hid-bpf", "--verbose", "remove", str(self.uhdev.sys_path)],
294 f"Couldn't unload hid-bpf programs, marking the test as failed"
311 test, message, *rest = skip_cond.args
313 if test(self.uhdev):
318 while not self.uhdev.is_ready() and time.time() - now < 5:
363 A context-manager compatible class that sets up our udev rules file and
366 This class is tailored to our test setup: it only sets up the udev rule
369 the session once, then once for each test (the first of which will
370 trigger the udev rule) and once the last test exited and the session
385 self.refs -= 1
391 subprocess.run("udevadm control --reload-rules".split())
392 subprocess.run("systemd-hwdb update".split())
397 os.makedirs("/run/udev/rules.d", exist_ok=True)
399 prefix="91-uhid-test-device-REMOVEME-",
400 suffix=".rules",
402 dir="/run/udev/rules.d",
407 KERNELS=="*input*", ATTRS{name}=="*uhid test *", ENV{LIBINPUT_IGNORE_DEVICE}="1"
408 KERNELS=="*hid*", ENV{HID_NAME}=="*uhid test *", ENV{HID_BPF_IGNORE_DEVICE}="1"
409 KERNELS=="*input*", ATTRS{name}=="*uhid test * System Multi Axis", ENV{ID_INPUT_TOUCHSCREEN}="", EN…