BPF List
 help / color / mirror / Atom feed
From: Eduard Zingerman <eddyz87@gmail.com>
To: Ihor Solodrai <ihor.solodrai@pm.me>, bpf@vger.kernel.org
Cc: andrii@kernel.org, ast@kernel.org, daniel@iogearbox.net,
	mykolal@fb.com, jose.marchesi@oracle.com
Subject: Re: [PATCH bpf-next 3/5] selftests/bpf: add a btf_dump test for type_tags
Date: Wed, 22 Jan 2025 18:45:19 -0800	[thread overview]
Message-ID: <28b232406e80922c882bacb553e160b3f5ffb32a.camel@gmail.com> (raw)
In-Reply-To: <20250122025308.2717553-4-ihor.solodrai@pm.me>

On Wed, 2025-01-22 at 02:53 +0000, Ihor Solodrai wrote:
> Factor out common routines handling custom BTF from
> test_btf_dump_incremental. Then use them in the
> test_btf_dump_type_tags.
> 
> test_btf_dump_type_tags verifies that a type tag is dumped correctly
> with respect to its kflag.
> 
> Signed-off-by: Ihor Solodrai <ihor.solodrai@pm.me>
> ---

Acked-by: Eduard Zingerman <eddyz87@gmail.com>

>  .../selftests/bpf/prog_tests/btf_dump.c       | 148 +++++++++++++-----
>  1 file changed, 111 insertions(+), 37 deletions(-)
> 
> diff --git a/tools/testing/selftests/bpf/prog_tests/btf_dump.c b/tools/testing/selftests/bpf/prog_tests/btf_dump.c
> index b293b8501fd6..690cf8cef7d2 100644
> --- a/tools/testing/selftests/bpf/prog_tests/btf_dump.c
> +++ b/tools/testing/selftests/bpf/prog_tests/btf_dump.c
> @@ -126,26 +126,70 @@ static int test_btf_dump_case(int n, struct btf_dump_test_case *t)
>  	return err;
>  }
>  
> -static char *dump_buf;
> -static size_t dump_buf_sz;
> -static FILE *dump_buf_file;
> +struct btf_dump__custom_btf_test {

Nit: since there would be a v2, I'd give this thing a shorter name,
     e.g. test_ctx.

> +	struct btf *btf;
> +	struct btf_dump *d;
> +	char *dump_buf;
> +	size_t dump_buf_sz;
> +	FILE *dump_buf_file;
> +};

[...]

> +static void test_btf_dump_incremental(void)
> +{
> +	struct btf_dump__custom_btf_test t;

Nit: this should be 'struct btf_dump__custom_btf_test t = {};'
     otherwise btf_dump__custom_btf_test__init() would read
     garbage in the error cases.

> +	struct btf *btf;
> +	int id, err;
> +
> +	if (btf_dump__custom_btf_test__init(&t))
> +		return;
> +
> +	btf = t.btf;
> +
>  	/* First, generate BTF corresponding to the following C code:
>  	 *
>  	 * enum x;

[...]


  reply	other threads:[~2025-01-23  2:45 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-22  2:53 [PATCH bpf-next 0/5] BTF: arbitrary __attribute__ encoding Ihor Solodrai
2025-01-22  2:53 ` [PATCH bpf-next 1/5] libbpf: introduce kflag for type_tags and decl_tags in BTF Ihor Solodrai
2025-01-22 10:56   ` Alan Maguire
2025-01-22 18:22     ` Ihor Solodrai
2025-01-22 22:02   ` Andrii Nakryiko
2025-01-22  2:53 ` [PATCH bpf-next 2/5] libbpf: check the kflag of type tags in btf_dump Ihor Solodrai
2025-01-22 10:57   ` Alan Maguire
2025-01-22  2:53 ` [PATCH bpf-next 3/5] selftests/bpf: add a btf_dump test for type_tags Ihor Solodrai
2025-01-23  2:45   ` Eduard Zingerman [this message]
2025-01-22  2:53 ` [PATCH bpf-next 4/5] bpf: allow kind_flag for BTF type and decl tags Ihor Solodrai
2025-01-22 11:09   ` Alan Maguire
2025-01-22 18:25     ` Ihor Solodrai
2025-01-22  2:53 ` [PATCH bpf-next 5/5] selftests/bpf: add a BTF verification test for kflagged type_tag Ihor Solodrai
2025-01-22 10:13 ` [PATCH bpf-next 0/5] BTF: arbitrary __attribute__ encoding Alan Maguire
2025-01-27 20:51   ` Ihor Solodrai
2025-01-22 11:44 ` Jose E. Marchesi
2025-01-22 18:06   ` Ihor Solodrai
2025-01-22 19:47     ` Jose E. Marchesi
2025-01-22 20:38       ` Ihor Solodrai
2025-01-22 21:52   ` Andrii Nakryiko
2025-01-22 22:44     ` Jose E. Marchesi

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=28b232406e80922c882bacb553e160b3f5ffb32a.camel@gmail.com \
    --to=eddyz87@gmail.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=ihor.solodrai@pm.me \
    --cc=jose.marchesi@oracle.com \
    --cc=mykolal@fb.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox