Re: [PATCH v2 8/8] memblock tests: add tests for memblock_trim_memory

From: David Hildenbrand
Date: Tue Aug 23 2022 - 08:55:01 EST


On 19.08.22 10:34, Rebecca Mckeever wrote:
> Add tests for memblock_trim_memory() for the following scenarios:
> - all regions aligned
> - one region unalign that is smaller than the alignment

s/region unalign/unaligned region/

> - one region unaligned at the base
> - one region unaligned at the end

"unaligned region" ?

[...]

>
> +/*
> + * A test that tries to trim memory when both ends of the memory region are
> + * aligned. Expect that the memory will not be trimmed. Expect the counter to
> + * not be updated.
> + */
> +static int memblock_trim_memory_aligned_check(void)
> +{
> + struct memblock_region *rgn;
> + phys_addr_t alignment = SMP_CACHE_BYTES;

Could make that "const" -- same applies to other functions.

> +
> + rgn = &memblock.memory.regions[0];
> +
> + struct region r = {
> + .base = alignment,
> + .size = alignment * 4
> + };
> +

[[[.]

> +static int memblock_trim_memory_checks(void)
> +{
> + prefix_reset();
> + prefix_push(FUNC_TRIM);
> + test_print("Running %s tests...\n", FUNC_TRIM);

Just a note that this could have been

test_print("Running " FUNC_TRIM " tests...\n");

But it's good to keep this consistent for all tests.


Nice test cases!

--
Thanks,

David / dhildenb