[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <155026451067.115909.17082794837098610153@swboyd.mtv.corp.google.com>
Date: Fri, 15 Feb 2019 13:01:50 -0800
From: Stephen Boyd <sboyd@...nel.org>
To: Brendan Higgins <brendanhiggins@...gle.com>,
frowand.list@...il.com, keescook@...gle.com,
kieran.bingham@...asonboard.com, mcgrof@...nel.org,
robh@...nel.org, shuah@...nel.org
Cc: gregkh@...uxfoundation.org, joel@....id.au, mpe@...erman.id.au,
joe@...ches.com, brakmo@...com, rostedt@...dmis.org,
Tim.Bird@...y.com, khilman@...libre.com, julia.lawall@...6.fr,
linux-kselftest@...r.kernel.org, kunit-dev@...glegroups.com,
linux-kernel@...r.kernel.org, jdike@...toit.com, richard@....at,
linux-um@...ts.infradead.org, daniel@...ll.ch,
dri-devel@...ts.freedesktop.org, dan.j.williams@...el.com,
linux-nvdimm@...ts.01.org, knut.omang@...cle.com,
devicetree@...r.kernel.org, pmladek@...e.com,
Alexander.Levin@...rosoft.com, amir73il@...il.com,
dan.carpenter@...cle.com, wfg@...ux.intel.com,
Brendan Higgins <brendanhiggins@...gle.com>
Subject: Re: [RFC v4 02/17] kunit: test: add test resource management API
Quoting Brendan Higgins (2019-02-14 13:37:14)
> @@ -104,6 +167,7 @@ struct kunit {
> const char *name; /* Read only after initialization! */
> spinlock_t lock; /* Gaurds all mutable test state. */
> bool success; /* Protected by lock. */
> + struct list_head resources; /* Protected by lock. */
> void (*vprintk)(const struct kunit *test,
> const char *level,
> struct va_format *vaf);
> @@ -127,6 +191,51 @@ int kunit_run_tests(struct kunit_module *module);
> } \
> late_initcall(module_kunit_init##module)
>
> +/**
> + * kunit_alloc_resource() - Allocates a *test managed resource*.
> + * @test: The test context object.
> + * @init: a user supplied function to initialize the resource.
> + * @free: a user supplied function to free the resource.
> + * @context: for the user to pass in arbitrary data.
Nitpick: "pass in arbitrary data to the init function"? Maybe that
provides some more clarity.
> + *
> + * Allocates a *test managed resource*, a resource which will automatically be
> + * cleaned up at the end of a test case. See &struct kunit_resource for an
> + * example.
> + */
Powered by blists - more mailing lists