[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <98178f0f-ff43-b996-f78b-778f74b44a6b@huawei.com>
Date: Thu, 4 Nov 2021 14:32:37 +0800
From: Hou Tao <houtao1@...wei.com>
To: Joe Burton <jevburton.kernel@...il.com>,
Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>,
Andrii Nakryiko <andrii@...nel.org>,
Martin KaFai Lau <kafai@...com>,
Song Liu <songliubraving@...com>, Yonghong Song <yhs@...com>,
John Fastabend <john.fastabend@...il.com>,
KP Singh <kpsingh@...nel.org>, <linux-kernel@...r.kernel.org>,
<netdev@...r.kernel.org>, <bpf@...r.kernel.org>
CC: Petar Penkov <ppenkov@...gle.com>,
Stanislav Fomichev <sdf@...gle.com>,
Joe Burton <jevburton@...gle.com>
Subject: Re: [RFC PATCH v3 2/3] bpf: Add selftests
Hi,
On 11/2/2021 10:14 AM, Joe Burton wrote:
> From: Joe Burton <jevburton@...gle.com>
>
> Add selftests verifying that each supported map type is traced.
>
> Signed-off-by: Joe Burton <jevburton@...gle.com>
> ---
> .../selftests/bpf/prog_tests/map_trace.c | 166 ++++++++++++++++++
> .../selftests/bpf/progs/bpf_map_trace.c | 95 ++++++++++
> .../bpf/progs/bpf_map_trace_common.h | 12 ++
> 3 files changed, 273 insertions(+)
> create mode 100644 tools/testing/selftests/bpf/prog_tests/map_trace.c
> create mode 100644 tools/testing/selftests/bpf/progs/bpf_map_trace.c
> create mode 100644 tools/testing/selftests/bpf/progs/bpf_map_trace_common.h
snip
> + /*
> + * Invoke core BPF program.
> + */
> + write_fd = open("/tmp/map_trace_test_file", O_CREAT | O_WRONLY);
> + if (!ASSERT_GE(rc, 0, "open tmp file for writing"))
> + goto out;
> +
> + bytes_written = write(write_fd, &write_buf, sizeof(write_buf));
> + if (!ASSERT_EQ(bytes_written, sizeof(write_buf), "write to tmp file"))
> + return;
In fentry__x64_sys_write(), you just do trigger updates to maps, so for the
portability of the test
(e.g. run-able for arm64) and minimal dependency (e.g. don't depends on /tmp),
why do you
using nanosleep() and replacing fentry_x64_sys_write by
tp/syscalls/sys_enter_nanosleep instead.
Also it will be better if you can filter out other processes by pid.
Thanks,
Tao
Powered by blists - more mailing lists