All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Hildenbrand <david@redhat.com>
To: Rebecca Mckeever <remckee0@gmail.com>
Cc: Mike Rapoport <rppt@kernel.org>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 1/5] memblock tests: add range tests for memblock_alloc_exact_nid_raw
Date: Tue, 11 Oct 2022 11:36:06 +0200	[thread overview]
Message-ID: <cf327d9f-eb29-9107-7fcb-6ae510c2abee@redhat.com> (raw)
In-Reply-To: <20221011041910.GA7782@sophie>

On 11.10.22 06:19, Rebecca Mckeever wrote:
> On Mon, Oct 10, 2022 at 01:16:03PM +0200, David Hildenbrand wrote:
>> On 03.10.22 01:41, Rebecca Mckeever wrote:
>>> Add tests for memblock_alloc_exact_nid_raw() that are very similar to
>>> the range tests for memblock_alloc_try_nid_raw().
>>>
>>> Signed-off-by: Rebecca Mckeever <remckee0@gmail.com>
>>> ---
>>>    tools/testing/memblock/Makefile               |    2 +-
>>>    tools/testing/memblock/main.c                 |    2 +
>>>    .../memblock/tests/alloc_exact_nid_api.c      | 1208 +++++++++++++++++
>>>    .../memblock/tests/alloc_exact_nid_api.h      |    9 +
>>>    4 files changed, 1220 insertions(+), 1 deletion(-)
>>>    create mode 100644 tools/testing/memblock/tests/alloc_exact_nid_api.c
>>>    create mode 100644 tools/testing/memblock/tests/alloc_exact_nid_api.h
>>>
>>> diff --git a/tools/testing/memblock/Makefile b/tools/testing/memblock/Makefile
>>> index 246f7ac8489b..2310ac4d080e 100644
>>> --- a/tools/testing/memblock/Makefile
>>> +++ b/tools/testing/memblock/Makefile
>>> @@ -7,7 +7,7 @@ CFLAGS += -I. -I../../include -Wall -O2 -fsanitize=address \
>>>    LDFLAGS += -fsanitize=address -fsanitize=undefined
>>>    TARGETS = main
>>>    TEST_OFILES = tests/alloc_nid_api.o tests/alloc_helpers_api.o tests/alloc_api.o \
>>> -		  tests/basic_api.o tests/common.o
>>> +		  tests/basic_api.o tests/common.o tests/alloc_exact_nid_api.o
>>>    DEP_OFILES = memblock.o lib/slab.o mmzone.o slab.o
>>>    OFILES = main.o $(DEP_OFILES) $(TEST_OFILES)
>>>    EXTR_SRC = ../../../mm/memblock.c
>>> diff --git a/tools/testing/memblock/main.c b/tools/testing/memblock/main.c
>>> index 4ca1024342b1..278f9dec5008 100644
>>> --- a/tools/testing/memblock/main.c
>>> +++ b/tools/testing/memblock/main.c
>>> @@ -3,6 +3,7 @@
>>>    #include "tests/alloc_api.h"
>>>    #include "tests/alloc_helpers_api.h"
>>>    #include "tests/alloc_nid_api.h"
>>> +#include "tests/alloc_exact_nid_api.h"
>>>    #include "tests/common.h"
>>>    int main(int argc, char **argv)
>>> @@ -12,6 +13,7 @@ int main(int argc, char **argv)
>>>    	memblock_alloc_checks();
>>>    	memblock_alloc_helpers_checks();
>>>    	memblock_alloc_nid_checks();
>>> +	memblock_alloc_exact_nid_checks();
>>>    	return 0;
>>>    }
>>
>>
>> memblock_alloc_exact_nid_raw(NUMA_NO_NODE) behaves exactly the way
>> memblock_alloc_try_nid_raw(NUMA_NO_NODE) behaves -- which is essentially
>> memblock_alloc_raw().
>>
>> So do we really need a separate set of tests for these?
>>
> Instead of a separate set of tests, I could add a flag for
> memblock_alloc_exact_nid_raw() to test_flags so that the range tests in
> alloc_nid_api.c could be run with that flag. Do you think I should do
> that, or omit tests for memblock_alloc_exact_nid_raw(NUMA_NO_NODE)
> altogether?

Good question. From an API point of view, it makes sense to test that 
API somehow. With implementation in mind, it doesn't make too much sense 
to test it twice.

Whatever you prefer :) Just wanted to point out that separate tests 
don't make sense -- using a flag would be cleaner.

-- 
Thanks,

David / dhildenb


  reply	other threads:[~2022-10-11  9:36 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-02 23:41 [PATCH v2 0/5] memblock tests: add tests for memblock_alloc_exact_nid_raw Rebecca Mckeever
2022-10-02 23:41 ` [PATCH v2 1/5] memblock tests: add range " Rebecca Mckeever
2022-10-10 11:16   ` David Hildenbrand
2022-10-11  4:19     ` Rebecca Mckeever
2022-10-11  9:36       ` David Hildenbrand [this message]
2022-10-02 23:41 ` [PATCH v2 2/5] memblock tests: add top-down NUMA " Rebecca Mckeever
2022-10-02 23:41 ` [PATCH v2 3/5] memblock tests: add bottom-up " Rebecca Mckeever
2022-10-02 23:41 ` [PATCH v2 4/5] memblock tests: add generic " Rebecca Mckeever
2022-10-02 23:41 ` [PATCH v2 5/5] memblock tests: remove completed TODO item Rebecca Mckeever
2022-10-10  9:07   ` David Hildenbrand

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=cf327d9f-eb29-9107-7fcb-6ae510c2abee@redhat.com \
    --to=david@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=remckee0@gmail.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.