On Wed, Oct 17, 2018 at 3:47 PM Rob Herring <rob.herring@xxxxxxxxxx> wrote: > > On Tue, Oct 16, 2018 at 6:54 PM Brendan Higgins > <brendanhiggins@xxxxxxxxxx> 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.