perf test: Use skip in PERF_RECORD_*

Check if the error code is EACCES and make the test a skip with
a "permissions" skip reason if so.

Committer testing:

Before:

  $ perf test PERF_RECORD
    8: PERF_RECORD_* events & perf_sample fields            : FAILED!
  $

After:

  $ perf test PERF_RECORD
    8: PERF_RECORD_* events & perf_sample fields            : Skip (permissions)
  $

Signed-off-by: Ian Rogers <[email protected]>
Tested-by: Arnaldo Carvalho de Melo <[email protected]>
Cc: Alexander Shishkin <[email protected]>
Cc: Carsten Haitzler <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: Jiri Olsa <[email protected]>
Cc: John Garry <[email protected]>
Cc: Marco Elver <[email protected]>
Cc: Mark Rutland <[email protected]>
Cc: Michael Petlan <[email protected]>
Cc: Namhyung Kim <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Riccardo Mancini <[email protected]>
Cc: Sohaib Mohamed <[email protected]>
Cc: Stephane Eranian <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
This commit is contained in:
Ian Rogers authored and Arnaldo Carvalho de Melo committed 2022-05-23 10:05:07 -03:00
1 parent 7741e03e80
commit 2cf88f4614
1 file changed
+16 -2
+16 -2
View File
@@ -330,7 +330,21 @@ found_exit:
out_delete_evlist:
evlist__delete(evlist);
out:
return (err < 0 || errs > 0) ? -1 : 0;
if (err == -EACCES)
return TEST_SKIP;
if (err < 0)
return TEST_FAIL;
return TEST_OK;
}
DEFINE_SUITE("PERF_RECORD_* events & perf_sample fields", PERF_RECORD);
static struct test_case tests__PERF_RECORD[] = {
TEST_CASE_REASON("PERF_RECORD_* events & perf_sample fields",
PERF_RECORD,
"permissions"),
{ .name = NULL, }
};
struct test_suite suite__PERF_RECORD = {
.desc = "PERF_RECORD_* events & perf_sample fields",
.test_cases = tests__PERF_RECORD,
};