Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp3637690ybi; Tue, 2 Jul 2019 10:53:42 -0700 (PDT) X-Google-Smtp-Source: APXvYqwgjoENMzfai2EuypgwB1mlbwRE3VU35AbQ0Y4rN3mMHooupDArA6XllCFkkuI7oQEj+bmu X-Received: by 2002:a17:90a:32ec:: with SMTP id l99mr7068064pjb.44.1562090022511; Tue, 02 Jul 2019 10:53:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562090022; cv=none; d=google.com; s=arc-20160816; b=JNw2I9Jv6nT9+BXgJ6bQDMGV9JgwvMASDm4t0rgelyCnM342q5YlNfoWBAT4ksvmQQ efawkCdT5/PzyjT9hNXJJKJ+jd9vsNQ++D2eYemrri2cZ57Mn75eXaHUdMRz8M33hj2b 0aA3b0k69PG8VA4E3anQdox2y2umayzZ9sJd1IkiJOHNBoARxkrxiLqbHQfsTFL0+vG3 yaoHGg/TrRID8CAVf+w8sofPVmtD2bY0WIVTFTee6iq9VrkwQyglC8r59xvdyC+bvHz/ undAkF7rmepcAESKc4PJe1uGcjxETCBg9Zdt3RLU1p5t3gn87V1q0JH1ESiVLV4kc+20 N4Bg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=cUzLBUlR97uqGXzOFylb6nkkxBtyYZ1OhN+qvdTrCD0=; b=Gfl+BTs1ELcF4X94tFn/gx8vZpc9Q+GNa8/79ija6v4Ba93a85AWBfVkZ9uXE9DqI6 SVoJDml1eF8imf+y9YYw3rT9ujawO0FKzX7qZdNqujnb4BckSY/CN8XSScDTZZJHV8Sb beamub6OLNjr6+gH90EZjcBkrWUOanYzBVrphcNp1qgjQIz+zeL0yHl6CGTSAupHl+ZU VhHgFKUbVpfUhFrQFQNa4ofOsx6Hy0A21i/I7A77ChCm2Iqe5BAm1GrldF2h2q0+PqD8 k+j51ndGp/ToolwkepfIj06NDhoibzg1OJjT0c1wM8O8wLac9qHwwq4ew9y9IS/8hN5R Alsg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=roBJOIwX; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c18si12977686plo.316.2019.07.02.10.53.27; Tue, 02 Jul 2019 10:53:42 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=roBJOIwX; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726977AbfGBRxD (ORCPT + 99 others); Tue, 2 Jul 2019 13:53:03 -0400 Received: from mail-pf1-f196.google.com ([209.85.210.196]:39421 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726150AbfGBRxD (ORCPT ); Tue, 2 Jul 2019 13:53:03 -0400 Received: by mail-pf1-f196.google.com with SMTP id j2so8627960pfe.6 for ; Tue, 02 Jul 2019 10:53:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=cUzLBUlR97uqGXzOFylb6nkkxBtyYZ1OhN+qvdTrCD0=; b=roBJOIwXGuFOf1wltfxmsClcFxlkrjzp9+21T7P87pZ44BH/GjP/X/NuZ8mK2FoMzO XotmCr6d6KsdJATAIIUbq5Oy4zR4Azgkp4HhOE4XiupuZAs2/ZBggUQTxGqGQNrNXKUR RK1F2iELvIHqPezIMEexxn9HQjKb0Q7OjYsSgJwmHDUbD4xwBf6WQFlfeS4XFqE89Pff n78AWxKci0ljIJl3H7X5khQxePoPu8jM9jZ95VMb0Zsz46NlIICQ2qPhYIcCIBC8U20Z P1PLSOLwoWTdUhh3getWGZNkHFehqyZ7w/vmIfDcbd6OQGJv5O6KIgY9x4cjlJKaYt87 yyiQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=cUzLBUlR97uqGXzOFylb6nkkxBtyYZ1OhN+qvdTrCD0=; b=W1ZKFau96LjejRocNxwbFsSK/zj9WCblgbjwiDixK45R1rKS9V+XAVOXMq545PJ2Uy 331IddEM1yq8NPfd05fcNSL24GHaAByt0XTVeAEO9H+CetWoOHfAW3gFSHws44xX1ynZ N50+NdYlBelNTNOWTosLdpnYc3RyqpMhMsPbumgy4qKz35AIrMrjQaU84HF6QDSPkWQe NTqiVrAa/XyZzB3ae24mUmwuqJDBJKgNlnIbGhotgY9/TaBBx+Q/WccnDwNUG0YtNu9U Txik3b8fwa2z1EvwI0ApGN4wQLSZ65wGy2bmspZPQj8zPW9FOtx3nhID/ItNpf8LS8ik V5qg== X-Gm-Message-State: APjAAAVbtmLGyQ64LPAjq7GvzoctbEm+Z11+TDVcgvvI3R+Kn98AidDf O/jWeI2XXjfV3tCKt91CGj9fK6tMcLuvQYPk/YcVUQ== X-Received: by 2002:a63:205f:: with SMTP id r31mr23471478pgm.159.1562089981635; Tue, 02 Jul 2019 10:53:01 -0700 (PDT) MIME-Version: 1.0 References: <20190617082613.109131-1-brendanhiggins@google.com> <20190617082613.109131-8-brendanhiggins@google.com> <20190625232249.GS19023@42.do-not-panic.com> In-Reply-To: From: Brendan Higgins Date: Tue, 2 Jul 2019 10:52:50 -0700 Message-ID: Subject: Re: [PATCH v5 07/18] kunit: test: add initial tests To: Luis Chamberlain Cc: Frank Rowand , Greg KH , Josh Poimboeuf , Kees Cook , Kieran Bingham , Peter Zijlstra , Rob Herring , Stephen Boyd , shuah , "Theodore Ts'o" , Masahiro Yamada , devicetree , dri-devel , kunit-dev@googlegroups.com, "open list:DOCUMENTATION" , linux-fsdevel@vger.kernel.org, linux-kbuild , Linux Kernel Mailing List , "open list:KERNEL SELFTEST FRAMEWORK" , linux-nvdimm , linux-um@lists.infradead.org, Sasha Levin , "Bird, Timothy" , Amir Goldstein , Dan Carpenter , Daniel Vetter , Jeff Dike , Joel Stanley , Julia Lawall , Kevin Hilman , Knut Omang , Logan Gunthorpe , Michael Ellerman , Petr Mladek , Randy Dunlap , Richard Weinberger , David Rientjes , Steven Rostedt , wfg@linux.intel.com Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jun 26, 2019 at 12:53 AM Brendan Higgins wrote: > > On Tue, Jun 25, 2019 at 4:22 PM Luis Chamberlain wrote: > > > > 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. > > Seems reasonable. Will fix in next revision. > > > > + * module.init(test); > > > + * module.test_case[0](test); > > > + * module.exit(test); > > > + * module.init(test); > > > + * module.test_case[1](test); > > > + * module.exit(test); > > > + * ...; > > > + */ Do you think it might be clearer yet to rename `struct kunit_module *module;` to `struct kunit_suite *suite;`?