Re: [PATCH v2 11/22] perf test: Convert watch point tests to test cases.

From: Arnaldo Carvalho de Melo
Date: Sat Nov 13 2021 - 16:11:09 EST


Em Wed, Oct 13, 2021 at 10:45:53AM -0700, Ian Rogers escreveu:
> Use null terminated array of test cases rather than the previous sub
> test functions.
>
> Signed-off-by: Ian Rogers <irogers@xxxxxxxxxx>
> ---
> tools/perf/tests/wp.c | 128 ++++++++++--------------------------------
> 1 file changed, 30 insertions(+), 98 deletions(-)
>
> diff --git a/tools/perf/tests/wp.c b/tools/perf/tests/wp.c
> index 904bdf2dcf81..2c0513257b15 100644
> --- a/tools/perf/tests/wp.c
> +++ b/tools/perf/tests/wp.c
> @@ -62,8 +62,12 @@ static int __event(int wp_type, void *wp_addr, unsigned long wp_len)
> return fd;
> }
>

65 6.29 ubuntu:16.04-x-s390 : FAIL gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.9)
tests/wp.c:24:12: error: 'wp_read' defined but not used [-Werror=unused-function]
static int wp_read(int fd, long long *count, int size)
^
tests/wp.c:51:12: error: '__event' defined but not used [-Werror=unused-function]
static int __event(int wp_type, void *wp_addr, unsigned long wp_len)
^
cc1: all warnings being treated as errors
/git/perf-5.15.0/tools/build/Makefile.build:139: recipe for target 'tests' failed
make[3]: *** [tests] Error 2


Trying with:


diff --git a/tools/perf/tests/wp.c b/tools/perf/tests/wp.c
index 2c0513257b15c041..820d942b30c390e9 100644
--- a/tools/perf/tests/wp.c
+++ b/tools/perf/tests/wp.c
@@ -48,6 +48,7 @@ static void get__perf_event_attr(struct perf_event_attr *attr, int wp_type,
attr->exclude_hv = 1;
}

+#ifndef __s390x__
static int __event(int wp_type, void *wp_addr, unsigned long wp_len)
{
int fd;
@@ -61,6 +62,7 @@ static int __event(int wp_type, void *wp_addr, unsigned long wp_len)

return fd;
}
+#endif

static int test__wp_ro(struct test_suite *test __maybe_unused,
int subtest __maybe_unused)