From mboxrd@z Thu Jan 1 00:00:00 1970 From: Luis Chamberlain Subject: Re: [PATCH v5 07/18] kunit: test: add initial tests Date: Tue, 25 Jun 2019 23:22:49 +0000 Message-ID: <20190625232249.GS19023@42.do-not-panic.com> References: <20190617082613.109131-1-brendanhiggins@google.com> <20190617082613.109131-8-brendanhiggins@google.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Content-Disposition: inline In-Reply-To: <20190617082613.109131-8-brendanhiggins@google.com> Sender: linux-kernel-owner@vger.kernel.org To: Brendan Higgins Cc: frowand.list@gmail.com, gregkh@linuxfoundation.org, jpoimboe@redhat.com, keescook@google.com, kieran.bingham@ideasonboard.com, peterz@infradead.org, robh@kernel.org, sboyd@kernel.org, shuah@kernel.org, tytso@mit.edu, yamada.masahiro@socionext.com, devicetree@vger.kernel.org, dri-devel@lists.freedesktop.org, kunit-dev@googlegroups.com, linux-doc@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-nvdimm@lists.01.org, linux-um@lists.infradead.org, Alexander.Levin@microsoft.com, Tim.Bird@sony.com, amir73il@gmail.com, dan.carpenter@oracle.com, daniel@ffwll.ch, jdike@addtoit.com, joel@jms.id.au, julia.lawall@lip6.fr, khilman@baylibre.com, knut.omang@oracle.com, logang@deltatee.com, mpe@ellerma List-Id: devicetree@vger.kernel.org On Mon, Jun 17, 2019 at 01:26:02AM -0700, Brendan Higgins wrote: > diff --git a/kunit/example-test.c b/kunit/example-test.c > new file mode 100644 > index 0000000000000..f44b8ece488bb > --- /dev/null > +++ b/kunit/example-test.c <-- snip --> > +/* > + * This defines a suite or grouping of tests. > + * > + * Test cases are defined as belonging to the suite by adding them to > + * `kunit_cases`. > + * > + * Often it is desirable to run some function which will set up things which > + * will be used by every test; this is accomplished with an `init` function > + * which runs before each test case is invoked. Similarly, an `exit` function > + * may be specified which runs after every test case and can be used to for > + * cleanup. For clarity, running tests in a test module would behave as follows: > + * To be clear this is not the kernel module init, but rather the kunit module init. I think using kmodule would make this clearer to a reader. > + * module.init(test); > + * module.test_case[0](test); > + * module.exit(test); > + * module.init(test); > + * module.test_case[1](test); > + * module.exit(test); > + * ...; > + */ Luis