<div dir="ltr">Thanks for your expedient answer!<div><br></div><div>So, I was discussing an alternative to mocking; function hooking. But in a benign way. Is there any way to, at runtime replace the functionality of code in order that you specify what it does for any given kernel function?</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Feb 20, 2015 at 3:24 PM, Greg KH <span dir="ltr"><<a href="mailto:greg@kroah.com" target="_blank">greg@kroah.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">On Fri, Feb 20, 2015 at 02:51:25PM -0500, Kenneth Adam Miller wrote:<br>
> So, in userland development, the idea of mocking is used to isolate context<br>
> management and machine configuration into a single class or set of functions<br>
> that can be reused, and also facilitate testing much easier. Google mock is a<br>
> great example.<br>
><br>
> Say I develop a kernel module, and I want that module to have some result X<br>
> after some returned result, whatever that might be. Is there anything similar<br>
> for kernel code? <br>
<br>
</div></div>Not really, sorry. Running in the kernel means you don't have much room<br>
for "simulation". But you can use qemu, or other virtual machines and a<br>
debugger to test your code if you really want to.<br>
<br>
Good luck!<br>
<br>
greg k-h<br>
</blockquote></div><br></div>