* [PATCH] perf dlfilter: Add a test for object_code()
@ 2023-09-28 9:10 Adrian Hunter
2023-10-12 21:42 ` Ian Rogers
0 siblings, 1 reply; 2+ messages in thread
From: Adrian Hunter @ 2023-09-28 9:10 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo
Cc: Jiri Olsa, Namhyung Kim, Ian Rogers, linux-kernel,
linux-perf-users
Extend the "dlfilter C API" test to test
perf_dlfilter_fns.object_code().
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
---
tools/perf/dlfilters/dlfilter-test-api-v0.c | 12 +++++++++++-
tools/perf/dlfilters/dlfilter-test-api-v2.c | 12 +++++++++++-
2 files changed, 22 insertions(+), 2 deletions(-)
diff --git a/tools/perf/dlfilters/dlfilter-test-api-v0.c b/tools/perf/dlfilters/dlfilter-test-api-v0.c
index 72f263d49121..4083b1abeaab 100644
--- a/tools/perf/dlfilters/dlfilter-test-api-v0.c
+++ b/tools/perf/dlfilters/dlfilter-test-api-v0.c
@@ -289,6 +289,15 @@ static int check_attr(void *ctx)
return 0;
}
+static int check_object_code(void *ctx, const struct perf_dlfilter_sample *sample)
+{
+ __u8 buf[15];
+
+ CHECK(perf_dlfilter_fns.object_code(ctx, sample->ip, buf, sizeof(buf)) > 0);
+
+ return 0;
+}
+
static int do_checks(void *data, const struct perf_dlfilter_sample *sample, void *ctx, bool early)
{
struct filter_data *d = data;
@@ -314,7 +323,8 @@ static int do_checks(void *data, const struct perf_dlfilter_sample *sample, void
if (early && !d->do_early)
return 0;
- if (check_al(ctx) || check_addr_al(ctx) || check_address_al(ctx, sample))
+ if (check_al(ctx) || check_addr_al(ctx) || check_address_al(ctx, sample) ||
+ check_object_code(ctx, sample))
return -1;
if (early)
diff --git a/tools/perf/dlfilters/dlfilter-test-api-v2.c b/tools/perf/dlfilters/dlfilter-test-api-v2.c
index 38e593d92920..32ff619e881c 100644
--- a/tools/perf/dlfilters/dlfilter-test-api-v2.c
+++ b/tools/perf/dlfilters/dlfilter-test-api-v2.c
@@ -308,6 +308,15 @@ static int check_attr(void *ctx)
return 0;
}
+static int check_object_code(void *ctx, const struct perf_dlfilter_sample *sample)
+{
+ __u8 buf[15];
+
+ CHECK(perf_dlfilter_fns.object_code(ctx, sample->ip, buf, sizeof(buf)) > 0);
+
+ return 0;
+}
+
static int do_checks(void *data, const struct perf_dlfilter_sample *sample, void *ctx, bool early)
{
struct filter_data *d = data;
@@ -333,7 +342,8 @@ static int do_checks(void *data, const struct perf_dlfilter_sample *sample, void
if (early && !d->do_early)
return 0;
- if (check_al(ctx) || check_addr_al(ctx) || check_address_al(ctx, sample))
+ if (check_al(ctx) || check_addr_al(ctx) || check_address_al(ctx, sample) ||
+ check_object_code(ctx, sample))
return -1;
if (early)
--
2.34.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] perf dlfilter: Add a test for object_code()
2023-09-28 9:10 [PATCH] perf dlfilter: Add a test for object_code() Adrian Hunter
@ 2023-10-12 21:42 ` Ian Rogers
0 siblings, 0 replies; 2+ messages in thread
From: Ian Rogers @ 2023-10-12 21:42 UTC (permalink / raw)
To: Adrian Hunter
Cc: Arnaldo Carvalho de Melo, Jiri Olsa, Namhyung Kim, linux-kernel,
linux-perf-users
On Thu, Sep 28, 2023 at 2:10 AM Adrian Hunter <adrian.hunter@intel.com> wrote:
>
> Extend the "dlfilter C API" test to test
> perf_dlfilter_fns.object_code().
>
> Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Tested-by: Ian Rogers <irogers@google.com>
Thanks,
Ian
> ---
> tools/perf/dlfilters/dlfilter-test-api-v0.c | 12 +++++++++++-
> tools/perf/dlfilters/dlfilter-test-api-v2.c | 12 +++++++++++-
> 2 files changed, 22 insertions(+), 2 deletions(-)
>
> diff --git a/tools/perf/dlfilters/dlfilter-test-api-v0.c b/tools/perf/dlfilters/dlfilter-test-api-v0.c
> index 72f263d49121..4083b1abeaab 100644
> --- a/tools/perf/dlfilters/dlfilter-test-api-v0.c
> +++ b/tools/perf/dlfilters/dlfilter-test-api-v0.c
> @@ -289,6 +289,15 @@ static int check_attr(void *ctx)
> return 0;
> }
>
> +static int check_object_code(void *ctx, const struct perf_dlfilter_sample *sample)
> +{
> + __u8 buf[15];
> +
> + CHECK(perf_dlfilter_fns.object_code(ctx, sample->ip, buf, sizeof(buf)) > 0);
> +
> + return 0;
> +}
> +
> static int do_checks(void *data, const struct perf_dlfilter_sample *sample, void *ctx, bool early)
> {
> struct filter_data *d = data;
> @@ -314,7 +323,8 @@ static int do_checks(void *data, const struct perf_dlfilter_sample *sample, void
> if (early && !d->do_early)
> return 0;
>
> - if (check_al(ctx) || check_addr_al(ctx) || check_address_al(ctx, sample))
> + if (check_al(ctx) || check_addr_al(ctx) || check_address_al(ctx, sample) ||
> + check_object_code(ctx, sample))
> return -1;
>
> if (early)
> diff --git a/tools/perf/dlfilters/dlfilter-test-api-v2.c b/tools/perf/dlfilters/dlfilter-test-api-v2.c
> index 38e593d92920..32ff619e881c 100644
> --- a/tools/perf/dlfilters/dlfilter-test-api-v2.c
> +++ b/tools/perf/dlfilters/dlfilter-test-api-v2.c
> @@ -308,6 +308,15 @@ static int check_attr(void *ctx)
> return 0;
> }
>
> +static int check_object_code(void *ctx, const struct perf_dlfilter_sample *sample)
> +{
> + __u8 buf[15];
> +
> + CHECK(perf_dlfilter_fns.object_code(ctx, sample->ip, buf, sizeof(buf)) > 0);
> +
> + return 0;
> +}
> +
> static int do_checks(void *data, const struct perf_dlfilter_sample *sample, void *ctx, bool early)
> {
> struct filter_data *d = data;
> @@ -333,7 +342,8 @@ static int do_checks(void *data, const struct perf_dlfilter_sample *sample, void
> if (early && !d->do_early)
> return 0;
>
> - if (check_al(ctx) || check_addr_al(ctx) || check_address_al(ctx, sample))
> + if (check_al(ctx) || check_addr_al(ctx) || check_address_al(ctx, sample) ||
> + check_object_code(ctx, sample))
> return -1;
>
> if (early)
> --
> 2.34.1
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-10-12 21:43 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-09-28 9:10 [PATCH] perf dlfilter: Add a test for object_code() Adrian Hunter
2023-10-12 21:42 ` Ian Rogers
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).