From: Stanislav Fomichev <stfomichev@gmail.com>
To: "Alexis Lothoré (eBPF Foundation)" <alexis.lothore@bootlin.com>
Cc: Andrii Nakryiko <andrii@kernel.org>,
Eduard Zingerman <eddyz87@gmail.com>,
Mykola Lysenko <mykolal@fb.com>,
Alexei Starovoitov <ast@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
Martin KaFai Lau <martin.lau@linux.dev>,
Song Liu <song@kernel.org>,
Yonghong Song <yonghong.song@linux.dev>,
John Fastabend <john.fastabend@gmail.com>,
KP Singh <kpsingh@kernel.org>,
Stanislav Fomichev <sdf@fomichev.me>, Hao Luo <haoluo@google.com>,
Jiri Olsa <jolsa@kernel.org>, Shuah Khan <shuah@kernel.org>,
ebpf@linuxfoundation.org,
Thomas Petazzoni <thomas.petazzoni@bootlin.com>,
Bastien Curutchet <bastien.curutchet@bootlin.com>,
Petar Penkov <ppenkov@google.com>,
bpf@vger.kernel.org, linux-kselftest@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH bpf-next 01/10] selftests/bpf: add a macro to compare raw memory
Date: Wed, 13 Nov 2024 09:31:04 -0800 [thread overview]
Message-ID: <ZzTiWBLaUDex4ieA@mini-arch> (raw)
In-Reply-To: <20241113-flow_dissector-v1-1-27c4df0592dc@bootlin.com>
On 11/13, Alexis Lothoré (eBPF Foundation) wrote:
> We sometimes need to compare whole structures in an assert. It is
> possible to use the existing macros on each field, but when the whole
> structure has to be checked, it is more convenient to simply compare the
> whole structure memory
>
> Add a dedicated assert macro, ASSERT_MEMEQ, to allow bare memory
> comparision
>
> Signed-off-by: Alexis Lothoré (eBPF Foundation) <alexis.lothore@bootlin.com>
> ---
> tools/testing/selftests/bpf/test_progs.h | 25 +++++++++++++++++++++++++
> 1 file changed, 25 insertions(+)
>
> diff --git a/tools/testing/selftests/bpf/test_progs.h b/tools/testing/selftests/bpf/test_progs.h
> index 74de33ae37e56c90646cd1e0bb58ed7e3f345ec0..bdde741543836991398daacfe5423e6af8ef9151 100644
> --- a/tools/testing/selftests/bpf/test_progs.h
> +++ b/tools/testing/selftests/bpf/test_progs.h
> @@ -186,6 +186,19 @@ void test__skip(void);
> void test__fail(void);
> int test__join_cgroup(const char *path);
[..]
> +#define DUMP_BUFFER(name, buf, len) \
> + ({ \
> + fprintf(stdout, "%s:\n", name); \
> + for (int i = 0; i < len; i++) { \
> + if (i && !(i % 16)) \
> + fprintf(stdout, "\n"); \
> + if (i && !(i % 8) && (i % 16)) \
> + fprintf(stdout, "\t"); \
> + fprintf(stdout, "%02X ", ((uint8_t *)(buf))[i]); \
> + } \
> + fprintf(stdout, "\n"); \
> + })
nit: should we rewrite this as a real function?
void hexdump(const char *prefix, void *buf, size_t len)
{
..
}
next prev parent reply other threads:[~2024-11-13 17:31 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-13 13:53 [PATCH bpf-next 00/10] selftests/bpf: migrate test_flow_dissector.sh to test_progs Alexis Lothoré (eBPF Foundation)
2024-11-13 13:53 ` [PATCH bpf-next 01/10] selftests/bpf: add a macro to compare raw memory Alexis Lothoré (eBPF Foundation)
2024-11-13 17:31 ` Stanislav Fomichev [this message]
2024-11-13 13:53 ` [PATCH bpf-next 02/10] selftests/bpf: use ASSERT_MEMEQ to compare bpf flow keys Alexis Lothoré (eBPF Foundation)
2024-11-13 17:32 ` Stanislav Fomichev
2024-11-13 13:53 ` [PATCH bpf-next 03/10] selftests/bpf: replace CHECK calls with ASSERT macros in flow_dissector test Alexis Lothoré (eBPF Foundation)
2024-11-13 17:34 ` Stanislav Fomichev
2024-11-13 13:53 ` [PATCH bpf-next 04/10] selftests/bpf: re-split main function into dedicated tests Alexis Lothoré (eBPF Foundation)
2024-11-13 17:42 ` Stanislav Fomichev
2024-11-14 7:57 ` Alexis Lothoré
2024-11-13 13:53 ` [PATCH bpf-next 05/10] selftests/bpf: expose all subtests from flow_dissector Alexis Lothoré (eBPF Foundation)
2024-11-13 17:43 ` Stanislav Fomichev
2024-11-13 13:53 ` [PATCH bpf-next 06/10] selftests/bpf: add gre packets testing to flow_dissector Alexis Lothoré (eBPF Foundation)
2024-11-13 17:46 ` Stanislav Fomichev
2024-11-13 13:53 ` [PATCH bpf-next 07/10] selftests/bpf: migrate flow_dissector namespace exclusivity test Alexis Lothoré (eBPF Foundation)
2024-11-13 14:23 ` Alexis Lothoré
2024-11-13 17:50 ` Stanislav Fomichev
2024-11-14 7:58 ` Alexis Lothoré
2024-11-13 13:53 ` [PATCH bpf-next 08/10] selftests/bpf: Enable generic tc actions in selftests config Alexis Lothoré (eBPF Foundation)
2024-11-13 17:51 ` Stanislav Fomichev
2024-11-13 13:53 ` [PATCH bpf-next 09/10] selftests/bpf: migrate bpf flow dissectors tests to test_progs Alexis Lothoré (eBPF Foundation)
2024-11-13 17:58 ` Stanislav Fomichev
2024-11-14 8:04 ` Alexis Lothoré
2024-11-13 13:53 ` [PATCH bpf-next 10/10] selftests/bpf: remove test_flow_dissector.sh Alexis Lothoré (eBPF Foundation)
2024-11-13 17:59 ` Stanislav Fomichev
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=ZzTiWBLaUDex4ieA@mini-arch \
--to=stfomichev@gmail.com \
--cc=alexis.lothore@bootlin.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bastien.curutchet@bootlin.com \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=ebpf@linuxfoundation.org \
--cc=eddyz87@gmail.com \
--cc=haoluo@google.com \
--cc=john.fastabend@gmail.com \
--cc=jolsa@kernel.org \
--cc=kpsingh@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=martin.lau@linux.dev \
--cc=mykolal@fb.com \
--cc=ppenkov@google.com \
--cc=sdf@fomichev.me \
--cc=shuah@kernel.org \
--cc=song@kernel.org \
--cc=thomas.petazzoni@bootlin.com \
--cc=yonghong.song@linux.dev \
/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