From: Andrii Nakryiko <andrii.nakryiko@gmail.com>
To: Alan Maguire <alan.maguire@oracle.com>
Cc: Alexei Starovoitov <ast@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
Andrii Nakryiko <andrii@kernel.org>, Martin Lau <kafai@fb.com>,
Song Liu <songliubraving@fb.com>, Yonghong Song <yhs@fb.com>,
john fastabend <john.fastabend@gmail.com>,
KP Singh <kpsingh@kernel.org>, Bill Wendling <morbo@google.com>,
Shuah Khan <shuah@kernel.org>, bpf <bpf@vger.kernel.org>,
Networking <netdev@vger.kernel.org>,
"open list:KERNEL SELFTEST FRAMEWORK"
<linux-kselftest@vger.kernel.org>,
open list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v6 bpf-next 3/3] selftests/bpf: add dump type data tests to btf dump tests
Date: Thu, 15 Jul 2021 23:24:35 -0700 [thread overview]
Message-ID: <CAEf4Bzap=EHCRXwePxU+sW94DGFFOLqBnwtJyqhnFJ+s86D4qQ@mail.gmail.com> (raw)
In-Reply-To: <1626362126-27775-4-git-send-email-alan.maguire@oracle.com>
On Thu, Jul 15, 2021 at 8:16 AM Alan Maguire <alan.maguire@oracle.com> wrote:
>
> Test various type data dumping operations by comparing expected
> format with the dumped string; an snprintf-style printf function
> is used to record the string dumped. Also verify overflow handling
> where the data passed does not cover the full size of a type,
> such as would occur if a tracer has a portion of the 8k
> "struct task_struct".
>
> Signed-off-by: Alan Maguire <alan.maguire@oracle.com>
> ---
> tools/testing/selftests/bpf/prog_tests/btf_dump.c | 600 ++++++++++++++++++++++
> 1 file changed, 600 insertions(+)
>
[...]
> @@ -245,4 +815,34 @@ void test_btf_dump() {
> }
> if (test__start_subtest("btf_dump: incremental"))
> test_btf_dump_incremental();
> +
> + btf = libbpf_find_kernel_btf();
> + if (!ASSERT_NEQ(btf, NULL, "no kernel BTF found"))
> + return;
> +
> + d = btf_dump__new(btf, NULL, &opts, btf_dump_snprintf);
> +
> + if (!ASSERT_NEQ(d, NULL, "could not create BTF dump"))
better use ASSERT_OK_PTR() for this, I'll adjust when applying
> + return;
> +
> + /* Verify type display for various types. */
> + if (test__start_subtest("btf_dump: int_data"))
> + test_btf_dump_int_data(btf, d, str);
> + if (test__start_subtest("btf_dump: float_data"))
> + test_btf_dump_float_data(btf, d, str);
> + if (test__start_subtest("btf_dump: char_data"))
> + test_btf_dump_char_data(btf, d, str);
> + if (test__start_subtest("btf_dump: typedef_data"))
> + test_btf_dump_typedef_data(btf, d, str);
> + if (test__start_subtest("btf_dump: enum_data"))
> + test_btf_dump_enum_data(btf, d, str);
> + if (test__start_subtest("btf_dump: struct_data"))
> + test_btf_dump_struct_data(btf, d, str);
> + if (test__start_subtest("btf_dump: var_data"))
> + test_btf_dump_var_data(btf, d, str);
> + btf_dump__free(d);
> + btf__free(btf);
> +
> + if (test__start_subtest("btf_dump: datasec_data"))
> + test_btf_dump_datasec_data(str);
> }
> --
> 1.8.3.1
>
prev parent reply other threads:[~2021-07-16 6:24 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-15 15:15 [PATCH v6 bpf-next 0/3] libbpf: BTF dumper support for typed data Alan Maguire
2021-07-15 15:15 ` [PATCH v6 bpf-next 1/3] " Alan Maguire
2021-07-16 6:24 ` Andrii Nakryiko
2021-07-16 20:55 ` Andrii Nakryiko
2021-07-16 21:58 ` Andrii Nakryiko
2021-07-19 12:11 ` Naresh Kamboju
2021-07-19 14:15 ` Alan Maguire
2021-07-15 15:15 ` [PATCH v6 bpf-next 2/3] selftests/bpf: add ASSERT_STRNEQ() variant for test_progs Alan Maguire
2021-07-15 15:15 ` [PATCH v6 bpf-next 3/3] selftests/bpf: add dump type data tests to btf dump tests Alan Maguire
2021-07-16 6:24 ` Andrii Nakryiko [this message]
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='CAEf4Bzap=EHCRXwePxU+sW94DGFFOLqBnwtJyqhnFJ+s86D4qQ@mail.gmail.com' \
--to=andrii.nakryiko@gmail.com \
--cc=alan.maguire@oracle.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=john.fastabend@gmail.com \
--cc=kafai@fb.com \
--cc=kpsingh@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=morbo@google.com \
--cc=netdev@vger.kernel.org \
--cc=shuah@kernel.org \
--cc=songliubraving@fb.com \
--cc=yhs@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;
as well as URLs for NNTP newsgroup(s).