linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Rebecca Mckeever <remckee0@gmail.com>
To: Mike Rapoport <rppt@kernel.org>
Cc: "Huang, Shaoqin" <shaoqin.huang@intel.com>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	David Hildenbrand <david@redhat.com>
Subject: Re: [PATCH v3 2/4] memblock tests: add verbose output to memblock tests
Date: Wed, 22 Jun 2022 23:56:30 -0500	[thread overview]
Message-ID: <YrPyfqENPHfUCaq4@bertie> (raw)
In-Reply-To: <YrPmhzZDd9YFyEUa@kernel.org>

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


  reply	other threads:[~2022-06-23  4:56 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-22  9:29 [PATCH v3 0/4] memblock tests: add VERBOSE and MEMBLOCK_DEBUG Makefile options Rebecca Mckeever
2022-06-22  9:29 ` [PATCH v3 1/4] memblock tests: add user-provided arguments to Makefile Rebecca Mckeever
2022-06-23  3:47   ` Mike Rapoport
2022-06-23  4:45     ` Rebecca Mckeever
2022-06-23  4:52       ` Mike Rapoport
2022-06-22  9:29 ` [PATCH v3 2/4] memblock tests: add verbose output to memblock tests Rebecca Mckeever
2022-06-22 10:32   ` Huang, Shaoqin
2022-06-23  0:45     ` Rebecca Mckeever
2022-06-23  1:29       ` Huang, Shaoqin
2022-06-23  3:10         ` Rebecca Mckeever
2022-06-23  4:05         ` Mike Rapoport
2022-06-23  4:56           ` Rebecca Mckeever [this message]
2022-06-23  5:04             ` Mike Rapoport
2022-06-23  7:57               ` Rebecca Mckeever
2022-06-23 13:11                 ` Mike Rapoport
2022-06-23  3:37   ` Ira Weiny
2022-06-23  7:25     ` Rebecca Mckeever
2022-06-23  4:30   ` Mike Rapoport
2022-06-23  6:30     ` Rebecca Mckeever
2022-06-23 14:40       ` Mike Rapoport
2022-06-24  7:18         ` Rebecca Mckeever
2022-06-22  9:29 ` [PATCH v3 4/4] memblock tests: remove completed TODO items Rebecca Mckeever
2022-06-22 10:00 ` [PATCH v3 0/4] memblock tests: add VERBOSE and MEMBLOCK_DEBUG Makefile options David Hildenbrand
2022-06-22 14:17 ` Mike Rapoport
2022-06-23  1:01   ` Rebecca Mckeever
2022-06-23  3:30 ` Ira Weiny
2022-06-23  4:20   ` Rebecca Mckeever
2022-06-23  4:38     ` Mike Rapoport
2022-06-23  5:48       ` Ira Weiny

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=YrPyfqENPHfUCaq4@bertie \
    --to=remckee0@gmail.com \
    --cc=david@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=rppt@kernel.org \
    --cc=shaoqin.huang@intel.com \
    /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).