[PATCH 19/18] selftests/hid: skip tests with HID-BPF if udev-hid-bpf is not installed

From: bentiss
Date: Mon May 06 2024 - 10:36:38 EST


From: Benjamin Tissoires <bentiss@xxxxxxxxxx>

udev-hid-bpf is still not installed everywhere, and we should probably
not assume it is installed automatically.

Signed-off-by: Benjamin Tissoires <bentiss@xxxxxxxxxx>
---

I wanted to apply this series given that it wasn't reviewed in a month,
but I thought that maybe I should not enforce ude-hid-bpf to be
installed everywhere.

I'll probably push this series tomorrow so it makes the 6.10 cut.

Cheers,
Benjamin

tools/testing/selftests/hid/tests/base.py | 5 +++++
1 file changed, 5 insertions(+)

diff --git a/tools/testing/selftests/hid/tests/base.py b/tools/testing/selftests/hid/tests/base.py
index 2d006c0f5fcd..3a465768e507 100644
--- a/tools/testing/selftests/hid/tests/base.py
+++ b/tools/testing/selftests/hid/tests/base.py
@@ -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:
--
2.44.0