Skip to content

Commit

Permalink
perf test: Use skip in PERF_RECORD_*
Browse files Browse the repository at this point in the history
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 <irogers@google.com>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Carsten Haitzler <carsten.haitzler@arm.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: John Garry <john.garry@huawei.com>
Cc: Marco Elver <elver@google.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Michael Petlan <mpetlan@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Riccardo Mancini <rickyman7@gmail.com>
Cc: Sohaib Mohamed <sohaib.amhmd@gmail.com>
Cc: Stephane Eranian <eranian@google.com>
Link: https://lore.kernel.org/r/20220518042027.836799-9-irogers@google.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
  • Loading branch information
captain5050 authored and acmel committed May 23, 2022
1 parent 7741e03 commit 2cf88f4
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions tools/perf/tests/perf-record.c
Expand Up @@ -330,7 +330,21 @@ static int test__PERF_RECORD(struct test_suite *test __maybe_unused, int subtest
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,
};

0 comments on commit 2cf88f4

Please sign in to comment.