selftests/hid: skip tests with HID-BPF if udev-hid-bpf is not installed
authorBenjamin Tissoires <bentiss@kernel.org>
Mon, 6 May 2024 14:36:12 +0000 (16:36 +0200)
committerBenjamin Tissoires <bentiss@kernel.org>
Tue, 7 May 2024 13:39:58 +0000 (15:39 +0200)
udev-hid-bpf is still not installed everywhere, and we should probably
not assume it is installed automatically.

Link: https://lore.kernel.org/r/20240506143612.148031-1-bentiss@kernel.org
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Benjamin Tissoires <bentiss@kernel.org>
tools/testing/selftests/hid/tests/base.py

index 2d006c0f5fcd7f66c4283bfe73a3d8b3e90aa027..3a465768e507dd8fe540c60ebc2dd3a133e6f19b 100644 (file)
@@ -8,6 +8,7 @@
 import libevdev
 import os
 import pytest
+import shutil
 import subprocess
 import time
 
@@ -240,6 +241,10 @@ class BaseTestCase:
             root_dir = (script_dir / "../../../../..").resolve()
             bpf_dir = root_dir / "drivers/hid/bpf/progs"
 
+            udev_hid_bpf = shutil.which("udev-hid-bpf")
+            if not udev_hid_bpf:
+                pytest.skip("udev-hid-bpf not found in $PATH, skipping")
+
             wait = False
             for _, rdesc_fixup in self.hid_bpfs:
                 if rdesc_fixup: