Re: [RFC bpf-next v1 6/8] selftests/bpf: extract test_loader->expect_msgs as a data structure

Andrii Nakryiko
2024-07-02T00:42:16Z

On Sat, Jun 29, 2024 at 2:48 AM Eduard Zingerman <eddyz87@gmail.com> wrote:
>
> Non-functional change: use a separate data structure to represented
> expected messages in test_loader.
> This would allow to use the same functionality for expected set of
> disassembled instructions in the follow-up commit.
>
> Signed-off-by: Eduard Zingerman <eddyz87@gmail.com>
> ---
> tools/testing/selftests/bpf/test_loader.c | 81 ++++++++++++-----------
> 1 file changed, 41 insertions(+), 40 deletions(-)
>

Just being a PITA below :)

Acked-by: Andrii Nakryiko <andrii@kernel.org>

> diff --git a/tools/testing/selftests/bpf/test_loader.c b/tools/testing/selftests/bpf/test_loader.c
> index ac9d3e81abdb..d4bb68685ba5 100644
> --- a/tools/testing/selftests/bpf/test_loader.c
> +++ b/tools/testing/selftests/bpf/test_loader.c
> @@ -55,11 +55,15 @@ struct expect_msg {
> regex_t regex;
> };
>
> +struct msgs {

but then "expected_msgs"? It's not messages it's definitions of
expected message specifier (which is a substring or regex), seems
useful to preserve distinction/specificity?

> + struct expect_msg *patterns;
> + size_t cnt;
> +};
> +
> struct test_subspec {
> char *name;
> bool expect_failure;
> - struct expect_msg *expect_msgs;
> - size_t expect_msg_cnt;
> + struct msgs expect_msgs;
> int retval;
> bool execute;
> }; …