From: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
To: acme@kernel.org, jolsa@kernel.org, ak@linux.intel.com
Cc: namhyung@kernel.org, irogers@google.com, james.clark@arm.com,
mpe@ellerman.id.au, linux-perf-users@vger.kernel.org,
linuxppc-dev@lists.ozlabs.org, maddy@linux.ibm.com,
rnsastry@linux.ibm.com, kjain@linux.ibm.com,
disgoel@linux.ibm.com,
Athira Rajeev <atrajeev@linux.vnet.ibm.com>
Subject: [PATCH] tools/perf/tests: Fix Basic BPF llvm compile to check for libbpf support
Date: Tue, 4 Jul 2023 10:33:27 +0530 [thread overview]
Message-ID: <20230704050327.14963-1-atrajeev@linux.vnet.ibm.com> (raw)
Basic BPF llvm compile fails in systems with libbpf
that doesn't support BTF. Log shows below information.
libbpf: BTF is required, but is missing or corrupted.
Failed to parse test case 'Basic BPF llvm compile'
test child finished with -2
---- end ----
Here BPF llvm compile fails due to missing BTF support.
Fix the llvm test to skip the test incase BTF support is
missing.
Signed-off-by: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
---
tools/perf/tests/llvm.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/tools/perf/tests/llvm.c b/tools/perf/tests/llvm.c
index 0bc25a56cfef..4c73c9eab0bb 100644
--- a/tools/perf/tests/llvm.c
+++ b/tools/perf/tests/llvm.c
@@ -4,6 +4,7 @@
#include <string.h>
#include "tests.h"
#include "debug.h"
+#include <errno.h>
#ifdef HAVE_LIBBPF_SUPPORT
#include <bpf/libbpf.h>
@@ -14,8 +15,12 @@ static int test__bpf_parsing(void *obj_buf, size_t obj_buf_sz)
struct bpf_object *obj;
obj = bpf_object__open_mem(obj_buf, obj_buf_sz, NULL);
- if (libbpf_get_error(obj))
+ if (libbpf_get_error(obj)) {
+ /* Skip if there is no BTF support */
+ if (errno == ENOENT)
+ return TEST_SKIP;
return TEST_FAIL;
+ }
bpf_object__close(obj);
return TEST_OK;
}
--
2.27.0
next reply other threads:[~2023-07-04 5:04 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-04 5:03 Athira Rajeev [this message]
2023-07-05 18:09 ` [PATCH] tools/perf/tests: Fix Basic BPF llvm compile to check for libbpf support Namhyung Kim
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=20230704050327.14963-1-atrajeev@linux.vnet.ibm.com \
--to=atrajeev@linux.vnet.ibm.com \
--cc=acme@kernel.org \
--cc=ak@linux.intel.com \
--cc=disgoel@linux.ibm.com \
--cc=irogers@google.com \
--cc=james.clark@arm.com \
--cc=jolsa@kernel.org \
--cc=kjain@linux.ibm.com \
--cc=linux-perf-users@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=maddy@linux.ibm.com \
--cc=mpe@ellerman.id.au \
--cc=namhyung@kernel.org \
--cc=rnsastry@linux.ibm.com \
/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;
as well as URLs for NNTP newsgroup(s).