From: James Clark <james.clark@arm.com>
To: acme@kernel.org, namhyung@kernel.org
Cc: linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org,
will@kernel.org, James Clark <james.clark@arm.com>,
Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@redhat.com>,
Mark Rutland <mark.rutland@arm.com>,
Alexander Shishkin <alexander.shishkin@linux.intel.com>,
Jiri Olsa <jolsa@kernel.org>,
bpf@vger.kernel.org
Subject: [RFC PATCH 1/4] perf test: Add ability to test exit code for attr tests
Date: Tue, 27 Sep 2022 16:41:01 +0100 [thread overview]
Message-ID: <20220927154104.869029-2-james.clark@arm.com> (raw)
In-Reply-To: <20220927154104.869029-1-james.clark@arm.com>
Currently the return value is used to skip the test, but sometimes it
can be useful to test if a certain command should return a certain exit
code.
Signed-off-by: James Clark <james.clark@arm.com>
---
tools/perf/tests/attr.py | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/tools/perf/tests/attr.py b/tools/perf/tests/attr.py
index 6d9b5312e6c2..7e053fa5d6ae 100644
--- a/tools/perf/tests/attr.py
+++ b/tools/perf/tests/attr.py
@@ -129,7 +129,8 @@ class Event(dict):
# - needs to specify:
# 'command' - perf command name
# 'args' - special command arguments
-# 'ret' - expected command return value (0 by default)
+# 'ret' - Skip test if Perf doesn't exit with this value (0 by default)
+# 'test_ret'- If set to 'true', fail test instead of skipping for 'ret' argument
# 'arch' - architecture specific test (optional)
# comma separated list, ! at the beginning
# negates it.
@@ -155,6 +156,8 @@ class Test(object):
except:
self.ret = 0
+ self.test_ret = parser.getboolean('config', 'test_ret', fallback=False)
+
try:
self.arch = parser.get('config', 'arch')
log.warning("test limitation '%s'" % self.arch)
@@ -232,7 +235,10 @@ class Test(object):
log.info(" '%s' ret '%s', expected '%s'" % (cmd, str(ret), str(self.ret)))
if not data_equal(str(ret), str(self.ret)):
- raise Unsup(self)
+ if self.test_ret:
+ raise Fail(self, "Perf exit code failure")
+ else:
+ raise Unsup(self)
def compare(self, expect, result):
match = {}
--
2.28.0
next prev parent reply other threads:[~2022-09-27 15:45 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-27 15:41 [RFC PATCH 0/4] Add VG register attr test with kernel version and feature detection James Clark
2022-09-27 15:41 ` James Clark [this message]
2022-09-27 15:41 ` [RFC PATCH 2/4] perf test: Add mechanism for skipping attr tests on auxiliary vector values James Clark
2022-09-27 15:41 ` [RFC PATCH 3/4] perf test: Add mechanism for skipping attr tests on kernel versions James Clark
2022-09-27 15:41 ` [RFC PATCH 4/4] perf test arm64: Add attr tests for new VG register James Clark
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220927154104.869029-2-james.clark@arm.com \
--to=james.clark@arm.com \
--cc=acme@kernel.org \
--cc=alexander.shishkin@linux.intel.com \
--cc=bpf@vger.kernel.org \
--cc=jolsa@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mingo@redhat.com \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.org \
--cc=will@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®