Re: [PATCH 12/53] selftests/mm: khugepaged: group tests in an array

Mark Brown
2026-04-06T16:49:22Z

[-- Attachment #1: Type: text/plain, Size: 935 bytes --]

On Mon, Apr 06, 2026 at 05:16:54PM +0300, Mike Rapoport wrote:
> From: "Mike Rapoport (Microsoft)" <rppt@kernel.org>

> Currently khugepaged decides if a test can run using TEST() macro that
> checks what mem_ops and collapse_context are set by the command line
> arguments.

> For better compatibility with ksefltest framework, add an array of 'struct
> test_case's and redefine TEST() macro to conditionally add enabled tests to
> that array.

It would feel more idiomatic to skip rather than ignore the tests but
both approaches work in the end.

> + for (int i = 0; i < nr_test_cases; i++) {
> + struct test_case *t = &test_cases[i];
> +
> + exit_status = KSFT_PASS;
> + printf("\nRun test: %s: (%s:%s)\n", t->desc, t->ctx->name, t->ops->name);
> + t->fn(t->ctx, t->ops);
> + }

The exit_status handling here is a bit weird but it looks like the test
is a bit weird and I didn't spend time figuring out what the best thing
is.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]