[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAFd5g44Dizk-VsFOmGn++E0d40sZmH6V+j05Eu6zUXaBj1xfcA@mail.gmail.com>
Date: Tue, 19 Feb 2019 15:20:18 -0800
From: Brendan Higgins <brendanhiggins@...gle.com>
To: Stephen Boyd <sboyd@...nel.org>
Cc: Frank Rowand <frowand.list@...il.com>,
Kees Cook <keescook@...gle.com>,
Kieran Bingham <kieran.bingham@...asonboard.com>,
Luis Chamberlain <mcgrof@...nel.org>,
Rob Herring <robh@...nel.org>, shuah@...nel.org,
Greg KH <gregkh@...uxfoundation.org>,
Joel Stanley <joel@....id.au>,
Michael Ellerman <mpe@...erman.id.au>,
Joe Perches <joe@...ches.com>, brakmo@...com,
Steven Rostedt <rostedt@...dmis.org>,
"Bird, Timothy" <Tim.Bird@...y.com>,
Kevin Hilman <khilman@...libre.com>,
Julia Lawall <julia.lawall@...6.fr>,
linux-kselftest@...r.kernel.org, kunit-dev@...glegroups.com,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Jeff Dike <jdike@...toit.com>,
Richard Weinberger <richard@....at>,
linux-um@...ts.infradead.org, Daniel Vetter <daniel@...ll.ch>,
dri-devel <dri-devel@...ts.freedesktop.org>,
Dan Williams <dan.j.williams@...el.com>,
linux-nvdimm <linux-nvdimm@...ts.01.org>,
Knut Omang <knut.omang@...cle.com>,
devicetree <devicetree@...r.kernel.org>,
Petr Mladek <pmladek@...e.com>,
Sasha Levin <Alexander.Levin@...rosoft.com>,
amir73il@...il.com, dan.carpenter@...cle.com, wfg@...ux.intel.com,
Avinash Kondareddy <avikr@...gle.com>
Subject: Re: [RFC v4 10/17] kunit: test: add test managed resource tests
On Fri, Feb 15, 2019 at 12:54 PM Stephen Boyd <sboyd@...nel.org> wrote:
>
> Quoting Brendan Higgins (2019-02-14 13:37:22)
> > diff --git a/kunit/test-test.c b/kunit/test-test.c
> > index 0b4ad6690310d..bb34431398526 100644
> > --- a/kunit/test-test.c
> > +++ b/kunit/test-test.c
> [...]
> > +
> > +#define KUNIT_RESOURCE_NUM 5
> > +static void kunit_resource_test_cleanup_resources(struct kunit *test)
> > +{
> > + int i;
> > + struct kunit_test_resource_context *ctx = test->priv;
> > + struct kunit_resource *resources[KUNIT_RESOURCE_NUM];
> > +
> > + for (i = 0; i < KUNIT_RESOURCE_NUM; i++) {
>
> Nitpick: This could use ARRAY_SIZE(resources) and then the #define could
> be dropped.
Noted. Will fix in next revision.
>
> > + resources[i] = kunit_alloc_resource(&ctx->test,
> > + fake_resource_init,
> > + fake_resource_free,
> > + ctx);
> > + }
> > +
> > + kunit_cleanup(&ctx->test);
> > +
> > + KUNIT_EXPECT_TRUE(test, list_empty(&ctx->test.resources));
> > +}
> > +
> [...]
> > +
> > +static struct kunit_case kunit_resource_test_cases[] = {
>
> Can these arrays be const?
There is some private mutable state inside of `struct kunit_case` that
would be kind of annoying to pull out; I don't think it would make it
cleaner.
Powered by blists - more mailing lists