50a78409 | 06-Dec-2024 |
Charlie Jenkins <charlie@rivosinc.com> |
selftests/hid: Add host-tools to .gitignore
When compiling these selftests the host-tools directory is generated. Add it to the .gitignore so git doesn't see these files as trackable.
Signed-off-by
selftests/hid: Add host-tools to .gitignore
When compiling these selftests the host-tools directory is generated. Add it to the .gitignore so git doesn't see these files as trackable.
Signed-off-by: Charlie Jenkins <charlie@rivosinc.com> Signed-off-by: Jiri Kosina <jkosina@suse.com>
show more ...
|
8d355b56 | 28-Nov-2024 |
Benjamin Tissoires <bentiss@kernel.org> |
selftests/hid: fix kfunc inclusions with newer bpftool
bpftool now embeds the kfuncs definitions directly in the generated vmlinux.h
This is great, but because the selftests dir might be compiled w
selftests/hid: fix kfunc inclusions with newer bpftool
bpftool now embeds the kfuncs definitions directly in the generated vmlinux.h
This is great, but because the selftests dir might be compiled with HID_BPF disabled, we have no guarantees to be able to compile the sources with the generated kfuncs.
If we have the kfuncs, because we have the `__not_used` hack, the newly defined kfuncs do not match the ones from vmlinux.h and things go wrong.
Prevent vmlinux.h to define its kfuncs and also add the missing `__weak` symbols for our custom kfuncs definitions
Link: https://patch.msgid.link/20241128-fix-new-bpftool-v1-1-c9abdf94a719@kernel.org Signed-off-by: Benjamin Tissoires <bentiss@kernel.org>
show more ...
|
e8f34747 | 26-Nov-2024 |
Maximilian Heyne <mheyne@amazon.de> |
selftests: hid: fix typo and exit code
The correct exit code to mark a test as skipped is 4.
Fixes: ffb85d5c9e80 ("selftests: hid: import hid-tools hid-core tests") Signed-off-by: Maximilian Heyne
selftests: hid: fix typo and exit code
The correct exit code to mark a test as skipped is 4.
Fixes: ffb85d5c9e80 ("selftests: hid: import hid-tools hid-core tests") Signed-off-by: Maximilian Heyne <mheyne@amazon.de> Link: https://patch.msgid.link/20241126135850.76493-1-mheyne@amazon.de Signed-off-by: Benjamin Tissoires <bentiss@kernel.org>
show more ...
|
fe05c40c | 15-Oct-2024 |
Yun Lu <luyun@kylinos.cn> |
selftest: hid: add the missing tests directory
Commit 160c826b4dd0 ("selftest: hid: add missing run-hid-tools-tests.sh") has added the run-hid-tools-tests.sh script for it to be installed, but I for
selftest: hid: add the missing tests directory
Commit 160c826b4dd0 ("selftest: hid: add missing run-hid-tools-tests.sh") has added the run-hid-tools-tests.sh script for it to be installed, but I forgot to add the tests directory together.
If running the test case without the tests directory, will results in the following error message:
make -C tools/testing/selftests/ TARGETS=hid install \ INSTALL_PATH=$KSFT_INSTALL_PATH cd $KSFT_INSTALL_PATH ./run_kselftest.sh -t hid:hid-core.sh
/usr/lib/python3.11/site-packages/_pytest/config/__init__.py:331: PluggyTeardownRaisedWarning: A plugin raised an exception during an old-style hookwrapper teardown. Plugin: helpconfig, Hook: pytest_cmdline_parse UsageError: usage: __main__.py [options] [file_or_dir] [file_or_dir] [...] __main__.py: error: unrecognized arguments: --udevd inifile: None rootdir: /root/linux/kselftest_install/hid
In fact, the run-hid-tools-tests.sh script uses the scripts in the tests directory to run tests. The tests directory also needs to be added to be installed.
Fixes: ffb85d5c9e80 ("selftests: hid: import hid-tools hid-core tests") Cc: stable@vger.kernel.org Signed-off-by: Yun Lu <luyun@kylinos.cn> Acked-by: Benjamin Tissoires <bentiss@kernel.org> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
show more ...
|
e14e0eae | 01-Oct-2024 |
Benjamin Tissoires <bentiss@kernel.org> |
selftests/hid: add test for assigning a given device to hid-generic
We use a well known VID/PID on a driver that doesn't need to talk to the device, ensures we created the device against the target
selftests/hid: add test for assigning a given device to hid-generic
We use a well known VID/PID on a driver that doesn't need to talk to the device, ensures we created the device against the target driver, then load our program and ensure we have unbound to this driver and use hid-generic instead.
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Acked-by: Shuah Khan <skhan@linuxfoundation.org> Link: https://patch.msgid.link/20241001-hid-bpf-hid-generic-v3-9-2ef1019468df@kernel.org Signed-off-by: Benjamin Tissoires <bentiss@kernel.org>
show more ...
|
72c55473 | 01-Oct-2024 |
Benjamin Tissoires <bentiss@kernel.org> |
selftests/hid: allow to parametrize bus/vid/pid/rdesc on the test device
This will be useful to introduce variants in tests to test the interactions between HID-BPF and some kernel modules.
Reviewe
selftests/hid: allow to parametrize bus/vid/pid/rdesc on the test device
This will be useful to introduce variants in tests to test the interactions between HID-BPF and some kernel modules.
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Acked-by: Shuah Khan <skhan@linuxfoundation.org> Link: https://patch.msgid.link/20241001-hid-bpf-hid-generic-v3-7-2ef1019468df@kernel.org Signed-off-by: Benjamin Tissoires <bentiss@kernel.org>
show more ...
|
4fb41dfd | 01-Oct-2024 |
Benjamin Tissoires <bentiss@kernel.org> |
selftests/hid: cleanup C tests by adding a common struct uhid_device
Allows to have an abstract class uhid_device which handles all of the uhid part without having to mess up with individual fds.
s
selftests/hid: cleanup C tests by adding a common struct uhid_device
Allows to have an abstract class uhid_device which handles all of the uhid part without having to mess up with individual fds.
struct attach_prog_args is now never used in hid_bpf.c, so drop it as well
Acked-by: Shuah Khan <skhan@linuxfoundation.org> Link: https://patch.msgid.link/20241001-hid-bpf-hid-generic-v3-6-2ef1019468df@kernel.org Signed-off-by: Benjamin Tissoires <bentiss@kernel.org>
show more ...
|
321f7798 | 27-Aug-2024 |
Benjamin Tissoires <bentiss@kernel.org> |
selftests/hid: Add HIDIOCREVOKE tests
Add 4 tests for the new revoke ioctl, for read/write/ioctl and poll.
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Link: https://patch.msgid.link/2024
selftests/hid: Add HIDIOCREVOKE tests
Add 4 tests for the new revoke ioctl, for read/write/ioctl and poll.
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Link: https://patch.msgid.link/20240827-hidraw-revoke-v5-4-d004a7451aea@kernel.org Signed-off-by: Benjamin Tissoires <bentiss@kernel.org>
show more ...
|
8163892a | 27-Aug-2024 |
Benjamin Tissoires <bentiss@kernel.org> |
selftests/hid: Add initial hidraw tests skeleton
Largely inspired from hid_bpf.c for the fixture setup.
Create a couple of tests for hidraw: - create a uhid device and check if the fixture is worki
selftests/hid: Add initial hidraw tests skeleton
Largely inspired from hid_bpf.c for the fixture setup.
Create a couple of tests for hidraw: - create a uhid device and check if the fixture is working properly - inject one uhid event and read it through hidraw
These tests are not that useful for now, but will be once we start adding the ioctl and BPFs to revoke the hidraw node.
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Link: https://patch.msgid.link/20240827-hidraw-revoke-v5-3-d004a7451aea@kernel.org Signed-off-by: Benjamin Tissoires <bentiss@kernel.org>
show more ...
|
facdbdfe | 23-Jul-2024 |
Benjamin Tissoires <bentiss@kernel.org> |
selftests/hid: add test for attaching multiple time the same struct_ops
Turns out that we would en up in a bad state if we attempt to attach twice the same HID-BPF struct_ops, so have a test for it.
selftests/hid: add test for attaching multiple time the same struct_ops
Turns out that we would en up in a bad state if we attempt to attach twice the same HID-BPF struct_ops, so have a test for it.
Link: https://patch.msgid.link/20240723-fix-6-11-bpf-v1-4-b9d770346784@kernel.org Signed-off-by: Benjamin Tissoires <bentiss@kernel.org>
show more ...
|
f64c1a45 | 23-Jul-2024 |
Benjamin Tissoires <bentiss@kernel.org> |
selftests/hid: disable struct_ops auto-attach
Since commit 08ac454e258e ("libbpf: Auto-attach struct_ops BPF maps in BPF skeleton"), libbpf automatically calls bpf_map__attach_struct_ops() on every
selftests/hid: disable struct_ops auto-attach
Since commit 08ac454e258e ("libbpf: Auto-attach struct_ops BPF maps in BPF skeleton"), libbpf automatically calls bpf_map__attach_struct_ops() on every struct_ops it sees in the bpf object. The problem is that our test bpf object has many of them but only one should be manually loaded at a time, or we end up locking the syscall.
Link: https://patch.msgid.link/20240723-fix-6-11-bpf-v1-2-b9d770346784@kernel.org Signed-off-by: Benjamin Tissoires <bentiss@kernel.org>
show more ...
|
fcdf830e | 01-Jul-2024 |
Benjamin Tissoires <bentiss@kernel.org> |
selftests/hid: ensure CKI can compile our new tests on old kernels
In the same way than commit ae7487d112cf ("selftests/hid: ensure we can compile the tests on kernels pre-6.3") we should expose str
selftests/hid: ensure CKI can compile our new tests on old kernels
In the same way than commit ae7487d112cf ("selftests/hid: ensure we can compile the tests on kernels pre-6.3") we should expose struct hid_bpf_ops when it's not available in vmlinux.h.
So unexpose an eventual struct hid_bpf_ops, include vmlinux.h, and re-export struct hid_bpf_ops.
Fixes: d7696738d66b ("selftests/hid: convert the hid_bpf selftests with struct_ops") Reported-by: kernel test robot <lkp@intel.com> Closes: https://lore.kernel.org/r/202406270328.bscLN1IF-lkp@intel.com/ Link: https://patch.msgid.link/20240701-fix-cki-v2-1-20564e2e1393@kernel.org Signed-off-by: Benjamin Tissoires <bentiss@kernel.org>
show more ...
|
d3e15189 | 26-Jun-2024 |
Benjamin Tissoires <bentiss@kernel.org> |
selftests/hid: add an infinite loop test for hid_bpf_try_input_report
We don't want this call to allow an infinite loop in HID-BPF, so let's have some tests.
Link: https://patch.msgid.link/20240626
selftests/hid: add an infinite loop test for hid_bpf_try_input_report
We don't want this call to allow an infinite loop in HID-BPF, so let's have some tests.
Link: https://patch.msgid.link/20240626-hid_hw_req_bpf-v2-13-cfd60fb6c79f@kernel.org Acked-by: Jiri Kosina <jkosina@suse.com> Signed-off-by: Benjamin Tissoires <bentiss@kernel.org>
show more ...
|
62f2e1a0 | 26-Jun-2024 |
Benjamin Tissoires <bentiss@kernel.org> |
selftests/hid: add another test for injecting an event from an event hook
Similar to test_multiply_events_wq: we receive one event and inject a new one. But given that this time we are already in th
selftests/hid: add another test for injecting an event from an event hook
Similar to test_multiply_events_wq: we receive one event and inject a new one. But given that this time we are already in the event hook, we can use hid_bpf_try_input_report() directly as this function will not sleep.
Note that the injected event gets processed before the original one this way.
Link: https://patch.msgid.link/20240626-hid_hw_req_bpf-v2-12-cfd60fb6c79f@kernel.org Acked-by: Jiri Kosina <jkosina@suse.com> Signed-off-by: Benjamin Tissoires <bentiss@kernel.org>
show more ...
|
fe8d561d | 26-Jun-2024 |
Benjamin Tissoires <bentiss@kernel.org> |
selftests/hid: add wq test for hid_bpf_input_report()
Now that bpf_wq is available, we can write a test with it. Having hid_bpf_input_report() waiting for the device means that we can directly call
selftests/hid: add wq test for hid_bpf_input_report()
Now that bpf_wq is available, we can write a test with it. Having hid_bpf_input_report() waiting for the device means that we can directly call it, and we get that event when the device is ready.
Link: https://patch.msgid.link/20240626-hid_hw_req_bpf-v2-10-cfd60fb6c79f@kernel.org Acked-by: Jiri Kosina <jkosina@suse.com> Signed-off-by: Benjamin Tissoires <bentiss@kernel.org>
show more ...
|
3ac83fcd | 26-Jun-2024 |
Benjamin Tissoires <bentiss@kernel.org> |
selftests/hid: add tests for hid_hw_output_report HID-BPF hooks
We add 3 new tests: - first, we make sure we can prevent the output_report to happen - second, we make sure that we can detect that a
selftests/hid: add tests for hid_hw_output_report HID-BPF hooks
We add 3 new tests: - first, we make sure we can prevent the output_report 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_output_report(), returning a custom value - last, we ensure that we can not loop between hooks for hid_hw_output_report() and manual calls to hid_bpf_hw_output_report() from that same hook
Link: https://patch.msgid.link/20240626-hid_hw_req_bpf-v2-8-cfd60fb6c79f@kernel.org Acked-by: Jiri Kosina <jkosina@suse.com> Signed-off-by: Benjamin Tissoires <bentiss@kernel.org>
show more ...
|