perf test: Skip sigtrap test on old kernels
If it runs on an old kernel, perf_event_open would fail because of the
new fields sigtrap and sig_data. Just skipping the test could miss an
actual bug in the kernel.
Let's check BTF (when we have libbpf) if it has the sigtrap field in the
perf_event_attr. Otherwise, we can check it with a minimal event config.
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Acked-by: Song Liu <song@kernel.org>
Suggested-by: Arnaldo Carvalho de Melo <acme@redhat.com> # Using BTF to check for the struct members
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Marco Elver <elver@google.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: https://lore.kernel.org/r/20220908230150.4105955-1-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>