[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220518042027.836799-9-irogers@google.com>
Date: Tue, 17 May 2022 21:20:27 -0700
From: Ian Rogers <irogers@...gle.com>
To: Peter Zijlstra <peterz@...radead.org>,
Ingo Molnar <mingo@...hat.com>,
Arnaldo Carvalho de Melo <acme@...nel.org>,
Mark Rutland <mark.rutland@....com>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
Jiri Olsa <jolsa@...nel.org>,
Namhyung Kim <namhyung@...nel.org>,
Riccardo Mancini <rickyman7@...il.com>,
Sohaib Mohamed <sohaib.amhmd@...il.com>,
Carsten Haitzler <carsten.haitzler@....com>,
Marco Elver <elver@...gle.com>,
John Garry <john.garry@...wei.com>,
Michael Petlan <mpetlan@...hat.com>,
linux-perf-users@...r.kernel.org, linux-kernel@...r.kernel.org
Cc: Stephane Eranian <eranian@...gle.com>,
Ian Rogers <irogers@...gle.com>
Subject: [PATCH v2 8/8] 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.
Signed-off-by: Ian Rogers <irogers@...gle.com>
---
tools/perf/tests/perf-record.c | 18 ++++++++++++++++--
1 file changed, 16 insertions(+), 2 deletions(-)
diff --git a/tools/perf/tests/perf-record.c b/tools/perf/tests/perf-record.c
index 6354465067b8..6a001fcfed68 100644
--- a/tools/perf/tests/perf-record.c
+++ b/tools/perf/tests/perf-record.c
@@ -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,
+};
--
2.36.0.550.gb090851708-goog
Powered by blists - more mailing lists