[RFC v4 14/17] MAINTAINERS: add entry for KUnit the unit testing framework

2019-02-16 Thread Brendan Higgins via dri-devel
Add myself as maintainer of KUnit, the Linux kernel's unit testing framework. Signed-off-by: Brendan Higgins --- MAINTAINERS | 10 ++ 1 file changed, 10 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index 8c68de3cfd80e..ff2cc9fcb49ad 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@

[RFC v4 07/17] kunit: test: add initial tests

2019-02-16 Thread Brendan Higgins via dri-devel
Add a test for string stream along with a simpler example. Signed-off-by: Brendan Higgins --- kunit/Kconfig | 12 ++ kunit/Makefile | 4 ++ kunit/example-test.c | 88 ++ kunit/string-stream-test.c | 61 ++

Re: [RFC v3 17/19] of: unittest: migrate tests to run on KUnit

2019-02-16 Thread Brendan Higgins via dri-devel
On Thu, Feb 14, 2019 at 12:10 PM Rob Herring wrote: > > On Tue, Feb 12, 2019 at 7:44 PM Brendan Higgins > wrote: > > > > On Wed, Nov 28, 2018 at 12:56 PM Rob Herring wrote: > > > > > > On Wed, Nov 28, 2018 at 1:38 PM Brendan Higgins > > > wrote: > > > > > > > > Migrate tests without any cleanup

[RFC v4 16/17] of: unittest: split out a couple of test cases from unittest

2019-02-16 Thread Brendan Higgins via dri-devel
Split out a couple of test cases that these features in base.c from the unittest.c monolith. The intention is that we will eventually split out all test cases and group them together based on what portion of device tree they test. Signed-off-by: Brendan Higgins --- drivers/of/Makefile | 2

[RFC v4 15/17] of: unittest: migrate tests to run on KUnit

2019-02-16 Thread Brendan Higgins via dri-devel
Migrate tests without any cleanup, or modifying test logic in anyway to run under KUnit using the KUnit expectation and assertion API. Signed-off-by: Brendan Higgins --- drivers/of/Kconfig|1 + drivers/of/unittest.c | 1310 + 2 files changed, 671 i

[RFC v4 13/17] Documentation: kunit: add documentation for KUnit

2019-02-16 Thread Brendan Higgins via dri-devel
Add documentation for KUnit, the Linux kernel unit testing framework. - Add intro and usage guide for KUnit - Add API reference Signed-off-by: Felix Guo Signed-off-by: Brendan Higgins --- Documentation/index.rst | 1 + Documentation/kunit/api/index.rst | 16 ++ Documentation/kunit/

[RFC v4 10/17] kunit: test: add test managed resource tests

2019-02-16 Thread Brendan Higgins via dri-devel
Tests how tests interact with test managed resources in their lifetime. Signed-off-by: Avinash Kondareddy Signed-off-by: Brendan Higgins --- kunit/test-test.c | 121 ++ 1 file changed, 121 insertions(+) diff --git a/kunit/test-test.c b/kunit/test-tes

[RFC v4 05/17] kunit: test: add the concept of expectations

2019-02-16 Thread Brendan Higgins via dri-devel
Add support for expectations, which allow properties to be specified and then verified in tests. Signed-off-by: Brendan Higgins --- include/kunit/test.h | 415 +++ kunit/test.c | 34 2 files changed, 449 insertions(+) diff --git a/include/ku

Re: [RFC v3 14/19] Documentation: kunit: add documentation for KUnit

2019-02-16 Thread Brendan Higgins via dri-devel
On Thu, Feb 14, 2019 at 9:26 AM Luis Chamberlain wrote: > > On Wed, Feb 13, 2019 at 04:17:13PM -0800, Brendan Higgins wrote: > > On Wed, Feb 13, 2019 at 1:55 PM Kieran Bingham > > wrote: > > Oh, yep, you are right. Does that mean we should bother at all with a > > defconfig? > > If one wanted a

[RFC v4 11/17] kunit: tool: add Python wrappers for running KUnit tests

2019-02-16 Thread Brendan Higgins via dri-devel
From: Felix Guo The ultimate goal is to create minimal isolated test binaries; in the meantime we are using UML to provide the infrastructure to run tests, so define an abstract way to configure and run tests that allow us to change the context in which tests are built without affecting the user.

[RFC v4 09/17] kunit: test: add the concept of assertions

2019-02-16 Thread Brendan Higgins via dri-devel
Add support for assertions which are like expectations except the test terminates if the assertion is not satisfied. Signed-off-by: Brendan Higgins --- include/kunit/test.h | 397 - kunit/string-stream-test.c | 12 +- kunit/test-test.c | 2 +

[RFC v4 12/17] kunit: defconfig: add defconfigs for building KUnit tests

2019-02-16 Thread Brendan Higgins via dri-devel
Add defconfig for UML and a fragment that can be used to configure other architectures for building KUnit tests. Add option to kunit_tool to use a defconfig to create the kunitconfig. Signed-off-by: Brendan Higgins --- Changes Since Last Version - This patch is new adding default configs to buil

[RFC v4 06/17] kbuild: enable building KUnit

2019-02-16 Thread Brendan Higgins via dri-devel
Add KUnit to root Kconfig and Makefile allowing it to actually be built. Signed-off-by: Brendan Higgins --- Changes Since Last Version - Rewrote patch description. This was previously called "[RFC v3 06/19] arch: um: enable running kunit from User Mode Linux," which was incorrect since thi

[RFC v4 04/17] kunit: test: add test_stream a std::stream like logger

2019-02-16 Thread Brendan Higgins via dri-devel
A lot of the expectation and assertion infrastructure prints out fairly complicated test failure messages, so add a C++ style log library for for logging test results. Signed-off-by: Brendan Higgins --- include/kunit/kunit-stream.h | 50 include/kunit/test.h | 2 + kunit/

[RFC v4 17/17] of: unittest: split up some super large test cases

2019-02-16 Thread Brendan Higgins via dri-devel
Split up the super large test cases of_unittest_find_node_by_name and of_unittest_dynamic into properly sized and defined test cases. Signed-off-by: Brendan Higgins --- drivers/of/base-test.c | 297 ++--- 1 file changed, 249 insertions(+), 48 deletions(-) dif

[RFC v4 02/17] kunit: test: add test resource management API

2019-02-16 Thread Brendan Higgins via dri-devel
Create a common API for test managed resources like memory and test objects. A lot of times a test will want to set up infrastructure to be used in test cases; this could be anything from just wanting to allocate some memory to setting up a driver stack; this defines facilities for creating "test r

[RFC v4 08/17] kunit: test: add support for test abort

2019-02-16 Thread Brendan Higgins via dri-devel
Add support for aborting/bailing out of test cases. Needed for implementing assertions. Signed-off-by: Brendan Higgins --- Changes Since Last Version - This patch is new introducing a new cross-architecture way to abort out of a test case (needed for KUNIT_ASSERT_*, see next patch for deta

Re: [RFC v3 18/19] of: unittest: split out a couple of test cases from unittest

2019-02-16 Thread Brendan Higgins via dri-devel
On Thu, Feb 14, 2019 at 6:05 PM Frank Rowand wrote: > > On 2/14/19 4:56 PM, Brendan Higgins wrote: > > On Thu, Feb 14, 2019 at 3:57 PM Frank Rowand wrote: > >> > >> On 12/5/18 3:54 PM, Brendan Higgins wrote: > >>> On Tue, Dec 4, 2018 at 2:58 AM Frank Rowand > >>> wrote: > > Hi Brendan

Re: [RFC v3 18/19] of: unittest: split out a couple of test cases from unittest

2019-02-16 Thread Brendan Higgins via dri-devel
On Thu, Feb 14, 2019 at 3:57 PM Frank Rowand wrote: > > On 12/5/18 3:54 PM, Brendan Higgins wrote: > > On Tue, Dec 4, 2018 at 2:58 AM Frank Rowand wrote: > >> > >> Hi Brendan, > >> > >> On 11/28/18 11:36 AM, Brendan Higgins wrote: > >>> Split out a couple of test cases that these features in base

[RFC v4 01/17] kunit: test: add KUnit test runner core

2019-02-15 Thread Brendan Higgins via dri-devel
Add core facilities for defining unit tests; this provides a common way to define test cases, functions that execute code which is under test and determine whether the code under test behaves as expected; this also provides a way to group together related test cases in test suites (here we call the

[RFC v4 03/17] kunit: test: add string_stream a std::stream like string builder

2019-02-15 Thread Brendan Higgins via dri-devel
A number of test features need to do pretty complicated string printing where it may not be possible to rely on a single preallocated string with parameters. So provide a library for constructing the string as you go similar to C++'s std::string. Signed-off-by: Brendan Higgins --- Changes Since

[RFC v4 00/17] kunit: introduce KUnit, the Linux kernel unit testing framework

2019-02-15 Thread Brendan Higgins via dri-devel
This patch set proposes KUnit, a lightweight unit testing and mocking framework for the Linux kernel. Unlike Autotest and kselftest, KUnit is a true unit testing framework; it does not require installing the kernel on a test machine or in a VM and does not require tests to be written in userspace

Re: [RFC v3 17/19] of: unittest: migrate tests to run on KUnit

2019-02-14 Thread Brendan Higgins via dri-devel
On Wed, Nov 28, 2018 at 12:56 PM Rob Herring wrote: > > On Wed, Nov 28, 2018 at 1:38 PM Brendan Higgins > wrote: > > > > Migrate tests without any cleanup, or modifying test logic in anyway to > > run under KUnit using the KUnit expectation and assertion API. > > Nice! You beat me to it. This is

Re: [RFC v3 14/19] Documentation: kunit: add documentation for KUnit

2019-02-14 Thread Brendan Higgins via dri-devel
On Wed, Feb 13, 2019 at 1:55 PM Kieran Bingham wrote: > > Hi Brendan, > > On 12/02/2019 22:10, Brendan Higgins wrote: > > On Mon, Feb 11, 2019 at 4:16 AM Kieran Bingham > > wrote: > >> > >> Hi Brendan, > >> > >> On 09/02/2019 00:56, Brendan Higgins wrote: > >>> On Thu, Dec 6, 2018 at 4:16 AM Kier

Re: [RFC v3 14/19] Documentation: kunit: add documentation for KUnit

2019-02-14 Thread Brendan Higgins via dri-devel
On Mon, Feb 11, 2019 at 4:16 AM Kieran Bingham wrote: > > Hi Brendan, > > On 09/02/2019 00:56, Brendan Higgins wrote: > > On Thu, Dec 6, 2018 at 4:16 AM Kieran Bingham > > wrote: > >> > >> Hi Brendan, > >> > >> On 03/12/2018 23:53, Brendan Higgins wrote: > >>> On Thu, Nov 29, 2018 at 7:45 PM Luis