diff mbox series

kunit: replace KUNIT_TRIGGER_STATIC_STUB maro with KUNIT_STATIC_STUB_REDIRECT

Message ID 20230725172051.2142641-1-shikemeng@huaweicloud.com (mailing list archive)
State Accepted
Commit 582eb3aeed2d06b122fba95518b84506d3d4ceb9
Delegated to: Brendan Higgins
Headers show
Series kunit: replace KUNIT_TRIGGER_STATIC_STUB maro with KUNIT_STATIC_STUB_REDIRECT | expand

Commit Message

Kemeng Shi July 25, 2023, 5:20 p.m. UTC
We mix up KUNIT_TRIGGER_STATIC_STUB and KUNIT_STATIC_STUB_REDIRECT in
static_stub header. Just correct KUNIT_TRIGGER_STATIC_STUB to
KUNIT_STATIC_STUB_REDIRECT which is documented.

Signed-off-by: Kemeng Shi <shikemeng@huaweicloud.com>
---
 include/kunit/static_stub.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Kemeng Shi Aug. 12, 2023, 3:55 a.m. UTC | #1
Friendly ping...

on 7/26/2023 1:20 AM, Kemeng Shi wrote:
> We mix up KUNIT_TRIGGER_STATIC_STUB and KUNIT_STATIC_STUB_REDIRECT in
> static_stub header. Just correct KUNIT_TRIGGER_STATIC_STUB to
> KUNIT_STATIC_STUB_REDIRECT which is documented.
> 
> Signed-off-by: Kemeng Shi <shikemeng@huaweicloud.com>
> ---
>  include/kunit/static_stub.h | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/include/kunit/static_stub.h b/include/kunit/static_stub.h
> index 9b80150a5d62..85315c80b303 100644
> --- a/include/kunit/static_stub.h
> +++ b/include/kunit/static_stub.h
> @@ -11,7 +11,7 @@
>  #if !IS_ENABLED(CONFIG_KUNIT)
>  
>  /* If CONFIG_KUNIT is not enabled, these stubs quietly disappear. */
> -#define KUNIT_TRIGGER_STATIC_STUB(real_fn_name, args...) do {} while (0)
> +#define KUNIT_STATIC_STUB_REDIRECT(real_fn_name, args...) do {} while (0)
>  
>  #else
>  
> @@ -30,7 +30,7 @@
>   * 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
> + * replacement function will be called by KUNIT_STATIC_STUB_REDIRECT(), which
>   * will then return from the function. If the caller is not in a KUnit context,
>   * the function will continue execution as normal.
>   *
> @@ -87,7 +87,7 @@ void __kunit_activate_static_stub(struct kunit *test,
>   * When activated, calls to real_fn_addr from within this test (even if called
>   * indirectly) will instead call replacement_addr. The function pointed to by
>   * real_fn_addr must begin with the static stub prologue in
> - * KUNIT_TRIGGER_STATIC_STUB() for this to work. real_fn_addr and
> + * KUNIT_STATIC_STUB_REDIRECT() for this to work. real_fn_addr and
>   * replacement_addr must have the same type.
>   *
>   * The redirection can be disabled again with kunit_deactivate_static_stub().
>
David Gow Aug. 12, 2023, 7:48 a.m. UTC | #2
On Tue, 25 Jul 2023 at 17:20, Kemeng Shi <shikemeng@huaweicloud.com> wrote:
>
> We mix up KUNIT_TRIGGER_STATIC_STUB and KUNIT_STATIC_STUB_REDIRECT in
> static_stub header. Just correct KUNIT_TRIGGER_STATIC_STUB to
> KUNIT_STATIC_STUB_REDIRECT which is documented.
>
> Signed-off-by: Kemeng Shi <shikemeng@huaweicloud.com>
> ---

Thanks for catching this!

Only minor note is that there's a typo in the subject ("maro","macro").

Fixes: e047c5eaa763 ("kunit: Expose 'static stub' API to redirect functions")
Reviewed-by: David Gow <davidgow@google.com>

Cheers,
-- David

>  include/kunit/static_stub.h | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/include/kunit/static_stub.h b/include/kunit/static_stub.h
> index 9b80150a5d62..85315c80b303 100644
> --- a/include/kunit/static_stub.h
> +++ b/include/kunit/static_stub.h
> @@ -11,7 +11,7 @@
>  #if !IS_ENABLED(CONFIG_KUNIT)
>
>  /* If CONFIG_KUNIT is not enabled, these stubs quietly disappear. */
> -#define KUNIT_TRIGGER_STATIC_STUB(real_fn_name, args...) do {} while (0)
> +#define KUNIT_STATIC_STUB_REDIRECT(real_fn_name, args...) do {} while (0)
>
>  #else
>
> @@ -30,7 +30,7 @@
>   * 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
> + * replacement function will be called by KUNIT_STATIC_STUB_REDIRECT(), which
>   * will then return from the function. If the caller is not in a KUnit context,
>   * the function will continue execution as normal.
>   *
> @@ -87,7 +87,7 @@ void __kunit_activate_static_stub(struct kunit *test,
>   * When activated, calls to real_fn_addr from within this test (even if called
>   * indirectly) will instead call replacement_addr. The function pointed to by
>   * real_fn_addr must begin with the static stub prologue in
> - * KUNIT_TRIGGER_STATIC_STUB() for this to work. real_fn_addr and
> + * KUNIT_STATIC_STUB_REDIRECT() for this to work. real_fn_addr and
>   * replacement_addr must have the same type.
>   *
>   * The redirection can be disabled again with kunit_deactivate_static_stub().
> --
> 2.30.0
>
> --
> You received this message because you are subscribed to the Google Groups "KUnit Development" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to kunit-dev+unsubscribe@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/kunit-dev/20230725172051.2142641-1-shikemeng%40huaweicloud.com.
Kemeng Shi Aug. 14, 2023, 1:44 a.m. UTC | #3
on 8/12/2023 3:48 PM, David Gow wrote:
> On Tue, 25 Jul 2023 at 17:20, Kemeng Shi <shikemeng@huaweicloud.com> wrote:
>>
>> We mix up KUNIT_TRIGGER_STATIC_STUB and KUNIT_STATIC_STUB_REDIRECT in
>> static_stub header. Just correct KUNIT_TRIGGER_STATIC_STUB to
>> KUNIT_STATIC_STUB_REDIRECT which is documented.
>>
>> Signed-off-by: Kemeng Shi <shikemeng@huaweicloud.com>
>> ---
> 
> Thanks for catching this!
> 
> Only minor note is that there's a typo in the subject ("maro","macro").
> 
> Fixes: e047c5eaa763 ("kunit: Expose 'static stub' API to redirect functions")
> Reviewed-by: David Gow <davidgow@google.com>
> Thanks for the feedback, I will fix it in next version.
> Cheers,
> -- David
> 
>>  include/kunit/static_stub.h | 6 +++---
>>  1 file changed, 3 insertions(+), 3 deletions(-)
>>
>> diff --git a/include/kunit/static_stub.h b/include/kunit/static_stub.h
>> index 9b80150a5d62..85315c80b303 100644
>> --- a/include/kunit/static_stub.h
>> +++ b/include/kunit/static_stub.h
>> @@ -11,7 +11,7 @@
>>  #if !IS_ENABLED(CONFIG_KUNIT)
>>
>>  /* If CONFIG_KUNIT is not enabled, these stubs quietly disappear. */
>> -#define KUNIT_TRIGGER_STATIC_STUB(real_fn_name, args...) do {} while (0)
>> +#define KUNIT_STATIC_STUB_REDIRECT(real_fn_name, args...) do {} while (0)
>>
>>  #else
>>
>> @@ -30,7 +30,7 @@
>>   * 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
>> + * replacement function will be called by KUNIT_STATIC_STUB_REDIRECT(), which
>>   * will then return from the function. If the caller is not in a KUnit context,
>>   * the function will continue execution as normal.
>>   *
>> @@ -87,7 +87,7 @@ void __kunit_activate_static_stub(struct kunit *test,
>>   * When activated, calls to real_fn_addr from within this test (even if called
>>   * indirectly) will instead call replacement_addr. The function pointed to by
>>   * real_fn_addr must begin with the static stub prologue in
>> - * KUNIT_TRIGGER_STATIC_STUB() for this to work. real_fn_addr and
>> + * KUNIT_STATIC_STUB_REDIRECT() for this to work. real_fn_addr and
>>   * replacement_addr must have the same type.
>>   *
>>   * The redirection can be disabled again with kunit_deactivate_static_stub().
>> --
>> 2.30.0
>>
>> --
>> You received this message because you are subscribed to the Google Groups "KUnit Development" group.
>> To unsubscribe from this group and stop receiving emails from it, send an email to kunit-dev+unsubscribe@googlegroups.com.
>> To view this discussion on the web visit https://groups.google.com/d/msgid/kunit-dev/20230725172051.2142641-1-shikemeng%40huaweicloud.com.
diff mbox series

Patch

diff --git a/include/kunit/static_stub.h b/include/kunit/static_stub.h
index 9b80150a5d62..85315c80b303 100644
--- a/include/kunit/static_stub.h
+++ b/include/kunit/static_stub.h
@@ -11,7 +11,7 @@ 
 #if !IS_ENABLED(CONFIG_KUNIT)
 
 /* If CONFIG_KUNIT is not enabled, these stubs quietly disappear. */
-#define KUNIT_TRIGGER_STATIC_STUB(real_fn_name, args...) do {} while (0)
+#define KUNIT_STATIC_STUB_REDIRECT(real_fn_name, args...) do {} while (0)
 
 #else
 
@@ -30,7 +30,7 @@ 
  * 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
+ * replacement function will be called by KUNIT_STATIC_STUB_REDIRECT(), which
  * will then return from the function. If the caller is not in a KUnit context,
  * the function will continue execution as normal.
  *
@@ -87,7 +87,7 @@  void __kunit_activate_static_stub(struct kunit *test,
  * When activated, calls to real_fn_addr from within this test (even if called
  * indirectly) will instead call replacement_addr. The function pointed to by
  * real_fn_addr must begin with the static stub prologue in
- * KUNIT_TRIGGER_STATIC_STUB() for this to work. real_fn_addr and
+ * KUNIT_STATIC_STUB_REDIRECT() for this to work. real_fn_addr and
  * replacement_addr must have the same type.
  *
  * The redirection can be disabled again with kunit_deactivate_static_stub().