On Sep 26 2023, Justin Stitt wrote:
Hey all,
Gentle ping on this patch. Looking to get this patch and [1] slated for 6.7 wherein we can start getting cleaner kselftests builds.
I do not think I am able to successfully run the hid/bpf selftests due to my kernel version being too low (and an inability to upgrade it as I'm on a corp rolling release). I'd appreciate some insight on how to get the tests running or if someone could actually build+run the tests with this patch applied.
I wanted to apply this series today, but it failed my own CI now with the enums being already defined: https://gitlab.freedesktop.org/bentiss/hid/-/jobs/49754306
I'll probably squash the following patch in 1/3, would you mind giving it a test?
--- From 37feca6c0e84705ad65e621643206c287b63bb0a Mon Sep 17 00:00:00 2001 From: Benjamin Tissoires bentiss@kernel.org Date: Mon, 2 Oct 2023 15:37:18 +0200 Subject: [PATCH] fix selftests/hid: ensure we can compile the tests on kernels pre-6.3
Signed-off-by: Benjamin Tissoires bentiss@kernel.org --- .../selftests/hid/progs/hid_bpf_helpers.h | 30 ++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-)
diff --git a/tools/testing/selftests/hid/progs/hid_bpf_helpers.h b/tools/testing/selftests/hid/progs/hid_bpf_helpers.h index ab3b18ba48c4..feed5a991e05 100644 --- a/tools/testing/selftests/hid/progs/hid_bpf_helpers.h +++ b/tools/testing/selftests/hid/progs/hid_bpf_helpers.h @@ -5,16 +5,44 @@ #ifndef __HID_BPF_HELPERS_H #define __HID_BPF_HELPERS_H
-/* "undefine" structs in vmlinux.h, because we "override" them below */ +/* "undefine" structs and enums in vmlinux.h, because we "override" them below */ #define hid_bpf_ctx hid_bpf_ctx___not_used #define hid_report_type hid_report_type___not_used #define hid_class_request hid_class_request___not_used #define hid_bpf_attach_flags hid_bpf_attach_flags___not_used +#define HID_INPUT_REPORT HID_INPUT_REPORT___not_used +#define HID_OUTPUT_REPORT HID_OUTPUT_REPORT___not_used +#define HID_FEATURE_REPORT HID_FEATURE_REPORT___not_used +#define HID_REPORT_TYPES HID_REPORT_TYPES___not_used +#define HID_REQ_GET_REPORT HID_REQ_GET_REPORT___not_used +#define HID_REQ_GET_IDLE HID_REQ_GET_IDLE___not_used +#define HID_REQ_GET_PROTOCOL HID_REQ_GET_PROTOCOL___not_used +#define HID_REQ_SET_REPORT HID_REQ_SET_REPORT___not_used +#define HID_REQ_SET_IDLE HID_REQ_SET_IDLE___not_used +#define HID_REQ_SET_PROTOCOL HID_REQ_SET_PROTOCOL___not_used +#define HID_BPF_FLAG_NONE HID_BPF_FLAG_NONE___not_used +#define HID_BPF_FLAG_INSERT_HEAD HID_BPF_FLAG_INSERT_HEAD·___not_used +#define HID_BPF_FLAG_MAX HID_BPF_FLAG_MAX___not_used + #include "vmlinux.h" + #undef hid_bpf_ctx #undef hid_report_type #undef hid_class_request #undef hid_bpf_attach_flags +#undef HID_INPUT_REPORT +#undef HID_OUTPUT_REPORT +#undef HID_FEATURE_REPORT +#undef HID_REPORT_TYPES +#undef HID_REQ_GET_REPORT +#undef HID_REQ_GET_IDLE +#undef HID_REQ_GET_PROTOCOL +#undef HID_REQ_SET_REPORT +#undef HID_REQ_SET_IDLE +#undef HID_REQ_SET_PROTOCOL +#undef HID_BPF_FLAG_NONE +#undef HID_BPF_FLAG_INSERT_HEAD +#undef HID_BPF_FLAG_MAX
#include <bpf/bpf_helpers.h> #include <bpf/bpf_tracing.h>