summaryrefslogtreecommitdiffstats
path: root/tools/testing/selftests/hid
Commit message (Collapse)AuthorAgeFilesLines
* Merge tag 'for-netdev' of ↵Jakub Kicinski2023-07-131-3/+3
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next Alexei Starovoitov says: ==================== pull-request: bpf-next 2023-07-13 We've added 67 non-merge commits during the last 15 day(s) which contain a total of 106 files changed, 4444 insertions(+), 619 deletions(-). The main changes are: 1) Fix bpftool build in presence of stale vmlinux.h, from Alexander Lobakin. 2) Introduce bpf_me_mcache_free_rcu() and fix OOM under stress, from Alexei Starovoitov. 3) Teach verifier actual bounds of bpf_get_smp_processor_id() and fix perf+libbpf issue related to custom section handling, from Andrii Nakryiko. 4) Introduce bpf map element count, from Anton Protopopov. 5) Check skb ownership against full socket, from Kui-Feng Lee. 6) Support for up to 12 arguments in BPF trampoline, from Menglong Dong. 7) Export rcu_request_urgent_qs_task, from Paul E. McKenney. 8) Fix BTF walking of unions, from Yafang Shao. 9) Extend link_info for kprobe_multi and perf_event links, from Yafang Shao. * tag 'for-netdev' of https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next: (67 commits) selftests/bpf: Add selftest for PTR_UNTRUSTED bpf: Fix an error in verifying a field in a union selftests/bpf: Add selftests for nested_trust bpf: Fix an error around PTR_UNTRUSTED selftests/bpf: add testcase for TRACING with 6+ arguments bpf, x86: allow function arguments up to 12 for TRACING bpf, x86: save/restore regs with BPF_DW size bpftool: Use "fallthrough;" keyword instead of comments bpf: Add object leak check. bpf: Convert bpf_cpumask to bpf_mem_cache_free_rcu. bpf: Introduce bpf_mem_free_rcu() similar to kfree_rcu(). selftests/bpf: Improve test coverage of bpf_mem_alloc. rcu: Export rcu_request_urgent_qs_task() bpf: Allow reuse from waiting_for_gp_ttrace list. bpf: Add a hint to allocated objects. bpf: Change bpf_mem_cache draining process. bpf: Further refactor alloc_bulk(). bpf: Factor out inc/dec of active flag into helpers. bpf: Refactor alloc_bulk(). bpf: Let free_all() return the number of freed elements. ... ==================== Link: https://lore.kernel.org/r/20230714020910.80794-1-alexei.starovoitov@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
| * bpf: Replace deprecated -target with --target= for ClangFangrui Song2023-06-291-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | The -target option has been deprecated since clang 3.4 in 2013. Therefore, use the preferred --target=bpf form instead. This also matches how we use --target= in scripts/Makefile.clang. Signed-off-by: Fangrui Song <maskray@google.com> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Acked-by: Yonghong Song <yhs@fb.com> Acked-by: Quentin Monnet <quentin@isovalent.com> Link: https://github.com/llvm/llvm-project/commit/274b6f0c87a6a1798de0a68135afc7f95def6277 Link: https://lore.kernel.org/bpf/20230624001856.1903733-1-maskray@google.com
* | selftests: hid: fix vmtests.sh not running make headersBenjamin Tissoires2023-07-091-0/+1
| | | | | | | | | | | | | | | | | | | | | | According to commit 01d6c48a828b ("Documentation: kselftest: "make headers" is a prerequisite"), running the kselftests requires to run "make headers" first. Do that in "vmtest.sh" as well to fix the HID CI. Link: https://lore.kernel.org/r/20230709-fix-selftests-v1-1-57d0878114cc@kernel.org Signed-off-by: Benjamin Tissoires <bentiss@kernel.org>
* | selftests: hid: Add touch tests for Wacom devicesJoshua Dickens2023-06-081-3/+81
|/ | | | | | | | | | | Adding a wacom touch device to use the test_multitouch tests. Adding a 2 additional tests. - A test to check if a touch event is sent when the contact_id of the event is 0. - A test to check if a touch event is not sent when confidence is set to 0. Signed-off-by: Joshua Dickens <joshua.dickens@wacom.com> Reviewed-by: Jason Gerecke <jason.gerecke@wacom.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
* selftests: hid: import hid-tools usb-crash testsBenjamin Tissoires2023-04-123-0/+111
| | | | | | | | | | | | | | | These tests have been developed in the hid-tools[0] tree for a while. Now that we have a proper selftests/hid kernel entry and that the tests are more reliable, it is time to directly include those in the kernel tree. This one gets skipped when run by vmtest.sh as we currently need to test against actual kernel modules (.ko), not built-in to fetch the list of supported devices. [0] https://gitlab.freedesktop.org/libevdev/hid-tools Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
* selftests: hid: import hid-tools hid-sony and hid-playstation testsBenjamin Tissoires2023-04-124-0/+355
| | | | | | | | | | | | | | | | | These tests have been developed in the hid-tools[0] tree for a while. Now that we have a proper selftests/hid kernel entry and that the tests are more reliable, it is time to directly include those in the kernel tree. The code is taken from [1] to fix a change in v6.3. [0] https://gitlab.freedesktop.org/libevdev/hid-tools Link: https://gitlab.freedesktop.org/libevdev/hid-tools/-/merge_requests/143 [1] Cc: Roderick Colenbrander <roderick.colenbrander@sony.com> Cc: Jose Torreguitar <jtguitar@google.com> Signed-off-by: Roderick Colenbrander <roderick.colenbrander@sony.com> Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
* selftests: hid: import hid-tools hid-ite testsBenjamin Tissoires2023-04-124-0/+175
| | | | | | | | | | | | | | | These tests have been developed in the hid-tools[0] tree for a while. Now that we have a proper selftests/hid kernel entry and that the tests are more reliable, it is time to directly include those in the kernel tree. [0] https://gitlab.freedesktop.org/libevdev/hid-tools Cc: Peter Hutterer <peter.hutterer@who-t.net> Cc: Roderick Colenbrander <roderick.colenbrander@sony.com> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: Roderick Colenbrander <roderick.colenbrander@sony.com> Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
* selftests: hid: import hid-tools hid-apple testsBenjamin Tissoires2023-04-124-0/+449
| | | | | | | | | | | | | These tests have been developed in the hid-tools[0] tree for a while. Now that we have a proper selftests/hid kernel entry and that the tests are more reliable, it is time to directly include those in the kernel tree. [0] https://gitlab.freedesktop.org/libevdev/hid-tools Cc: Roderick Colenbrander <roderick.colenbrander@sony.com> Signed-off-by: Roderick Colenbrander <roderick.colenbrander@sony.com> Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
* selftests: hid: import hid-tools wacom testsBenjamin Tissoires2023-04-125-0/+2215
| | | | | | | | | | | | These tests have been developed in the hid-tools[0] tree for a while. Now that we have a proper selftests/hid kernel entry and that the tests are more reliable, it is time to directly include those in the kernel tree. [0] https://gitlab.freedesktop.org/libevdev/hid-tools Cc: Jason Gerecke <killertofu@gmail.com> Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
* selftests: hid: import hid-tools hid-multitouch and hid-tablets testsBenjamin Tissoires2023-04-127-0/+2980
| | | | | | | | | | | | | | | | | | | | | | These tests have been developed in the hid-tools[0] tree for a while. Now that we have a proper selftests/hid kernel entry and that the tests are more reliable, it is time to directly include those in the kernel tree. There are a lot of multitouch tests, and the default timeout of 45 seconds is not big enough. Bump it to 200 seconds. [0] https://gitlab.freedesktop.org/libevdev/hid-tools Cc: Peter Hutterer <peter.hutterer@who-t.net> Cc: Kai-Heng Feng <kai.heng.feng@canonical.com> Cc: Roderick Colenbrander <roderick.colenbrander@sony.com> Cc: наб <nabijaczleweli@nabijaczleweli.xyz> Cc: Blaž Hrastnik <blaz@mxxn.io> Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: Roderick Colenbrander <roderick.colenbrander@sony.com> Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
* selftests: hid: import hid-tools hid-mouse testsBenjamin Tissoires2023-04-123-0/+985
| | | | | | | | | | | | | | | These tests have been developed in the hid-tools[0] tree for a while. Now that we have a proper selftests/hid kernel entry and that the tests are more reliable, it is time to directly include those in the kernel tree. [0] https://gitlab.freedesktop.org/libevdev/hid-tools Cc: Peter Hutterer <peter.hutterer@who-t.net> Cc: Roderick Colenbrander <roderick.colenbrander@sony.com> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: Roderick Colenbrander <roderick.colenbrander@sony.com> Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
* selftests: hid: import hid-tools hid-keyboards testsBenjamin Tissoires2023-04-123-0/+493
| | | | | | | | | | | | | | | | These tests have been developed in the hid-tools[0] tree for a while. Now that we have a proper selftests/hid kernel entry and that the tests are more reliable, it is time to directly include those in the kernel tree. [0] https://gitlab.freedesktop.org/libevdev/hid-tools Cc: Nicolas Saenz Julienne <nsaenzjulienne@suse.de> Cc: Peter Hutterer <peter.hutterer@who-t.net> Cc: Roderick Colenbrander <roderick.colenbrander@sony.com> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: Roderick Colenbrander <roderick.colenbrander@sony.com> Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
* selftests: hid: import hid-tools hid-gamepad testsBenjamin Tissoires2023-04-123-0/+217
| | | | | | | | | | | | | | | | | | | These tests have been developed in the hid-tools[0] tree for a while. Now that we have a proper selftests/hid kernel entry and that the tests are more reliable, it is time to directly include those in the kernel tree. [0] https://gitlab.freedesktop.org/libevdev/hid-tools Cc: Candle Sun <candle.sun@unisoc.com> Cc: Jose Torreguitar <jtguitar@google.com> Cc: Peter Hutterer <peter.hutterer@who-t.net> Cc: Roderick Colenbrander <roderick.colenbrander@sony.com> Cc: Silvan Jegen <s.jegen@gmail.com> Signed-off-by: Silvan Jegen <s.jegen@gmail.com> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: Roderick Colenbrander <roderick.colenbrander@sony.com> Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
* selftests: hid: import hid-tools hid-core testsBenjamin Tissoires2023-04-128-1/+620
| | | | | | | | | | | | | | | | | | | | These tests have been developed in the hid-tools[0] tree for a while. Now that we have a proper selftests/hid kernel entry and that the tests are more reliable, it is time to directly include those in the kernel tree. I haven't imported all of hid-tools, the python module, but only the tests related to the kernel. We can rely on pip to fetch the latest hid-tools release, and then run the tests directly from the tree. This should now be easier to request tests when something is not behaving properly in the HID subsystem. [0] https://gitlab.freedesktop.org/libevdev/hid-tools Cc: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
* selftests: hid: make vmtest rely on makeBenjamin Tissoires2023-04-121-10/+15
| | | | | | | | | | | | | Having a default binary is simple enough, but this also means that we need to keep the targets in sync as we are adding them in the Makefile. So instead of doing that manual work, make vmtest.sh generic enough to actually be capable of running 'make -C tools/testing/selftests/hid'. The new image we use has make installed, which the base fedora image doesn't. Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
* selftest: hid: fix hid_bpf not set in configBenjamin Tissoires2023-02-231-0/+1
| | | | | | | | Now that CONFIG_HID_BPF is not automatically implied by HID, we need to set it properly in the selftests config. Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
* selftests: hid: enforce new attach APIBenjamin Tissoires2023-01-181-5/+1
| | | | | | | | Now that the new API for hid_bpf_attach_prog() is in place, ensure we get an fd when calling this function. And remove the fallback code. Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
* selftests: hid: prepare tests for HID_BPF API changeBenjamin Tissoires2023-01-181-4/+25
| | | | | | | | | | | | | We plan on changing the return value of hid_bpf_attach_prog(). Instead of returning an error code, it will return an fd to a bpf_link. This bpf_link is responsible for the binding between the bpf program and the hid device. Add a fallback mechanism to not break bisections by pinning the program when we run this test against the non changed kernel. Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
* selftests: hid: ensure the program is correctly pinnedBenjamin Tissoires2023-01-181-1/+2
| | | | | | | | | Turns out that if bpffs was not mounted, the test was silently passing. So ensure it passes by checking the mount command result. Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
* selftests: hid: attach/detach 2 bpf programs, not just oneBenjamin Tissoires2023-01-182-1/+20
| | | | | | | | | | | Add a second BPF program to attach to the device, as the development of this feature showed that we also need to ensure we can detach multiple programs to a device (hid_bpf_link->hid_table_index was actually not set initially, and this lead to any BPF program not being released except for the first one). Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
* selftests: hid: allow to compile hid_bpf with LLVMBenjamin Tissoires2023-01-181-5/+5
| | | | | | | | | | | | clang doesn't like to compile a source to the final binary directly: clang-14: error: cannot specify -o when generating multiple output files So split the final rule in 2, and ensure we compile all dependencies before. Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
* selftests: hid: add vmtest.shBenjamin Tissoires2023-01-184-0/+530
| | | | | | | | | | | | | Similar-ish in many points from the script in selftests/bpf, with a few differences: - relies on boot2container instead of a plain qemu image (meaning that we can take any container in a registry as a base) - runs in the hid selftest dir, and such uses the test program from there - the working directory to store the config is in tools/selftests/hid/results Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
* kselftests: hid: fix missing headers_install stepBenjamin Tissoires2022-12-101-14/+12
| | | | | | | | | | | | | | | | The Makefile was assuming that headers_install was already done in the top source directory, and was searching for installed uapi headers there. Unfortunately this is not the case and we need to manually call that step. To do so, reorder the declaration of the variables, and reuses top_srcdir provided by lib.mk Reported-by: kernel test robot <lkp@intel.com> Link: https://lore.kernel.org/all/202212060216.a6X8Py5H-lkp@intel.com/#t Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com> Reviewed-by: Jiri Kosina <jkosina@suse.cz> Link: https://lore.kernel.org/r/20221206145936.922196-6-benjamin.tissoires@redhat.com
* selftests: hid: ensures we have the proper requirements in configBenjamin Tissoires2022-12-101-0/+1
| | | | | | | | | DYNAMIC_FTRACE_WITH_DIRECT_CALLS is implicit on x86_64 but is still a WIP on aarm64. Ensure we get it selected to not have any surprises. Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com> Reviewed-by: Jiri Kosina <jkosina@suse.cz> Link: https://lore.kernel.org/r/20221206145936.922196-5-benjamin.tissoires@redhat.com
* selftests/hid: Add a test for BPF_F_INSERT_HEADBenjamin Tissoires2022-11-152-1/+97
| | | | | | | | Insert 3 programs to check that we are doing the correct thing: '2', '1', '3' are inserted, but '1' is supposed to be executed first. Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
* selftests/hid: add report descriptor fixup testsBenjamin Tissoires2022-11-152-0/+85
| | | | | | | | | | | Simple report descriptor override in HID: replace part of the report descriptor from a static definition in the bpf kernel program. Note that this test should be run last because we disconnect/reconnect the device, meaning that it changes the overall uhid device. Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
* selftests/hid: add tests for bpf_hid_hw_requestBenjamin Tissoires2022-11-153-1/+98
| | | | | | | | | Add tests for the newly implemented function. We test here only the GET_REPORT part because the other calls are pure HID protocol and won't infer the result of the test of the bpf hook. Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
* selftests/hid: add test to change the report sizeBenjamin Tissoires2022-11-152-1/+55
| | | | | | | | Use a different report with a bigger size and ensures we are doing things properly. Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
* selftests: add tests for the HID-bpf initial implementationBenjamin Tissoires2022-11-156-0/+987
The tests are pretty basic: - create a virtual uhid device that no userspace will like (to not mess up the running system) - attach a BPF prog to it - open the matching hidraw node - inject one event and check: * that the BPF program can do something on the event stream * can modify the event stream - add another test where we attach/detach BPF programs to see if we get errors Note: the Makefile is extracted from selftests/bpf so we can rebuild the libbpf and bpftool components from the current kernel tree without relying on system installed components. Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>