Re: [PATCH 2/6] selftests/liveupdate: add helper functions for memfd tests

From: Mike Rapoport

Date: Wed Mar 18 2026 - 03:26:07 EST


On Mon, Mar 09, 2026 at 11:54:35AM +0000, Pratyush Yadav wrote:
> From: "Pratyush Yadav (Google)" <pratyush@xxxxxxxxxx>
>
> Add some helper functions that will be used by memfd tests. This moves
> some of the complexity out of the test itself, which results in better
> test readability and less code duplication.
>
> Signed-off-by: Pratyush Yadav <ptyadav@xxxxxxxxx>
> Signed-off-by: Pratyush Yadav (Google) <pratyush@xxxxxxxxxx>
> ---
> .../selftests/liveupdate/luo_test_utils.c | 175 +++++++++++++++++-
> .../selftests/liveupdate/luo_test_utils.h | 9 +
> 2 files changed, 183 insertions(+), 1 deletion(-)
>
> diff --git a/tools/testing/selftests/liveupdate/luo_test_utils.c b/tools/testing/selftests/liveupdate/luo_test_utils.c
> index 3c8721c505df..45ace3697ee6 100644

...

> +/*
> + * Make sure fd contains expected data up to size. Returns 0 on success, 1 on
> + * data mismatch, -errno on error.
> + */
> +int verify_fd_content(int fd, const char *expected_data, size_t size)

Maybe verify_fd_content_read() to match _mmap()?

WIth this and write_size() and read_size() fixed

Reviewed-by: Mike Rapoport (Microsoft) <rppt@xxxxxxxxxx>

--
Sincerely yours,
Mike.