selftests/hid: add tests for hid_hw_raw_request HID-BPF hooks
authorBenjamin Tissoires <bentiss@kernel.org>
Wed, 26 Jun 2024 13:46:27 +0000 (15:46 +0200)
committerBenjamin Tissoires <bentiss@kernel.org>
Thu, 27 Jun 2024 09:00:12 +0000 (11:00 +0200)
commit015a4a2a439b285943da471d38b2721bbe4d8b39
treea3d840ad28df57e4e9bab80e8b57ba6289863fb0
parent75839101ce52e319cb2154a027d14f1f0aa3be09
selftests/hid: add tests for hid_hw_raw_request HID-BPF hooks

We add 3 new tests:
- first, we make sure we can prevent the raw_request to happen
- second, we make sure that we can detect that a given hidraw client
  was actually doing the request, and for that client only, call ourself
  hid_bpf_hw_request(), returning a custom value
- last, we ensure that we can not loop between hooks for
  hid_hw_raw_request() and manual calls to hid_bpf_hw_request() from that
  hook

Link: https://patch.msgid.link/20240626-hid_hw_req_bpf-v2-6-cfd60fb6c79f@kernel.org
Acked-by: Jiri Kosina <jkosina@suse.com>
Signed-off-by: Benjamin Tissoires <bentiss@kernel.org>
tools/testing/selftests/hid/hid_bpf.c
tools/testing/selftests/hid/progs/hid.c