From: Rebecca Mckeever <remckee0@gmail.com>
To: David Hildenbrand <david@redhat.com>
Cc: Mike Rapoport <rppt@kernel.org>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v4 2/4] memblock tests: add verbose output to memblock tests
Date: Wed, 29 Jun 2022 12:07:34 -0500 [thread overview]
Message-ID: <YryG1nuJ+nL9maeS@bertie> (raw)
In-Reply-To: <5db2944e-9d64-8faa-83d3-fd02fce583bd@redhat.com>
On Wed, Jun 29, 2022 at 01:34:54PM +0200, David Hildenbrand wrote:
> On 28.06.22 00:34, Rebecca Mckeever wrote:
> > Add and use functions and macros for printing verbose testing output.
> >
> > If the Memblock simulator was compiled with VERBOSE=1:
> > - prefix_push(): appends the given string to a prefix string that will be
> > printed in test_fail() and test_pass*().
> >
> > - prefix_pop(): removes the last prefix from the prefix string.
> >
> > - prefix_reset(): clears the prefix string.
> >
> > - test_fail(): prints a message after a test fails containing the test
> > number of the failing test and the prefix.
> >
> > - test_pass(): prints a message after a test passes containing its test
> > number and the prefix.
> >
> > - test_print(): prints the given formatted output string.
> >
> > - test_pass_pop(): runs test_pass() followed by prefix_pop().
> >
> > - PREFIX_PUSH(): runs prefix_push(__func__).
> >
> > If the Memblock simulator was not compiled with VERBOSE=1, these
> > functions/macros do nothing.
> >
> > Add the assert wrapper macros ASSERT_EQ(), ASSERT_NE(), and ASSERT_LT().
> > If the assert condition fails, these macros call test_fail() before
> > executing assert().
> >
> > Signed-off-by: Rebecca Mckeever <remckee0@gmail.com>
>
>
> [...]
>
> >
> > diff --git a/tools/testing/memblock/tests/common.c b/tools/testing/memblock/tests/common.c
> > index 62d3191f7c9a..e55b2a8bf0ff 100644
> > --- a/tools/testing/memblock/tests/common.c
> > +++ b/tools/testing/memblock/tests/common.c
> > @@ -4,8 +4,12 @@
> >
> > #define INIT_MEMBLOCK_REGIONS 128
> > #define INIT_MEMBLOCK_RESERVED_REGIONS INIT_MEMBLOCK_REGIONS
> > +#define PREFIXES_LEN_MAX 256
> > +#define DELIM ": "
> > +#define DELIM_LEN strlen(DELIM)
>
> Why not simply
>
> #define PREFIXES_MAX 15
> static const char * __maybe_unused prefixes[PREFIXES_MAX];
> static int nr_prefixes;
>
> And then simply insert/clear the corresponding prefixes[] pointer and
> update nr_prefixes?
>
> When printing, you only have to walk prefixes from 0 ... nr_prefixes - 1
> and print the values.
>
> Avoids any string modifications.
>
What is nr_prefixes? Number of prefixes? Currently, the longest prefix is
49 characters (alloc_try_nid_bottom_up_reserved_with_space_check), so I
think PREFIXES_MAX would need to be at least 52 (including the delimiter),
but let me know if I'm misunderstanding.
>
> Anyhow, this LGTM
>
> Acked-by: David Hildenbrand <david@redhat.com>
>
> --
> Thanks,
>
> David / dhildenb
>
Thanks,
Rebecca
next prev parent reply other threads:[~2022-06-29 17:07 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-27 22:34 [PATCH v4 0/4] memblock tests: add VERBOSE and MEMBLOCK_DEBUG Makefile options Rebecca Mckeever
2022-06-27 22:34 ` [PATCH v4 1/4] memblock tests: Makefile: add arguments to control verbosity Rebecca Mckeever
2022-06-27 22:34 ` [PATCH v4 2/4] memblock tests: add verbose output to memblock tests Rebecca Mckeever
2022-06-28 1:45 ` Huang, Shaoqin
2022-06-29 11:34 ` David Hildenbrand
2022-06-29 17:07 ` Rebecca Mckeever [this message]
2022-06-30 10:17 ` David Hildenbrand
2022-07-01 1:50 ` Rebecca Mckeever
2022-06-27 22:34 ` [PATCH v4 3/4] memblock tests: set memblock_debug to enable memblock_dbg() messages Rebecca Mckeever
2022-06-27 22:34 ` [PATCH v4 4/4] memblock tests: remove completed TODO items Rebecca Mckeever
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=YryG1nuJ+nL9maeS@bertie \
--to=remckee0@gmail.com \
--cc=david@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=rppt@kernel.org \
/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