[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAP-5=fVkA0-JMn-Xu-typJYFod-+LfyAwdUKCKEDQdQu4V_NNw@mail.gmail.com>
Date: Thu, 22 Feb 2024 16:02:07 -0800
From: Ian Rogers <irogers@...gle.com>
To: Arnaldo Carvalho de Melo <acme@...nel.org>
Cc: Namhyung Kim <namhyung@...nel.org>, Adrian Hunter <adrian.hunter@...el.com>,
Jiri Olsa <jolsa@...nel.org>, Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
linux-perf-users@...r.kernel.org
Subject: Re: [PATCH 1/1] perf test: Use TEST_FAIL in the TEST_ASSERT macros
instead of -1
On Thu, Feb 22, 2024 at 12:07 PM Arnaldo Carvalho de Melo
<acme@...nel.org> wrote:
>
> Just to make things clearer, return TEST_FAIL (-1) instead of an open
> coded -1.
>
> Cc: Adrian Hunter <adrian.hunter@...el.com>
> Cc: Ian Rogers <irogers@...gle.com>
> Cc: Jiri Olsa <jolsa@...nel.org>
> Cc: Namhyung Kim <namhyung@...nel.org>
> Signed-off-by: Arnaldo Carvalho de Melo <acme@...hat.com>
Reviewed-by: Ian Rogers <irogers@...gle.com>
Thanks,
Ian
> ---
> tools/perf/tests/tests.h | 16 ++++++++--------
> 1 file changed, 8 insertions(+), 8 deletions(-)
>
> diff --git a/tools/perf/tests/tests.h b/tools/perf/tests/tests.h
> index dad3d7414142d1be..3aa7701ee0e939f7 100644
> --- a/tools/perf/tests/tests.h
> +++ b/tools/perf/tests/tests.h
> @@ -4,11 +4,17 @@
>
> #include <stdbool.h>
>
> +enum {
> + TEST_OK = 0,
> + TEST_FAIL = -1,
> + TEST_SKIP = -2,
> +};
> +
> #define TEST_ASSERT_VAL(text, cond) \
> do { \
> if (!(cond)) { \
> pr_debug("FAILED %s:%d %s\n", __FILE__, __LINE__, text); \
> - return -1; \
> + return TEST_FAIL; \
> } \
> } while (0)
>
> @@ -17,16 +23,10 @@ do { \
> if (val != expected) { \
> pr_debug("FAILED %s:%d %s (%d != %d)\n", \
> __FILE__, __LINE__, text, val, expected); \
> - return -1; \
> + return TEST_FAIL; \
> } \
> } while (0)
>
> -enum {
> - TEST_OK = 0,
> - TEST_FAIL = -1,
> - TEST_SKIP = -2,
> -};
> -
> struct test_suite;
>
> typedef int (*test_fnptr)(struct test_suite *, int);
> --
> 2.43.0
>
Powered by blists - more mailing lists