From: Punit Agrawal <punit.agrawal@arm.com>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH v2 11/13] perf_event_open: Handle absence of PMU gracefully
Date: Tue, 14 Nov 2017 15:59:27 +0000 [thread overview]
Message-ID: <20171114155929.24237-12-punit.agrawal@arm.com> (raw)
In-Reply-To: <20171114155929.24237-1-punit.agrawal@arm.com>
From: "Suzuki K. Poulose" <suzuki.poulose@arm.com>
The perf_event_open0{1,2} syscall tests fail for an absence of a
PMU (which returns ENODEV). Handle the return code gracefully as we
check for ENOENT.
Without the patch:
$ perf_event_open01
perf_event_open01 1 TFAIL : perf_event_open01.c:162: perf_event_open \
failed unexpectedly: TEST_ERRNO=ENODEV(19): No such device
With the patch:
$ perf_event_open01
perf_event_open01 1 TCONF : perf_event_open01.c:159: perf_event_open for PERF_COUNT_HW_INSTRUCTIONS : No such device
perf_event_open01 2 TCONF : perf_event_open01.c:159: perf_event_open for PERF_COUNT_HW_CACHE_REFERENCES : No such device
perf_event_open01 3 TCONF : perf_event_open01.c:159: perf_event_open for PERF_COUNT_HW_CACHE_MISSES : No such device
perf_event_open01 4 TCONF : perf_event_open01.c:159: perf_event_open for PERF_COUNT_HW_BRANCH_INSTRUCTIONS : No such file or directory
perf_event_open01 5 TCONF : perf_event_open01.c:159: perf_event_open for PERF_COUNT_HW_BRANCH_MISSES : No such device
perf_event_open01 0 TINFO : read event counter succeeded, value: 833765520
perf_event_open01 6 TPASS : test PERF_TYPE_HARDWARE: PERF_COUNT_SW_CPU_CLOCK succeeded
perf_event_open01 0 TINFO : read event counter succeeded, value: 833967380
perf_event_open01 7 TPASS : test PERF_TYPE_HARDWARE: PERF_COUNT_SW_TASK_CLOCK succeeded
Signed-off-by: Suzuki K. Poulose <suzuki.poulose@arm.com>
Signed-off-by: Punit Agrawal <punit.agrawal@arm.com>
---
testcases/kernel/syscalls/perf_event_open/perf_event_open01.c | 3 ++-
testcases/kernel/syscalls/perf_event_open/perf_event_open02.c | 4 ++--
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/testcases/kernel/syscalls/perf_event_open/perf_event_open01.c b/testcases/kernel/syscalls/perf_event_open/perf_event_open01.c
index 5c814b60c..5568035d9 100644
--- a/testcases/kernel/syscalls/perf_event_open/perf_event_open01.c
+++ b/testcases/kernel/syscalls/perf_event_open/perf_event_open01.c
@@ -149,7 +149,8 @@ static void verify(struct test_case_t *tc)
TEST(perf_event_open(&pe, 0, -1, -1, 0));
if (TEST_RETURN == -1) {
- if (TEST_ERRNO == ENOENT || TEST_ERRNO == EOPNOTSUPP) {
+ if (TEST_ERRNO == ENOENT || TEST_ERRNO == EOPNOTSUPP ||
+ TEST_ERRNO == ENODEV) {
tst_resm(TCONF | TTERRNO,
"perf_event_open for %s not supported",
tc->config_name);
diff --git a/testcases/kernel/syscalls/perf_event_open/perf_event_open02.c b/testcases/kernel/syscalls/perf_event_open/perf_event_open02.c
index 7d54cbd52..13a17948a 100644
--- a/testcases/kernel/syscalls/perf_event_open/perf_event_open02.c
+++ b/testcases/kernel/syscalls/perf_event_open/perf_event_open02.c
@@ -160,8 +160,8 @@ static int count_hardware_counters(void)
for (i = 0; i < MAX_CTRS; i++) {
fdarry[i] = perf_event_open(&hw_event, 0, -1, -1, 0);
if (fdarry[i] == -1) {
- if (errno == ENOENT) {
- tst_brkm(TCONF, cleanup,
+ if (errno == ENOENT || errno == ENODEV) {
+ tst_brkm(TCONF | TERRNO, cleanup,
"PERF_COUNT_HW_INSTRUCTIONS not supported");
}
tst_brkm(TBROK | TERRNO, cleanup,
--
2.14.2
next prev parent reply other threads:[~2017-11-14 15:59 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-14 15:59 [LTP] [PATCH v2 00/13] Collection of fixes Punit Agrawal
2017-11-14 15:59 ` [LTP] [PATCH v2 01/13] Move check_hugepage() helper to mem/lib Punit Agrawal
2017-11-14 15:59 ` [LTP] [PATCH v2 02/13] thp: ensure THP/hugetlbfs is available Punit Agrawal
2017-11-27 16:20 ` Cyril Hrubis
2017-11-27 16:59 ` Punit Agrawal
2017-11-29 12:44 ` Cyril Hrubis
2017-11-29 13:29 ` Punit Agrawal
2017-11-29 14:34 ` Cyril Hrubis
2017-11-14 15:59 ` [LTP] [PATCH v2 03/13] hugeshmctl01: Convert to LTP synchronisation primitives Punit Agrawal
2017-11-27 16:52 ` Cyril Hrubis
2017-11-27 17:34 ` Punit Agrawal
2017-11-14 15:59 ` [LTP] [PATCH v2 04/13] hugeshmctl01: Fix warning about signed/unsigned comparison Punit Agrawal
2017-11-14 15:59 ` [LTP] [PATCH v2 05/13] hugeshmctl02: Fix allocation size for odd number of hugepages Punit Agrawal
2017-11-14 15:59 ` [LTP] [PATCH v2 06/13] hugeshmget02: add missing SHM_HUGETLB flag on segment creation Punit Agrawal
2017-11-14 15:59 ` [LTP] [PATCH v2 07/13] sigwaitinfo01: fix race between sending and dequeueing RT signals Punit Agrawal
2017-11-14 15:59 ` [LTP] [PATCH v2 08/13] sigwaitinfo01: catch SEGV and report success for bad_address2 testcase Punit Agrawal
2017-11-29 10:29 ` Cyril Hrubis
2017-11-29 13:25 ` Punit Agrawal
2017-11-29 15:33 ` Cyril Hrubis
2017-11-14 15:59 ` [LTP] [PATCH v2 09/13] syscalls/mount03: Copy setuid_test to execute instead of 'TEST FILE' Punit Agrawal
2017-11-29 13:20 ` Cyril Hrubis
2017-11-29 16:50 ` Punit Agrawal
2017-11-30 12:21 ` Cyril Hrubis
2017-11-30 12:56 ` Punit Agrawal
2017-11-30 13:17 ` Cyril Hrubis
2017-11-30 15:56 ` Punit Agrawal
2017-11-14 15:59 ` [LTP] [PATCH v2 10/13] getdtablesize01: Handle ENFILE errno Punit Agrawal
2017-11-30 13:12 ` Cyril Hrubis
2017-11-30 16:06 ` Punit Agrawal
2017-11-30 16:20 ` Cyril Hrubis
2017-11-30 16:41 ` Suzuki K Poulose
2017-12-01 13:38 ` Cyril Hrubis
2017-12-01 15:30 ` Punit Agrawal
2017-11-14 15:59 ` Punit Agrawal [this message]
2017-11-14 15:59 ` [LTP] [PATCH v2 12/13] hotplug/cpu_hotplug: Repopulate cgroup:cpusets after testing hotplug Punit Agrawal
2017-11-30 13:58 ` Cyril Hrubis
2017-12-01 16:00 ` Punit Agrawal
2017-11-14 15:59 ` [LTP] [PATCH v2 13/13] hotplug/cpu_hotplug: Remove bashism disown from kill_pid() Punit Agrawal
2017-11-21 16:15 ` [LTP] [PATCH v2 00/13] Collection of fixes Punit Agrawal
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=20171114155929.24237-12-punit.agrawal@arm.com \
--to=punit.agrawal@arm.com \
--cc=ltp@lists.linux.it \
/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