lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YrPyfqENPHfUCaq4@bertie>
Date:   Wed, 22 Jun 2022 23:56:30 -0500
From:   Rebecca Mckeever <remckee0@...il.com>
To:     Mike Rapoport <rppt@...nel.org>
Cc:     "Huang, Shaoqin" <shaoqin.huang@...el.com>, linux-mm@...ck.org,
        linux-kernel@...r.kernel.org, David Hildenbrand <david@...hat.com>
Subject: Re: [PATCH v3 2/4] memblock tests: add verbose output to memblock
 tests

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ