[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAFd5g44v3BrRYosoFhD8iP4nxEKdJJ=VjhN3aMexOtWJ87WX-g@mail.gmail.com>
Date: Wed, 17 Oct 2018 18:32:27 -0700
From: Brendan Higgins <brendanhiggins@...gle.com>
To: rob.herring@...aro.org
Cc: Greg KH <gregkh@...uxfoundation.org>,
Kees Cook <keescook@...gle.com>, mcgrof@...nel.org,
shuah@...nel.org, Joel Stanley <joel@....id.au>,
mpe@...erman.id.au, joe@...ches.com, brakmo@...com,
rostedt@...dmis.org, Tim.Bird@...y.com, khilman@...libre.com,
Julia Lawall <julia.lawall@...6.fr>,
linux-kselftest@...r.kernel.org, kunit-dev@...glegroups.com,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
jdike@...toit.com, richard@....at, linux-um@...ts.infradead.org
Subject: Re: [RFC v1 22/31] kunit: mock: add the concept of spyable functions
On Wed, Oct 17, 2018 at 3:47 PM Rob Herring <rob.herring@...aro.org> wrote:
>
> On Tue, Oct 16, 2018 at 6:54 PM Brendan Higgins
> <brendanhiggins@...gle.com> wrote:
> >
> > Adds the concept of spying like in Mockito
> > (http://static.javadoc.io/org.mockito/mockito-core/2.20.0/org/mockito/Mockito.html#spy-T-).
> > This allows a function declaration to be labled as spyable which allows
> > the function to be mocked *and* to allow the mock to invoke the original
> > function definition.
>
> We can already hook into arbitrary functions ftrace. Wouldn't
> utilizing that simplify features like this and avoid having to touch
> existing code for testing? Not sure what it would take to enable
> ftrace on UML. It is at least partially compiler dependent.
Regardless of what we end up doing, this definitely needs more work.
After looking at include/linux/ftrace.h, it does look feasible to use
ftrace for spying. I totally agree that we don't want to reinvent this
wheel if we can avoid it, but I have no idea what getting it working
on UML would look like. Dependence on compiler features could be an
issue: pretty much anyone who can build the kernel should be able to
run our tests.
Powered by blists - more mailing lists