Re: [PATCH v3 2/4] memblock tests: add verbose output to memblock tests

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Jun 22, 2022 at 11:05:27PM -0500, Mike Rapoport wrote:
> 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
> 
Oh yeah, prefix_push() needs to be called before the asserts.

> How about
> 
> #define PREFIX_PUSH() 	prefix_push(__func__)?
>  
Good idea. What about 

#define TEST_PASS() do { \
	test_pass(); \
	prefix_pop(); \
} while (0)

? Or would it be better to make a function?

> > 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.

Thanks,
Rebecca




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux