From mboxrd@z Thu Jan 1 00:00:00 1970 From: Luis Chamberlain Subject: Re: [RFC v3 01/19] kunit: test: add KUnit test runner core Date: Thu, 29 Nov 2018 19:28:02 -0800 Message-ID: <20181130032802.GG18410@garbanzo.do-not-panic.com> References: <20181128193636.254378-1-brendanhiggins@google.com> <20181128193636.254378-2-brendanhiggins@google.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Content-Disposition: inline In-Reply-To: <20181128193636.254378-2-brendanhiggins@google.com> Sender: linux-kernel-owner@vger.kernel.org To: Brendan Higgins Cc: gregkh@linuxfoundation.org, keescook@google.com, shuah@kernel.org, joel@jms.id.au, mpe@ellerman.id.au, joe@perches.com, brakmo@fb.com, rostedt@goodmis.org, Tim.Bird@sony.com, khilman@baylibre.com, julia.lawall@lip6.fr, linux-kselftest@vger.kernel.org, kunit-dev@googlegroups.com, linux-kernel@vger.kernel.org, jdike@addtoit.com, richard@nod.at, linux-um@lists.infradead.org, daniel@ffwll.ch, dri-devel@lists.freedesktop.org, robh@kernel.org, dan.j.williams@intel.com, linux-nvdimm@lists.01.org, kieran.bingham@ideasonboard.com, frowand.list@gmail.com, knut.omang@oracle.com List-Id: dri-devel@lists.freedesktop.org > +static void kunit_run_case_internal(struct kunit *test, > + struct kunit_module *module, > + struct kunit_case *test_case) > +{ > + int ret; > + > + if (module->init) { > + ret = module->init(test); > + if (ret) { > + kunit_err(test, "failed to initialize: %d", ret); > + kunit_set_success(test, false); > + return; > + } > + } > + > + test_case->run_case(test); > +} <-- snip --> > +static bool kunit_run_case(struct kunit *test, > + struct kunit_module *module, > + struct kunit_case *test_case) > +{ > + kunit_set_success(test, true); > + > + kunit_run_case_internal(test, module, test_case); > + kunit_run_case_cleanup(test, module, test_case); > + > + return kunit_get_success(test); > +} So we are running the module->init() for each test case... is that correct? Shouldn't the init run once? Also, typically init calls are pegged with __init so we free them later. You seem to have skipped the init annotations. Why? Luis