[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190812234644.E054D20679@mail.kernel.org>
Date: Mon, 12 Aug 2019 16:46:44 -0700
From: Stephen Boyd <sboyd@...nel.org>
To: Brendan Higgins <brendanhiggins@...gle.com>,
frowand.list@...il.com, gregkh@...uxfoundation.org,
jpoimboe@...hat.com, keescook@...gle.com,
kieran.bingham@...asonboard.com, mcgrof@...nel.org,
peterz@...radead.org, robh@...nel.org, shuah@...nel.org,
tytso@....edu, yamada.masahiro@...ionext.com
Cc: devicetree@...r.kernel.org, dri-devel@...ts.freedesktop.org,
kunit-dev@...glegroups.com, linux-doc@...r.kernel.org,
linux-fsdevel@...r.kernel.org, linux-kbuild@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-kselftest@...r.kernel.org,
linux-nvdimm@...ts.01.org, linux-um@...ts.infradead.org,
Alexander.Levin@...rosoft.com, Tim.Bird@...y.com,
amir73il@...il.com, dan.carpenter@...cle.com, daniel@...ll.ch,
jdike@...toit.com, joel@....id.au, julia.lawall@...6.fr,
khilman@...libre.com, knut.omang@...cle.com, logang@...tatee.com,
mpe@...erman.id.au, pmladek@...e.com, rdunlap@...radead.org,
richard@....at, rientjes@...gle.com, rostedt@...dmis.org,
wfg@...ux.intel.com, Brendan Higgins <brendanhiggins@...gle.com>
Subject: Re: [PATCH v12 04/18] kunit: test: add assertion printing library
Quoting Brendan Higgins (2019-08-12 11:24:07)
> Add `struct kunit_assert` and friends which provide a structured way to
> capture data from an expectation or an assertion (introduced later in
> the series) so that it may be printed out in the event of a failure.
>
> Signed-off-by: Brendan Higgins <brendanhiggins@...gle.com>
> ---
Reviewed-by: Stephen Boyd <sboyd@...nel.org>
Just some minor nits below
> diff --git a/include/kunit/assert.h b/include/kunit/assert.h
> new file mode 100644
> index 0000000000000..55f1b88b0cb4d
> --- /dev/null
> +++ b/include/kunit/assert.h
> @@ -0,0 +1,183 @@
[...]
> + struct string_stream *stream);
> +
> +struct kunit_fail_assert {
> + struct kunit_assert assert;
> +};
> +
> +void kunit_fail_assert_format(const struct kunit_assert *assert,
> + struct string_stream *stream);
> +
> +#define KUNIT_INIT_FAIL_ASSERT_STRUCT(test, type) { \
> + .assert = KUNIT_INIT_ASSERT_STRUCT(test, \
> + type, \
> + kunit_fail_assert_format) \
This one got indented one too many times?
> +}
> +
> +struct kunit_unary_assert {
> + struct kunit_assert assert;
> + const char *condition;
> + bool expected_true;
> +};
> +
> +void kunit_unary_assert_format(const struct kunit_assert *assert,
> + struct string_stream *stream);
> +
[...]
> +#define KUNIT_INIT_BINARY_STR_ASSERT_STRUCT(test, \
> + type, \
> + op_str, \
> + left_str, \
> + left_val, \
> + right_str, \
> + right_val) { \
> + .assert = KUNIT_INIT_ASSERT_STRUCT(test, \
> + type, \
> + kunit_binary_str_assert_format), \
> + .operation = op_str, \
> + .left_text = left_str, \
> + .left_value = left_val, \
> + .right_text = right_str, \
> + .right_value = right_val \
> +}
It would be nice to have kernel doc on these macros so we know how to
use them.
Powered by blists - more mailing lists