[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <96ea015d-7d95-a214-5e46-85015975e7d0@google.com>
Date: Fri, 15 Apr 2022 15:05:00 -0700
From: Steve Muckle <smuckle@...gle.com>
To: Brendan Higgins <brendanhiggins@...gle.com>,
David Gow <davidgow@...gle.com>
Cc: Daniel Latypov <dlatypov@...gle.com>,
Kees Cook <keescook@...omium.org>,
Shuah Khan <skhan@...uxfoundation.org>,
Steven Rostedt <rostedt@...dmis.org>,
kunit-dev@...glegroups.com, linux-kselftest@...r.kernel.org,
linux-kernel@...r.kernel.org, Joe Fradley <joefradley@...gle.com>
Subject: Re: [RFC PATCH 1/2] kunit: Expose 'static stub' API to redirect
functions
On 4/4/22 13:16, Brendan Higgins wrote:
> On Thu, Mar 17, 2022 at 10:13 PM David Gow <davidgow@...gle.com> wrote:
>> +/**
>> + * KUNIT_STATIC_STUB_REDIRECT() - call a replacement 'static stub' if one exists
>> + * @real_fn_name: The name of this function (as an identifier, not a string)
>> + * @args: All of the arguments passed to this function
>> + *
>> + * This is a function prologue which is used to allow calls to the current
>> + * function to be redirected by a KUnit test. KUnit tests can call
>> + * kunit_activate_static_stub() to pass a replacement function in. The
>> + * replacement function will be called by KUNIT_TRIGGER_STATIC_STUB(), which
>> + * will then return from the function. If the caller is not in a KUnit context,
>> + * the function will continue execution as normal.
>> + *
>> + * Example:
>> + *
>> + * .. code-block:: c
>> + * int real_func(int n)
>> + * {
>> + * KUNIT_STATIC_STUB_REDIRECT(real_func, n);
I wish there was a way to avoid having to repeat the function's name and
arguments here...
Powered by blists - more mailing lists