linux-kselftest.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Steve Muckle <smuckle@google.com>
To: Brendan Higgins <brendanhiggins@google.com>,
	David Gow <davidgow@google.com>
Cc: Daniel Latypov <dlatypov@google.com>,
	Kees Cook <keescook@chromium.org>,
	Shuah Khan <skhan@linuxfoundation.org>,
	Steven Rostedt <rostedt@goodmis.org>,
	kunit-dev@googlegroups.com, linux-kselftest@vger.kernel.org,
	linux-kernel@vger.kernel.org, Joe Fradley <joefradley@google.com>
Subject: Re: [RFC PATCH 1/2] kunit: Expose 'static stub' API to redirect functions
Date: Fri, 15 Apr 2022 15:05:00 -0700	[thread overview]
Message-ID: <96ea015d-7d95-a214-5e46-85015975e7d0@google.com> (raw)
In-Reply-To: <CAFd5g46zjsrz16mYmu1Q57dYkch6J2FO1XkM9XwS=cWiUidz6g@mail.gmail.com>

On 4/4/22 13:16, Brendan Higgins wrote:
> On Thu, Mar 17, 2022 at 10:13 PM David Gow <davidgow@google.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...

  reply	other threads:[~2022-04-15 22:05 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-18  2:13 [RFC PATCH 0/2] kunit: Support redirecting function calls David Gow
2022-03-18  2:13 ` [RFC PATCH 1/2] kunit: Expose 'static stub' API to redirect functions David Gow
2022-04-04 20:16   ` Brendan Higgins
2022-04-15 22:05     ` Steve Muckle [this message]
2022-05-04 20:35   ` Daniel Latypov
2022-05-04 20:42     ` Brendan Higgins
2022-05-04 21:16       ` Daniel Latypov
2022-03-18  2:13 ` [RFC PATCH 2/2] kunit: expose ftrace-based API for stubbing out functions during tests David Gow
2022-04-04 20:17   ` Brendan Higgins
2022-04-04 21:13   ` Daniel Latypov
2022-03-18 13:21 ` [RFC PATCH 0/2] kunit: Support redirecting function calls Steven Rostedt
2022-04-04 20:13   ` Brendan Higgins
2022-04-15 21:43     ` Steve Muckle
2022-04-15 21:44       ` Steve Muckle
2022-04-04 20:14 ` Brendan Higgins

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=96ea015d-7d95-a214-5e46-85015975e7d0@google.com \
    --to=smuckle@google.com \
    --cc=brendanhiggins@google.com \
    --cc=davidgow@google.com \
    --cc=dlatypov@google.com \
    --cc=joefradley@google.com \
    --cc=keescook@chromium.org \
    --cc=kunit-dev@googlegroups.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=rostedt@goodmis.org \
    --cc=skhan@linuxfoundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).