lkml.org 
[lkml]   [2022]   [Jun]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v3 2/4] memblock tests: add verbose output to memblock tests
On Thu, Jun 23, 2022 at 09:29:05AM +0800, Huang, Shaoqin wrote:
>
>
> On 6/23/2022 8:45 AM, Rebecca Mckeever wrote:
> > On Wed, Jun 22, 2022 at 06:32:04PM +0800, Huang, Shaoqin wrote:
> > > Just test it and everything works fine. And I think there are some thing can
> > > improve:
> > >
> > > The prefix_push() and prefix_pop() are used in so many functions and
> > > almost of them just put the prefix_push(__func__) begin in the head and the
> > > prefix_pop() in the end.
> > > May be you can define some macro that when you output something and
> > > automatically push the __func__ as prefix. And when leave the function,
> > > automatically pop it. And only in some special place, you call it manually.
> > >
> > Thank you for your review. I'm not sure how you would automatically push
> > __func__ since you have to be inside the function to access that
> > variable. Let me know if you have any suggestions. I am thinking about
> > adding another function in common.c that just calls test_pass() followed
> > by prefix_pop() since those are called together so often.
>
> Just like:
> #define test_pass_macro() \
> do { \
> prefix_push(__func__); \
> test_pass(); \
> prefix_pop(); \
> } while (0)

This will not print the name of the failing test, e.g. instead of

not ok 28 : memblock_alloc: alloc_bottom_up_disjoint_check: failed

with Rebecca's implementation it'll print

not ok 28 : memblock_alloc: failed

How about

#define PREFIX_PUSH() prefix_push(__func__)?

> This macro will automatically push the __fun__ as prefix when you call
> test_pass_macro(). And then pop it after test_pass() output.
>
> And use this macro() to hidden most of the paired prefix_* functions.
>
> And I think that's the simplist way. May be someone has a better solution.
>

--
Sincerely yours,
Mike.

\
 
 \ /
  Last update: 2022-06-23 06:51    [W:0.103 / U:0.168 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site